MySQL replication: if I don't specify any databases, will log_bin log EVERYTHING?

微笑、不失礼 提交于 2019-12-03 15:22:30

问题


I'm setting up replication for a server which runs a bunch of databases (one per client) and plan on adding more all the time, on my.cnf, Instead of having:

binlog-do-db  = databasename 1
binlog-do-db  = databasename 2
binlog-do-db  = databasename 3
...
binlog-do-db  = databasename n

can I rather just have

binlog-ignore-db  = mysql
binlog-ignore-db  = informationschema

(and no database to log specified) and assume that everything else is logged?

EDIT: actually if I remove all my binlog-do-db entries, it seemingly logs everything (as you see the binary log file change position when you move the database), but on the slave server, nothing gets picked up! (perhaps, this is the case to use replicate-do-db? this would kill the idea; i guess I cant have MySQL automagically detect which databases to replicate).


回答1:


That looks correct: http://dev.mysql.com/doc/refman/5.0/en/binary-log.html#option_mysqld_binlog-ignore-db.

According to that reference:

There are some --binlog-ignore-db rules. Does the default database match any of the --binlog-ignore-db rules?

  • Yes: Do not write the statement, and exit.
  • No: Write the query and exit.

Since you only have ignore commands, all queries will be written to the log as long as the default (active) database doesn't match one of the ignored databases.



来源:https://stackoverflow.com/questions/8166/mysql-replication-if-i-dont-specify-any-databases-will-log-bin-log-everything

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!