MySQL SLAVE故障一例

甲骨文技術支援發表於2017-03-06
有一個slave的埠是3306,我想再建立一個slave,埠為3307

透過冷備份的方式,把3306停機cp,也修改了my.cnf裡的server_id等引數,但是啟動的時候報錯,如下:
  1. 2017-03-06T16:14:31.913747+08:00 0 [ERROR] Failed to open the relay log './relay.000117' (relay_log_pos 579901661).
  2. 2017-03-06T16:14:31.913775+08:00 0 [ERROR] Could not find target log file mentioned in relay log info in the index file './omstest-relay-bin.index' during relay log initialization.
  3. 2017-03-06T16:14:31.927813+08:00 0 [ERROR] Failed to initialize the master info structure
  4. 2017-03-06T16:14:31.927836+08:00 0 [ERROR] Failed to create or recover replication info repositories.
因為檔案的路徑改變了,所以報錯,解決起來很簡單,直接reset slave即可。
  1. mysql> reset slave;
  2. Query OK, 0 rows affected (0.01 sec)
然後用change master指向到master
  1. change master to
  2. master_host='10.30.xxx',
  3. master_port=3306,
  4. master_user='repl',
  5. master_password='REPLsafe!@#$24',
  6. master_log_file='mysql-bin.000012',
  7. master_log_pos=154;
啟動slave

  1. mysql> reset slave;
  2. Query OK, 0 rows affected (0.01 sec)
檢查

  1. mysql> show slave status \G;
  2. *************************** 1. row ***************************
  3.                Slave_IO_State: Waiting for master to send event
  4.                   Master_Host: 10.30.50.24
  5.                   Master_User: repl
  6.                   Master_Port: 3306
  7.                 Connect_Retry: 60
  8.               Master_Log_File: mysql-bin.000012
  9.           Read_Master_Log_Pos: 577
  10.                Relay_Log_File: omstest-relay-bin.000002
  11.                 Relay_Log_Pos: 743
  12.         Relay_Master_Log_File: mysql-bin.000012
  13.              Slave_IO_Running: Yes
  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: 577
  25.               Relay_Log_Space: 952
  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: 0
  36. Master_SSL_Verify_Server_Cert: No
  37.                 Last_IO_Errno: 0
  38.                 Last_IO_Error:
  39.                Last_SQL_Errno: 0
  40.                Last_SQL_Error:
  41.   Replicate_Ignore_Server_Ids:
  42.              Master_Server_Id: 23306
  43.                   Master_UUID: c34dd0f3-fffa-11e6-a95d-00163e033ba0
  44.              Master_Info_File: /alidata1/mysqldata/3307/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 more updates
  48.            Master_Retry_Count: 86400
  49.                   Master_Bind:
  50.       Last_IO_Error_Timestamp:
  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.          Replicate_Rewrite_DB:
  58.                  Channel_Name:
  59.            Master_TLS_Version:
  60. 1 row in set (0.00 sec)





來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20893244/viewspace-2134798/,如需轉載,請註明出處,否則將追究法律責任。

相關文章