简体   繁体   English

MySQL复制:如果我没有指定任何数据库,log_bin会记录一切吗?

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

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: 我正在为运行一堆数据库(每个客户端一个)的服务器设置复制,并计划在my.cnf上一直添加更多数据库,而不是:

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! 编辑:实际上,如果我删除所有binlog-do-db条目,它似乎记录了所有内容(正如您在移动数据库时看到的二进制日志文件更改位置),但在从属服务器上,没有任何东西被拾取! (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). (也许,这是使用replicate-do-db的情况?这会破坏这个想法;我想我不能让MySQL自动检测要复制的数据库)。

That looks correct: http://dev.mysql.com/doc/refman/5.0/en/binary-log.html#option_mysqld_binlog-ignore-db . 这看起来是正确的: 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. 有一些--binlog-ignore-db规则。 Does the default database match any of the --binlog-ignore-db rules? 默认数据库是否与--binlog-ignore-db规则匹配?

  • 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. 由于您只有ignore命令,因此只要默认(活动)数据库与其中一个被忽略的数据库不匹配,所有查询都将写入日志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM