2014-09-19 53 views
0

我有兩臺服務器server1的服務器2,我已經設置一個主 - 主複製MySQL主 - 主複製只有一個數據庫忽略其他

但在server1的我有很多的數據庫和Server2上我只有一個那就是我想與server1的

我設置複製到複製數據庫,它工作正常,但之後有人開始改變一些其他數據在server1的基礎和我開始對Server2上複製

"Error 'Table 'database.table' doesn't exist' on query. Default database: ''" 

我想這是因爲服務器2只有我要同步

這裏是的my.cnf數據庫這些錯誤配置服務器2

服務器2

server-id    = 1 
log_bin     = /var/log/mysql/mysql-bin.log 
expire_logs_days  = 10 
max_binlog_size   = 200M 
binlog_do_db   = databaseiwanttosync 
binlog-checksum   = none 
binlog_ignore_db  = information_schema,mysql,performance_schema 
auto_increment_increment= 2 
auto_increment_offset = 1 

Server1的

server-id    = 2 
log_bin     = /var/log/mysql/mysql-bin.log 
expire_logs_days  = 10 
max_binlog_size   = 200M 
binlog_do_db   = databaseiwanttosync 
#binlog-checksum    = none 
binlog_ignore_db  = information_schema,mysql,performance_schema,phpmyadmin 
auto_increment_increment= 2 
auto_increment_offset = 2 

回答

1

使用--replicate-do-db=db_name

告訴從SQL線程限制複製到報表,其中默認的數據庫(即,由USE所選擇)是db_name。要指定多個數據庫,請多次使用此選項,每個數據庫使用一次;但是,這樣做不會複製跨數據庫語句,例如更新some_db.some_table SET foo ='bar',而選擇不同的數據庫(或無數據庫)。

來源:http://dev.mysql.com/doc/refman/5.6/en/replication-options-slave.html#option_mysqld_replicate-do-db

相關問題