mysql> show slave status\G
......
Slave_IO_Running: Yes
Slave_SQL_Running: No
......

首先定位同步不成功的原因
查数据库日志

    若是从主机重启,事物回滚,则
mysql> slave stop;
mysql> set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
mysql> slave start;


    其他网络故障,则
go to master :

mysql> show master status;
+------------------+-----------+--------------+------------------+
| File             | Position  | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+-----------+--------------+------------------+
| mysql-bin.000004 | 244274056 | cada_w       |                  |
+------------------+-----------+--------------+------------------+
1 row in set (0.00 sec)


go to slave ,manual replication
mysql>salve stop
mysql> change master to
> master_host='192.168.0.50',
> master_user='askwan',
> master_password='askwan.com',
> master_port=3306,
> master_log_file=localhost-bin.000004',
> master_log_pos=244274056 ;
1 row in set (0.00 sec)
mysql> slave start;
1 row in set (0.00 sec)


then done !

mysql> show slave status\G
......
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
......




another example:
mysql> show slave status\G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 192.168.100.88
                Master_User: slave
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000097
        Read_Master_Log_Pos: 84519125
             Relay_Log_File: HK1-relay-bin.001040
              Relay_Log_Pos: 8880267
      Relay_Master_Log_File: mysql-bin.000097
           Slave_IO_Running: Yes
          Slave_SQL_Running: No
            Replicate_Do_DB: askwan.com
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table:
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: 0
                 Last_Error: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
               Skip_Counter: 0
      Exec_Master_Log_Pos: 67663733
            Relay_Log_Space: 30399576
            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)


first stop slave replication:
mysql> stop slave;
Query OK, 0 rows affected (0.04 sec)


change master host info:
mysql> change master to master_host='192.168.100.88',master_user='slave',master_password='askwan.com',master_port=3306,master_log_file='mysql-bin.000097',master_log_pos=67663733;


last step ,start replication:

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)


check all right or not :
mysql> show slave status\G  

.......
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
.......

作者:askwan@『AskWan』
地址:http://www.askwan.com/Mysql_replication_Error_Slave_SQL_Running_No/
可以转载,转载时请以链接形式注明作者和原始出处及本声明!

DataBase | Comments(0) | Trackbacks(0) | Reads(734)
收藏到网摘:百度搜藏 Google书签 Yahoo收藏 新浪ViVi收藏夹 365天天网摘 天极网摘 我摘·网摘·网络书签 POCO网摘 和讯网摘 Bolaa博拉博客收录中心 天下图摘
Add a comment
Emots
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
Enable HTML
Enable UBB
Enable Emots
Hidden
Remember
Nickname   Password   Optional
Site URI   Email   [Register]