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

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

mysql數(shù)據(jù)庫 slave復(fù)制異常問題解決辦法

2024-07-24 12:39:28
字體:
供稿:網(wǎng)友

slave是主從復(fù)制了,但小編在測試mysql slave主從復(fù)制出現(xiàn)了問題了,在此武林網(wǎng)小編來為各位介紹mysql數(shù)據(jù)庫 slave復(fù)制異常問題解決辦法,希望文章對(duì)各位有用.

以下是兩種slave復(fù)制異常的情況。導(dǎo)致的原因都是由于跨機(jī)房同步,slave的機(jī)房突然掉電導(dǎo)致的。

案例一:這個(gè)錯(cuò)誤大原因是Read_Master_Log_Pos: 1028687822的pos號(hào)在主庫上是沒有的.

處理方法:獲取這個(gè)pos號(hào)的前一個(gè)pos號(hào),從新開啟同步,這里注意如果是row模式的話就沒有問題.如果是mix的或者statement的話,就需要去分析binlog,確認(rèn)具體執(zhí)行到哪個(gè)pos號(hào)了,不然可能會(huì)導(dǎo)致數(shù)據(jù)不一致.

  1. (andy:db:)[(none)] 11:18:39> show slave status/G 
  2.    *************************** 1. row *************************** 
  3.                   Slave_IO_State: 
  4.                      Master_Host: 192.168.11.24 
  5.                      Master_User: slave 
  6.                      Master_Port: 3306 
  7.                    Connect_Retry: 10 
  8.                  Master_Log_File: mysql-bin.000342 
  9.              Read_Master_Log_Pos: 1028687822 
  10.                   Relay_Log_File: localhost-relay-bin.000767 
  11.                    Relay_Log_Pos: 4 
  12.            Relay_Master_Log_File: mysql-bin.000342 
  13.                 Slave_IO_Running: No 
  14.                Slave_SQL_Running: Yes 
  15.                  Replicate_Do_DB: 
  16.              Replicate_Ignore_DB: 
  17.               Replicate_Do_Table: 
  18.           Replicate_Ignore_Table: 
  19.          Replicate_Wild_Do_Table: 
  20.      Replicate_Wild_Ignore_Table: 
  21.                       Last_Errno: 0 
  22.                       Last_Error: 
  23.                     Skip_Counter: 0 
  24.              Exec_Master_Log_Pos: 1028687822 
  25.                  Relay_Log_Space: 120 
  26.                  Until_Condition: None 
  27.                   Until_Log_File: 
  28.                    Until_Log_Pos: 0 
  29.               Master_SSL_Allowed: No 
  30.               Master_SSL_CA_File: 
  31.               Master_SSL_CA_Path: 
  32.                  Master_SSL_Cert: 
  33.                Master_SSL_Cipher: 
  34.                   Master_SSL_Key: 
  35.            Seconds_Behind_Master: NULL 
  36.    Master_SSL_Verify_Server_Cert: No 
  37.                    Last_IO_Errno: 1236 
  38.                    Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘Client requested master to start replication from position > file size; the first event ‘mysql-bin.000342′ at 1028687822, the last event read from ‘./mysql-bin.000342′ at 4, the last byte read from ‘./mysql-bin.000342′ at 4.’ 
  39.                   Last_SQL_Errno: 0 
  40.                   Last_SQL_Error: 
  41.      Replicate_Ignore_Server_Ids: 
  42.                 Master_Server_Id: 1024 
  43.                      Master_UUID: e9143523-c116-11e2-a8a1-0022195d25da  --Vevb.com 
  44.                 Master_Info_File: /usr/local/mysql-6/data/master.info 
  45.                        SQL_Delay: 0 
  46.              SQL_Remaining_Delay: NULL 
  47.          Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it 
  48.               Master_Retry_Count: 86400 
  49.                      Master_Bind: 
  50.          Last_IO_Error_Timestamp: 140725 06:55:26 
  51.         Last_SQL_Error_Timestamp: 
  52.                   Master_SSL_Crl: 
  53.               Master_SSL_Crlpath: 
  54.               Retrieved_Gtid_Set: 
  55.                Executed_Gtid_Set: 
  56.                    Auto_Position: 0 
  57.    1 row in set (0.00 sec) 

