MySQL主从同步报错,server-id一致导致报错(示例代码)
今天新加入一台从库,进行同步master数据,但是my.cnf配置文件直接拷贝,没修改server-id,导致同步状态Preparing
查看主从同步状态
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
| >show slave status\G; Relay_Master_Log_File: mysql-bin.000037 Slave_IO_Running: Preparing Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 354949769 Relay_Log_Space: 30906 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
|
解决方案
遇到该报错信息:
- 查找master和slave主从上的server-id设置是否相同
- 查找slave1和slave2从和从之间的server-id设置是否相同了,也会导致该问题