今天新加入一台从库,进行同步master数据,但是my.cnf配置文件直接拷贝,没修改server-id,导致报错:
创新互联-专业网站定制、快速模板网站建设、高性价比船山网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式船山网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖船山地区。费用合理售后完善,十多年实体公司更值得信赖。2017-04-01 14:57:16 140661325472512 [Note] Slave: received end packet from server, apparent master shutdown: 2017-04-01 14:57:16 140661325472512 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000037' at position 355680160 2017-04-01 14:57:16 140661325472512 [Note] Slave: received end packet from server, apparent master shutdown: 2017-04-01 14:57:16 140661325472512 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000037' at position 355687180 2017-04-01 14:57:17 140661325472512 [Note] Slave: received end packet from server, apparent master shutdown: 2017-04-01 14:57:17 140661325472512 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000037' at position 355701274 2017-04-01 14:57:18 140661325472512 [Note] Slave: received end packet from server, apparent master shutdown: 2017-04-01 14:57:18 140661325472512 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000037' at position 355723904 2017-04-01 14:57:18 140661325472512 [Note] Slave: received end packet from server, apparent master shutdown: 2017-04-01 14:57:18 140661325472512 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000037' at position 355734536 2017-04-01 14:57:19 140661325472512 [Note] Slave: received end packet from server, apparent master shutdown: 2017-04-01 14:57:19 140661325472512 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000037' at position 355736849 2017-04-01 14:57:19 140661325472512 [Note] Slave: received end packet from server, apparent master shutdown: 2017-04-01 14:57:19 140661325472512 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000037' at position 355740978 2017-04-01 14:57:20 140661325472512 [Note] Slave: received end packet from server, apparent master shutdown: 2017-04-01 14:57:20 140661325472512 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000037' at position 355740978查看主从同步状态
>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设置是否相同了,也会导致该问题
每台master和slave主从库的server-id都必须唯一,识别主从的库的唯一标识
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。