溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何清除slave同步信息

發(fā)布時間:2021-11-06 10:11:30 來源:億速云 閱讀:209 作者:小新 欄目:MySQL數(shù)據(jù)庫

這篇文章給大家分享的是有關(guān)如何清除slave同步信息的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

  比如,在有些場景,我們需要下線一臺slave,我們使用reset slave來清除show slave status \G里邊的同步信息,當(dāng)我們執(zhí)行完show slave status \G之后,需要可以看到里邊的信息。
  執(zhí)行reset slave,其實(shí)是把master.info和relay-log.info文件給刪除,但是里邊的同步信息還在.

點(diǎn)擊(此處)折疊或打開

  1. mysql> stop slave;

  2. Query OK, 0 rows affected (0.01 sec)


  3. mysql> reset slave;

  4. Query OK, 0 rows affected (0.06 sec)


  5. mysql> show slave status \G

  6. *************************** 1. row ***************************

  7.                Slave_IO_State:

  8.                   Master_Host: 10.10.10.200

  9.                   Master_User: repl

  10.                   Master_Port: 3306

  11.                 Connect_Retry: 60

  12.               Master_Log_File:

  13.           Read_Master_Log_Pos: 4

  14.                Relay_Log_File: mysql-relay-bin.000001

  15.                 Relay_Log_Pos: 4

  16.         Relay_Master_Log_File:

  17.              Slave_IO_Running: No

  18.             Slave_SQL_Running: No

  19.               Replicate_Do_DB:

  20.           Replicate_Ignore_DB:

  21.            Replicate_Do_Table:

  22.        Replicate_Ignore_Table:

  23.       Replicate_Wild_Do_Table:

  24.   Replicate_Wild_Ignore_Table:

  25.                    Last_Errno: 0

  26.                    Last_Error:

  27.                  Skip_Counter: 0

  28.           Exec_Master_Log_Pos: 0

  29.               Relay_Log_Space: 143

  30.               Until_Condition: None

  31.                Until_Log_File:

  32.                 Until_Log_Pos: 0

  33.            Master_SSL_Allowed: No

  34.            Master_SSL_CA_File:

  35.            Master_SSL_CA_Path:

  36.               Master_SSL_Cert:

  37.             Master_SSL_Cipher:

  38.                Master_SSL_Key:

  39.         Seconds_Behind_Master: NULL

  40. Master_SSL_Verify_Server_Cert: No

  41.                 Last_IO_Errno: 0

  42.                 Last_IO_Error:

  43.                Last_SQL_Errno: 0

  44.                Last_SQL_Error:

  45.   Replicate_Ignore_Server_Ids:

  46.              Master_Server_Id: 1

  47.                   Master_UUID: 4adfcd1d-4059-11e7-9532-080027d597f9

  48.              Master_Info_File: mysql.slave_master_info

  49.                     SQL_Delay: 0

  50.           SQL_Remaining_Delay: NULL

  51.       Slave_SQL_Running_State:

  52.            Master_Retry_Count: 86400

  53.                   Master_Bind:

  54.       Last_IO_Error_Timestamp:

  55.      Last_SQL_Error_Timestamp:

  56.                Master_SSL_Crl:

  57.            Master_SSL_Crlpath:

  58.            Retrieved_Gtid_Set:

  59.             Executed_Gtid_Set:

  60.                 Auto_Position: 0

  61. 1 row in set (0.00 sec)

 如果有人誤開始了start slave,同步依然會開始進(jìn)行,我們需要用以下這個方法清除的更徹底。

點(diǎn)擊(此處)折疊或打開

  1. mysql> reset slave all;

  2. Query OK, 0 rows affected (0.00 sec)


  3. mysql> show slave status \G

  4. Empty set (0.00 sec)

感謝各位的閱讀!關(guān)于“如何清除slave同步信息”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI