在sql_error之后重新启动mysql复制

前端之家收集整理的这篇文章主要介绍了在sql_error之后重新启动mysql复制前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有两个 mysql服务器,一个主服务器和一个服务器.

有人去了奴隶并创建了一个表,然后继续进入主人并创建了同一个表.当然,这个DDL语句被复制到从属服务器,导致错误,导致复制在错误点停止.

在将该表丢弃到从属服务器上或在该语句之后开始复制之后,我是如何重新启动复制过程的?

显示从站状态输出

MysqL> show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: xx.xx.xx.xx
                  Master_User: buildbot
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: MysqL-bin.024536
          Read_Master_Log_Pos: 33489509
               Relay_Log_File: MysqLd-relay-bin.049047
                Relay_Log_Pos: 32575097
        Relay_Master_Log_File: MysqL-bin.024476
             Slave_IO_Running: Yes
            Slave_sql_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 1050
                   Last_Error: Error 'Table 'checklist' already exists' on query. Default database: 'dbname'. Query: 'CREATE TABLE `checklist` (
  `checklist_id` int(11) NOT NULL AUTO_INCREMENT,`description` varchar(768) NOT NULL,`url` varchar(512) NOT NULL,`active` bit(1) NOT NULL,`insert_date` datetime NOT NULL,`xcred` int(11) NOT NULL,PRIMARY KEY (`checklist_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1'
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 32574952
              Relay_Log_Space: 6766519525
              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_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 2013
                Last_IO_Error: error reconnecting to master 'user@xx.xx.xx.xx:3306' - retry-time: 60  retries: 86400
               Last_sql_Errno: 1050
               Last_sql_Error: Error 'Table 'checklist' already exists' on query. Default database: 'dbname'. Query: 'CREATE TABLE `checklist` (
  `checklist_id` int(11) NOT NULL AUTO_INCREMENT,PRIMARY KEY (`checklist_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1'

解决方法

您可以使用以下命令(在MysqL提示符下):
MysqL> STOP SLAVE;
MysqL> SET GLOBAL sql_SLAVE_SKIP_COUNTER = 1;
MysqL> START SLAVE;
MysqL> SHOW SLAVE STATUS;

值1表示要跳过的语句数.您可以重复执行此操作,直到修复复制为止.你可以看到this page.

猜你在找的MsSQL相关文章