[英]Mysql master-master replicate only one database ignore the others
我有兩個服務器server1和server2 ,它們已經設置了主-主復制
但是在server1上,我有很多數據庫,而在server2上,我只有一個數據庫,我想用server1復制該數據庫。
我已經設置了復制,並且工作正常,但是當有人開始更改server1上的其他數據庫並且在server2復制上開始出現這些錯誤之后,
"Error 'Table 'database.table' doesn't exist' on query. Default database: ''"
我認為這是因為server2只有要同步的數據庫
這是Server2上的my.cnf配置
Server2上
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
服務器1
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
使用--replicate-do-db=db_name
告訴從屬SQL線程將復制限制為默認數據庫(即USE選擇的數據庫)為db_name的語句。 要指定多個數據庫,請多次使用此選項,每個數據庫一次; 但是,這樣做不會在選擇其他數據庫(或沒有數據庫)時復制跨數據庫語句,例如UPDATE 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.