MySQL 一台从库的错误日志,大量报下面的错误信息

2018-11-1615:11:1210951[Note]Slave:receivedendpacketfromserver,apparentmastershutdown:2018-11-1615:11:1210951[Note]SlaveI/Othread:Failedreadinglogevent,reconnectingtoretry,log'mysql-bin.000369'atposition2558432502018-11-1615:11:1210951[Warning]StoringMySQLusernameorpasswordinformationinthemasterinforepositoryisnotsecureandisthereforenotrecommended.PleaseconsiderusingtheUSERandPASSWORDconnectionoptionsforSTARTSLAVE;seethe'STARTSLAVESyntax'intheMySQLManualformoreinformation.2018-11-1615:20:0910951[Note]Slave:receivedendpacketfromserver,apparentmastershutdown:2018-11-1615:20:0910951[Note]SlaveI/Othread:Failedreadinglogevent,reconnectingtoretry,log'mysql-bin.000369'atposition2764477732018-11-1615:20:0910951[Warning]StoringMySQLusernameorpasswordinformationinthemasterinforepositoryisnotsecureandisthereforenotrecommended.PleaseconsiderusingtheUSERandPASSWORDconnectionoptionsforSTARTSLAVE;seethe'STARTSLAVESyntax'intheMySQLManualformoreinformation.

这套DB有三台从库,而主库上面通过命令只能看到两台从库

root[(none)]>showslavehosts;+-----------+------+------+-----------+--------------------------------------+|Server_id|Host|Port|Master_id|Slave_UUID|+-----------+------+------+-----------+--------------------------------------+|1373324||3324|174144|5dfa3e4b-df15-11e8-8c37-06cbe47ccefb||174192||3306|174144|b24e27f0-dce5-11e8-bdf4-0cc47a397e1c|+-----------+------+------+-----------+--------------------------------------+2rowsinset(0.00sec)

到缺少的那台从库上面检查server-id,看有没有和其他从库相同

server-id并不相同

mysql>showglobalvariableslike'server%id%';+----------------+--------------------------------------+|Variable_name|Value|+----------------+--------------------------------------+|server_id|2461620||server_id_bits|32||server_uuid|b24e27f0-dce5-11e8-bdf4-0cc47a397e1c|+----------------+--------------------------------------+3rowsinset(0.00sec)

排除了server-id,还有可能是DB的uuid相同而导致从数据库注册不到主库。

删除数据库目录下面的server-id文件

#cd/disk1/mysql3320#catauto.cnf[auto]server-uuid=11478f92-e973-11e8-8fcf-0cc47a663554#rmauto.cnf

之后重启问题从库,报错消失。