I see a lot of people filtering replication with binlog-do-db, binlog-ignore-db, replicate-do-db, and replicate-ignore-db. Although there are uses for these, they are dangerous and in my opinion, they are overused. For many cases, there's a safer alternative.
The danger is simple: they don't work the way you think they do. Consider the following scenario: you set binlog-ignore-db to "garbage" so data in the garbage database (which doesn't exist on the slave) isn't replicated. (I'll come back to this in a second, so if you already see the problem, don't rush to the comment form.)
Now you do the following:
You just broke replication, twice. Once, because your slave is going to execute the first query and there's no such table "garbage.junk" on the slave. The second time, silently, because the update to production.users isn't replicated, so now the root user isn't disabled on the slave.
Why? Because binlog-ignore-db doesn't do what you think. The phrase I used earlier, "data in the garbage database isn't replicated," is a fallacy. That's not what it does. In fact, it filters out binary logging for statements issued from connections whose default database is "garbage." In other words, filtering is not based on the contents of the query -- it is based on what database you USE.
The other configuration options I mentioned work similarly. The binlog-do-db and binlog-ignore-db statements are particularly dangerous because they keep statements from ever being written to the binary log, which means you can't use the binary log for point-in-time recovery of your data from a backup.
In a carefully controlled environment, these options can have benefits, but I won't talk about that here. (We covered that in our book.)
The safer alternative is to configure filters on the slave, with options that actually operate on the tables mentioned in the query itself. These are replicate-wild-* options. For example, the safer way to avoid replicating data in the garbage database is to configure replicate-wild-ignore-table=garbage.%. There are still edge cases where that won't work, but it works in more cases and has fewer gotchas.
If you are confused, you should read the replication rules section of the manual until you know it by heart
Entry posted by Baron Schwartz | No comment
工作职责:
1.根据赞助商需求和豆瓣风格,设计、制作网络广告
2.视觉相关产品及图像处理,美化提升视觉形象
3.负责企业各类市场宣传品的设计、制作
职位要求:
1.是豆瓣的深度用户
2.对设计、创意、创造有超出一般的表现力,美术功底深厚
3.广告公司、视觉公司1年以上工作经验
4.熟练运用常用设计软件,并具有在此基础上快速掌握和使用新软件的能力(请在简历中附带近期作品)
5.能吃苦耐劳,有较强的自我管理能力
工作地点位于北京。有兴趣或者问题请email至 team(a)douban.com。请注明“视觉”。
五月 2009 | ||||||
一 | 二 | 三 | 四 | 五 | 六 | 日 |
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |