国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 課堂 > 基礎(chǔ)知識 > 正文

slave的中繼日志relay-log損壞

2024-09-12 20:30:05
字體:
供稿:網(wǎng)友
    當(dāng)slave意外宕機(jī)時,有可能會損壞中繼日志relay-log,再次開啟同步復(fù)制時,會出現(xiàn)報錯。
    解決方法:找到同步的binlog日志和POS點(diǎn),然后重新進(jìn)行同步,這樣就可以有新的中繼日志了。
    下邊看個案例,模擬了中繼日志損壞的情況,查看到的信息如下:
  點(diǎn)擊(此處)折疊或打開
 
  mysql> show slave status /G
  ERROR 2006 (HY000): MySQL server has gone away
  No connection. Trying to reconnect...
  Connection id: 4
  Current database: test
 
  *************************** 1. row ***************************
                 Slave_IO_State: Waiting for master to send event
                    Master_Host: 10.10.10.200
                    Master_User: repl
                    Master_Port: 3306
                  Connect_Retry: 60
                Master_Log_File: mysql-bin.000005
            Read_Master_Log_Pos: 220
                 Relay_Log_File: mysql-relay-bin.000010
                  Relay_Log_Pos: 283
          Relay_Master_Log_File: mysql-bin.000004
               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: 1032
                     Last_Error: Could not execute Update_rows event on table test.test01; Can't find record in 'test01', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log mysql-bin.000004, end_log_pos 310
                   Skip_Counter: 0
            Exec_Master_Log_Pos: 120
                Relay_Log_Space: 2251
                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: 0
                  Last_IO_Error:
                 Last_SQL_Errno: 1032
                 Last_SQL_Error: Could not execute Update_rows event on table test.test01; Can't find record in 'test01', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log mysql-bin.000004, end_log_pos 310
    Replicate_Ignore_Server_Ids:
               Master_Server_Id: 1
                    Master_UUID: 4adfcd1d-4059-11e7-9532-080027d597f9
               Master_Info_File: mysql.slave_master_info
                      SQL_Delay: 0
            SQL_Remaining_Delay: NULL
        Slave_SQL_Running_State:
             Master_Retry_Count: 86400
                    Master_Bind:
        Last_IO_Error_Timestamp:
       Last_SQL_Error_Timestamp: 170808 11:45:26
                 Master_SSL_Crl:
             Master_SSL_Crlpath:
             Retrieved_Gtid_Set:
              Executed_Gtid_Set:
                  Auto_Position: 0
    其中,涉及幾個重要的參數(shù):
  slave_IO_Running:接受master的binlog的信息
  master_Log_file:正在讀取master上binlog日志名
  Read_master_Log_Pos:正在讀取master上當(dāng)前binlog日志POS點(diǎn)。
  slave_SQL_Running:執(zhí)行寫操作
  Relay_master_Log_File:正在同步master上的binlog日志名。
  Exec_master_Log_Pos:正在同步當(dāng)前binlog日志的POS點(diǎn)。
   以Relay_master_Log_File參數(shù)值和Exec_master_Log_Pos參數(shù)值為基準(zhǔn)。
  Relay_Log_File: mysql-relay-bin.000010
  Relay_Log_Pos: 283
    接下來開始重置主從復(fù)制:
  點(diǎn)擊(此處)折疊或打開
 
  mysql> stop slave;
  Query OK, 0 rows affected (0.04 sec)
 
  mysql> change master to master_log_file='mysql-relay-bin.000010',master_log_pos=283;
  Query OK, 0 rows affected (0.06 sec)
 
  mysql> start slave;
  Query OK, 0 rows affected (0.12 sec)
    通過這種方法可以修復(fù)中繼日志,但是在MySQL5.5版本之后,在slave的my.cnf配置文件中加入relay_log_recovery=1就可以了。

(編輯:武林網(wǎng))

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 星座| 全椒县| 丰原市| 通化县| 古交市| 丰都县| 龙川县| 开封县| 莆田市| 左权县| 陇川县| 阿城市| 来安县| 井陉县| 仁怀市| 谢通门县| 军事| 商城县| 永春县| 新闻| 牟定县| 廊坊市| 宁乡县| 鄂伦春自治旗| 陆丰市| 绥阳县| 江孜县| 湘西| 隆尧县| 定州市| 建始县| 东莞市| 建水县| 盐津县| 荆州市| 深泽县| 甘南县| 高密市| 黄冈市| 绍兴市| 肇源县|