亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

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

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

mysql數據庫中怎么實現雙向同步熱備

發布時間:2021-08-13 16:54:08 來源:億速云 閱讀:186 作者:Leah 欄目:數據庫

本篇文章為大家展示了mysql數據庫中怎么實現雙向同步熱備,內容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。

環境:

Master server: 10.224.194.239

Slave    server: 10.224.194.237

步驟:

1.分別在Master/Slaver mysql db 創建backup user:

GRANT FILE ON *.* TO backup@10.224.194.239 IDENTIFIED BY 'pass';

GRANT REPLICATION SLAVE ON *.* TO backup@10.224.194.239 IDENTIFIED BY 'pass';

GRANT FILE ON *.* TO backup@10.224.194.237 IDENTIFIED BY 'pass';

GRANT REPLICATION SLAVE ON *.* TO backup@10.224.194.237 IDENTIFIED BY 'pass';

2.在Master server配置/etc/my.cf 文件:

server-id = 1

binlog-do-db=test

binlog-ignore-db = mysql

replicate-do-db=test

replicate-ignore-db = mysql

master-host=10.224.194.237

master-user=backup

master-password=pass

master-port=3306

master-connect-retry=60

slave-skip-errors=all

3.在Master server配置/etc/my.cf 文件:

server-id = 2

binlog-do-db=test

binlog-ignore-db = mysql

replicate-do-db=test

replicate-ignore-db = mysql

master-host=10.224.194.239

master-user=backup

master-password=pass

master-port=3306

master-connect-retry=60

slave-skip-errors=all

4.重啟mysql,驗證命令如下:

查看Master狀態

show master status;

> show master status;

+-----------------+----------+--------------+------------------+

| File            | Position | Binlog_Do_DB | Binlog_Ignore_DB |

+-----------------+----------+--------------+------------------+

| mysqllog.000003 |      301 | test         | mysql            |

+-----------------+----------+--------------+------------------+

1 row in set (0.00 sec)

查看Slave狀態

show slave status \G;

mysql> show slave status \G;

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

               Slave_IO_State: Reconnecting after a failed master event read

                  Master_Host: 10.224.194.239

                  Master_User: backup

                  Master_Port: 3306

                Connect_Retry: 60

              Master_Log_File: mysqllog.000003

          Read_Master_Log_Pos: 301

               Relay_Log_File: mysqlgsb-relay-bin.000082

                Relay_Log_Pos: 348

        Relay_Master_Log_File: mysqllog.000003

             Slave_IO_Running: No

            Slave_SQL_Running: Yes

              Replicate_Do_DB: test

          Replicate_Ignore_DB: mysql

           Replicate_Do_Table:

       Replicate_Ignore_Table:

      Replicate_Wild_Do_Table:

  Replicate_Wild_Ignore_Table:

                   Last_Errno: 0

                   Last_Error:

                 Skip_Counter: 0

          Exec_Master_Log_Pos: 301

              Relay_Log_Space: 650

              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: 0

               Last_SQL_Error:

1 row in set (0.00 sec)

ERROR:

No query specified

查看同步進程:

mysql> show processlist \G;

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

     Id: 1

   User: system user

   Host: 

     db: NULL

Command: Connect

   Time: 4186

  State: Waiting for master to send event

   Info: NULL

*************************** 2. row ***************************

     Id: 2

   User: system user

   Host: 

     db: NULL

Command: Connect

   Time: 3745

  State: Has read all relay log; waiting for the slave I/O thread to update it

   Info: NULL

*************************** 3. row ***************************

     Id: 5

   User: root

   Host: mysqlpri.webex.com:28293

     db: NULL

Command: Query

   Time: 0

  State: NULL

   Info: show processlist

*************************** 4. row ***************************

     Id: 6

   User: backup

   Host: 10.224.194.237:41729

     db: NULL

Command: Binlog Dump

   Time: 135

  State: Has sent all binlog to slave; waiting for binlog to be updated

   Info: NULL

4 rows in set (0.00 sec)

ERROR: 

No query specified

上述內容就是mysql數據庫中怎么實現雙向同步熱備,你們學到知識或技能了嗎?如果還想學到更多技能或者豐富自己的知識儲備,歡迎關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

和硕县| 龙岩市| 西平县| 沙田区| 收藏| 沐川县| 岑溪市| 霸州市| 介休市| 禄丰县| 满洲里市| 紫阳县| 宿州市| 仁布县| 阿尔山市| 乳山市| 阳朔县| 蓬安县| 理塘县| 建水县| 卓尼县| 扶风县| 富源县| 嘉禾县| 徐闻县| 兴山县| 枝江市| 徐汇区| 乐东| 酒泉市| 蕲春县| 绍兴市| 西安市| 沂南县| 马公市| 揭西县| 东光县| 偃师市| 望谟县| 乌拉特前旗| 天柱县|