DS-Mysql数据库主主出现Slave_SQL_Running:no和slave_io_running:no问题的解决方法

DS-Mysql数据库主主出现Slave_SQL_Running:no和slave_io_running:no问题的解决方法
阅读目录一、问题描述二、Slave两个关键进程三、如果是Slave_SQL_Runningno四、如果是slave_io_runningno正文一、问题描述当我们配置好MySQL主主同步时是可以实现主主同步但是重启机器后或者其他原因导致MySQL无法同步了。二、Slave两个关键进程mysql replication 中slave机器上有两个关键的进程死一个都不行一个是slave_sql_running一个是Slave_IO_Running一个负责与主机的io通信一个负责自己的slave mysql进程。三、如果是Slave_SQL_Runningno解决办法如下mysqlstop slave;mysqlSET GLOBAL SQL_SLAVE_SKIP_COUNTER1;mysqlstart slave;mysqlshow slave status\G四、如果是slave_io_runningno解决办法如下1、查看主服务器mysqlshow master status\G2、在从服务器上查看问题所在发现Master_Log_File没有对应。3、出现Slave_IO_Running: No的机器上操作mysqlstop slave;mysqlCHANGE MASTER TO MASTER_LOG_FILE‘mysql-bin.000026’, MASTER_LOG_POS0;mysqlstart slave;mysqlshow slave status\G五、如果是slave_io_runningnoLast_IO_Errno: 1593Last_IO_Error: Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).主备机分别执行show variables like ‘server_id’;备机的值要和主机不一致如一致需要修my.cnf中server-id1的参数一般主机是1备机是2修改完重启mysql服务重跑内部的主主同步功能按钮六、如果是slave_io_runningnoLast_IO_Errno:1236Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘Could not find first log file name in binary log index file’如果master端出现slave_io_runningno在slave端执行mysqlshow master status;mysqlflush logs;mysqlshow master status;记住这里的File和Position参数进入master端执行mysqlstop slave;mysqlchange master to master_log_file ‘mysql-bin.000007’,master_log_pos106;mysqlstart slave;mysqlshow slave status\G