MySQL复制Master-Slave

时间:2012-10-26 08:44:17

标签: mysql database replication database-replication master-slave

我即将为我的typo3数据库进行MySQL复制。有两个服务器。你猜对了一个是主人,一个是奴隶。

掌握my.cnf:
[mysql]
server-id = 1
log-bin
expire_logs_days = 21
max_binlog_size = 500M
binlog-ignore-db=mysql

Slave my.cnf:
[mysql]
server-id = 2
binlog-ignore-db = mysql
replicate-ignore-db = mysql
auto-increment-offset = 1
expire_logs_days = 21
max_binlog_size = 500M

Master上的用户:repl@slaveip REPLICATION SLAVE, REPLICATION CLIENT
Slave上的用户:repl@masterip REPLICATION SLAVE, REPLICATION CLIENT

到目前为止一切正常,即使我在Master上更改了某些内容但是如果我在Master上删除了相同的内容,Slave将停止并显示以下错误消息:

Last_SQL_Error: Error 'Duplicate entry '65021' for key 'PRIMARY'' on query. Default database: 'typo3'. Query: 'INSERT INTO sys_log (userid,type,action,error,details_nr,details,IP,tstamp,workspace) VALUES ('0','5','0','2','0','Core: Exception handler (WEB): Uncaught TYPO3 Exception: Reason: Segment &quot;404&quot; was not a keyword for a postVarSet as expected on page with id=0.<br />\n<br />\nAdditionally, http://www.21cdocs.de/404/ was not found while trying to retrieve the error document. | RuntimeException thrown in file /mnt/platte02/www/typo3/typo3_src-4.5.19/typo3/sysext/cms/tslib/class.tslib_fe.php in line 1542','masterip','1351240603','0')'

这是show slave status\G向我展示的内容。

我是如何通过Masters数据强制Slave覆盖所有的解决方案?

- 蒂莫

1 个答案:

答案 0 :(得分:0)

使用slave-skip-errors = 1062会跳过错误,但在我看来这不是一个好的解决方案

更新:显然Typo3在sys_log表上出现了一些错误。