- 论坛徽章:
- 0
|
数据库A 为Master 版本:4.1.22 ip:192.168.0.2
数据库B 为Slave 版本:5.0.51a ip:192.168.0.1
操作系统 RHEL4
Master 配置:
#master
log-bin = /usr/local/mysql/var/bin-log
server-id = 1
binlog-do-db = aaa
binlog-do-db = bbb
binlog-ignore-db = mysql
binlog-ignore-db = test
Slave 配置:
#slave
log-bin = /usr/local/mysql1/mysql-bin
server-id = 2
master-host = 192.168.0.2
master-port = 3306
master-user = test
master-password = test
master-connect-retry = 60
relay-log = /usr/local/mysql1/mysql-relay-bin
#sql_slave_skip_counter = 1
#logs-slave-updates
read-only
skip-slave-start
replicate-do-db = aaa
replicate-do-db = bbb
replicate-ignore-db = mysql
#replicate-ignore-db = test
Master 上相应用户权限已设置。
启动slave(start slave)后过一段时间报错,信息如下:
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.2
Master_User: test
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: bin-log.000397
Read_Master_Log_Pos: 13467484
Relay_Log_File: mysql-relay-bin.000002
Relay_Log_Pos: 271281
Relay_Master_Log_File: bin-log.000363
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB: aaa,bbb,aaa,bbb,aaa,bbb
Replicate_Ignore_DB: mysql,mysql,mysql,mysql,mysql
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1062
Last_Error: Error 'Duplicate entry '4454319' for key 1' on query. Default database: 'aaa'. Query: 'INSERT INTO dz_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) VALUES ('System Message', '0', '379209', 'inbox', '1', 'Welcome to !', '1210446620',')。
Skip_Counter: 0
Exec_Master_Log_Pos: 16756663
Relay_Log_Space: 756638029
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
1 row in set (0.00 sec)
[root@localhost mysql1]# cat localhost.localdomain.err
080511 03:13:04 mysqld started
080511 3:13:04 [Warning] The syntax for replication startup options is deprecated and will be removed in MySQL 5.2. Please use 'CHANGE MASTER' instead.
080511 3:13:04 [Warning] 'user' entry 'root@localhost.localdomain' ignored in --skip-name-resolve mode.
080511 3:13:04 [Warning] 'user' entry '@localhost.localdomain' ignored in --skip-name-resolve mode.
080511 3:13:04 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.0.51a-community-log' socket: '/usr/local/mysql1/mysql1.sock' port: 3306 MySQL Community Edition (GPL)
080511 3:19:31 [Note] Slave SQL thread initialized, starting replication in log 'bin-log.000363' at position 16487322, relay log '/usr/local/mysql1/mysql-relay-bin.000001' position: 4
080511 3:19:31 [Note] Slave I/O thread: connected to master 'repli@192.168.0.2:3306', replication started in log 'bin-log.000363' at position 16487322
080511 3:19:32 [ERROR] Slave: Error 'Duplicate entry '4454319' for key 1' on query. Default database: 'aaa'. Query: 'INSERT INTO dz_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) VALUES ('System Message', '0', '379209', 'inbox', '1', 'Welcome to !', '1210446620','
080511 3:19:32 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'bin-log.000363' position 16756663
Master 上相关信息:
mysql> show processlist;
+---------+-------+-----------------------+------+-------------+--------+----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+-------+-----------------------+------+-------------+--------+----------------------------------------------------------------+------------------------------------------------------------------------------------------------------+
| 106617 | test | 192.168.0.1:32783 | NULL | Binlog Dump | 115063 | Has sent all binlog to slave; waiting for binlog to be updated | NULL |
|