案例二:這個(gè)是由于slave的relay-log損壞了.可以考慮使用Exec_Master_Log_Pos: 439512771pos號(hào),從新開啟同步.或者使用relay_log_recovery=ON參數(shù)啟動(dòng).

  1. (root:bi:)[(none)] 10:56:01> show slave status/G 
  2. *************************** 1. row *************************** 
  3.                Slave_IO_State: Waiting for master to send event 
  4.                   Master_Host: 172.20.100.16 
  5.                   Master_User: slave 
  6.                   Master_Port: 3306 
  7.                 Connect_Retry: 10 
  8.               Master_Log_File: mysql-bin.000076 
  9.           Read_Master_Log_Pos: 474667384 
  10.                Relay_Log_File: localhost-relay-bin.000137 
  11.                 Relay_Log_Pos: 212337426 
  12.         Relay_Master_Log_File: mysql-bin.000076 
  13.              Slave_IO_Running: Yes 
  14.             Slave_SQL_Running: No 
  15.               Replicate_Do_DB: 
  16.           Replicate_Ignore_DB: 
  17.            Replicate_Do_Table: 
  18.        Replicate_Ignore_Table: 
  19.       Replicate_Wild_Do_Table: 
  20.   Replicate_Wild_Ignore_Table: 
  21.                    Last_Errno: 1594 
  22.                    Last_Error: Relay log read failure: 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. 
  23.                  Skip_Counter: 0 
  24.           Exec_Master_Log_Pos: 439512771 
  25.               Relay_Log_Space: 474669681 
  26.               Until_Condition: None 
  27.                Until_Log_File: 
  28.                 Until_Log_Pos: 0 
  29.            Master_SSL_Allowed: No 
  30.            Master_SSL_CA_File: 
  31.            Master_SSL_CA_Path: 
  32.               Master_SSL_Cert: 
  33.             Master_SSL_Cipher: 
  34.                Master_SSL_Key: 
  35.         Seconds_Behind_Master: NULL 
  36. Master_SSL_Verify_Server_Cert: No 
  37.                 Last_IO_Errno: 0 
  38.                 Last_IO_Error: 
  39.                Last_SQL_Errno: 1594 
  40.                Last_SQL_Error: Relay log read failure: 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. 
  41.   Replicate_Ignore_Server_Ids: 
  42.              Master_Server_Id: 1016 
  43.                   Master_UUID: 7b6b6934-b981-11e3-bc82-c81f66de76ac 
  44.              Master_Info_File: /data/mysql/data/master.info 
  45.                     SQL_Delay: 0 
  46.           SQL_Remaining_Delay: NULL 
  47.       Slave_SQL_Running_State: 
  48.            Master_Retry_Count: 86400 
  49.                   Master_Bind: 
  50.       Last_IO_Error_Timestamp: 
  51.      Last_SQL_Error_Timestamp: 140725 10:54:50 
  52.                Master_SSL_Crl: 
  53.            Master_SSL_Crlpath: 
  54.            Retrieved_Gtid_Set: 
  55.             Executed_Gtid_Set: 
  56.                 Auto_Position: 0 
  57. 1 row in set (0.00 sec) 
  58. [root@localhost data]# mysqlbinlog localhost-relay-bin.000137 > a.txt 
  59. ERROR: Error in Log_event::read_log_event(): ‘read error’, data_len: 7736, event_type: 31 
  60. ERROR: Could not read entry at offset 215681738: Error in log format or read error. 
  61. WARNING: The range of printed events ends with a row event or a table map event that does not have the STMT_END_F flag set. This might be because the last statement was not fully written to the log, or because you are using a -stop-position or -stop-datetime that refers to an event in the middle of a statement. The event(s) from the partial statement have not been written to output

總結(jié):這兩個(gè)錯(cuò)誤的導(dǎo)致的原因是機(jī)房掉電,也就是沒有crash safe.

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 鲁甸县| 建德市| 图们市| 商都县| 铜川市| 南昌市| 嫩江县| 舒兰市| 肇州县| 青海省| 龙州县| 安图县| 镇平县| 东城区| 海兴县| 喀什市| 岑巩县| 郎溪县| 石林| 宁夏| 财经| 景德镇市| 福建省| 高要市| 台南市| 文山县| 鲁甸县| 共和县| 和硕县| 双柏县| 铁岭市| 三亚市| 万年县| 阜阳市| 利津县| 汉沽区| 宿松县| 青州市| 余姚市| 田东县| 沙河市|