免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

MySQL主主同步-創新互聯

MySQL主主同步

成都創新互聯是一家集網站建設,昌邑企業網站建設,昌邑品牌網站建設,網站定制,昌邑網站建設報價,網絡營銷,網絡優化,昌邑網站推廣為一體的創新建站企業,幫助傳統企業提升企業形象加強企業競爭力。可充分滿足這一群體相比中小企業更為豐富、高端、多元的互聯網需求。同時我們時刻保持專業、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們為更多的企業打造出實用型網站。

主主同步原理同主從,不過是雙向而已

MySQL主主同步

1.修改1.4配置文件

vim /etc/my.cnf #同時開始binlog和relay log log-bin=mysql-bin binlog_format=mixed server-id = 1 sync_master_info = 1 sync_binlog = 1  innodb_support_xa = ON relay_log= relay-log relay_log_index=relay-log.index skip_slave_start = ON sync_relay_log = 1 sync_relay_log_info = 1 #定義偏移量 auto_increment_offset=1 auto_increment_increment=2

2.查看1.4日志POS點

MariaDB [(none)]> show master status\G *************************** 1. row ***************************             File: mysql-bin.000002         Position: 662     Binlog_Do_DB:  Binlog_Ignore_DB:  1 row in set (0.00 sec)

3.修改1.5配置文件

vim /etc/my.cnf #同時開始binlog和relay log log-bin=mysql-bin binlog_format=mixed server-id = 3 sync_master_info = 1 sync_binlog = 1 innodb_support_xa = ON relay_log= relay-log relay_log_index=relay-log.index skip_slave_start = ON sync_relay_log = 1 sync_relay_log_info = 1 #定義偏移量 auto_increment_offset = 2

4.查看1.5日志POS點

MariaDB [mysql]> show master status\G *************************** 1. row ***************************             File: mysql-bin.000001         Position: 1073     Binlog_Do_DB:  Binlog_Ignore_DB:  1 row in set (0.00 sec)

5.在1.4上添加復制用戶

MariaDB [(none)]> grant replication slave,replication client on *.* to 'repa'@'192.168.1.5' identified by 'slavepass';      Query OK, 0 rows affected (0.09 sec)

6.在1.5上添加復制用戶

MariaDB [mysql]> grant replication slave,replication client on *.* to 'repb'@'192.168.1.4' identified by 'slavepass';   Query OK, 0 rows affected (0.07 sec)

7.在1.4上開始同步復制

change master to master_host='192.168.1.5',master_user='repb',master_password='slavepass',master_log_file='mysql-bin.000001',master_log_pos=1073;

8.在1.5上開始同步復制

change master to master_host='192.168.1.4',master_user='repa',master_password='slavepass',master_log_file='mysql-bin.000002',master_log_pos=662;

9.查看1.4同步狀態

MariaDB [(none)]> show slave status\G *************************** 1. row ***************************                Slave_IO_State: Waiting for master to send event                   Master_Host: 192.168.1.5                   Master_User: repb                   Master_Port: 3306                 Connect_Retry: 60               Master_Log_File: mysql-bin.000001           Read_Master_Log_Pos: 1073                Relay_Log_File: relay-log.000002                 Relay_Log_Pos: 537         Relay_Master_Log_File: mysql-bin.000001              Slave_IO_Running: Yes             Slave_SQL_Running: Yes               Replicate_Do_DB:            Replicate_Ignore_DB:             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: 1073               Relay_Log_Space: 829               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: 0 Master_SSL_Verify_Server_Cert: No                 Last_IO_Errno: 0                 Last_IO_Error:                 Last_SQL_Errno: 0                Last_SQL_Error:    Replicate_Ignore_Server_Ids:               Master_Server_Id: 3                Master_SSL_Crl:             Master_SSL_Crlpath:                     Using_Gtid: No                   Gtid_IO_Pos:        Replicate_Do_Domain_Ids:    Replicate_Ignore_Domain_Ids:                  Parallel_Mode: conservative 1 row in set (0.00 sec)

10.查看1.5同步狀態

MariaDB [mysql]> show slave status\G *************************** 1. row ***************************                Slave_IO_State: Waiting for master to send event                   Master_Host: 192.168.1.4                   Master_User: repa                   Master_Port: 3306                 Connect_Retry: 60               Master_Log_File: mysql-bin.000002           Read_Master_Log_Pos: 662                Relay_Log_File: relay-log.000002                 Relay_Log_Pos: 537         Relay_Master_Log_File: mysql-bin.000002              Slave_IO_Running: Yes             Slave_SQL_Running: Yes               Replicate_Do_DB:            Replicate_Ignore_DB:             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: 662               Relay_Log_Space: 829               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: 0 Master_SSL_Verify_Server_Cert: No                 Last_IO_Errno: 0                 Last_IO_Error:                 Last_SQL_Errno: 0                Last_SQL_Error:    Replicate_Ignore_Server_Ids:               Master_Server_Id: 1                Master_SSL_Crl:             Master_SSL_Crlpath:                     Using_Gtid: No                   Gtid_IO_Pos:        Replicate_Do_Domain_Ids:    Replicate_Ignore_Domain_Ids:                  Parallel_Mode: conservative 1 row in set (0.00 sec)

11.在1.4上創建數據庫及表

MariaDB [(none)]> create database prince; Query OK, 1 row affected (0.09 sec) MariaDB [(none)]> use prince; Database changed MariaDB [prince]> drop table Threek; Query OK, 0 rows affected (0.13 sec)

創建表:

MariaDB [prince]> create table Threek(id int auto_increment primary key,name varchar(50)); Query OK, 0 rows affected (0.26 sec)

插入數據

MariaDB [prince]> insert into Threek (name) values('wukaka'),('ckl'),('love'); Query OK, 3 rows affected (0.06 sec) Records: 3  Duplicates: 0  Warnings: 0MariaDB [prince]> select * from Threek; +----+--------+ | id | name   | +----+--------+ |  1 | wukaka | |  3 | ckl    | |  5 | love   | +----+--------+ 3 rows in set (0.00 sec)

12.在1.5上插入數據

MariaDB [(none)]> use prince; Database changed

查看表:

MariaDB [prince]> show tables; +------------------+ | Tables_in_prince | +------------------+ | Threek           | +------------------+ 1 row in set (0.00 sec)

查看數據

MariaDB [prince]> select * from Threek; +----+--------+ | id | name   | +----+--------+ |  1 | wukaka | |  3 | ckl    | |  5 | love   | +----+--------+ 3 rows in set (0.00 sec)

插入數據:

MariaDB [prince]> insert into Threek (name) values('stack'),('ayia'),('snow'); Query OK, 3 rows affected (0.06 sec) Records: 3  Duplicates: 0  Warnings: 0 MariaDB [prince]> select * from Threek;                                        +----+--------+ | id | name   | +----+--------+ |  1 | wukaka | |  3 | ckl    | |  5 | love   | |  6 | stack  | |  7 | ayia   | |  8 | snow   | +----+--------+ 6 rows in set (0.00 sec)

13.在1.4上查看數據

MariaDB [prince]> select * from Threek; +----+--------+ | id | name   | +----+--------+ |  1 | wukaka | |  3 | ckl    | |  5 | love   | |  6 | stack  | |  7 | ayia   | |  8 | snow   | +----+--------+ 6 rows in set (0.00 sec)

另外有需要云服務器可以了解下創新互聯cdcxhl.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

文章標題:MySQL主主同步-創新互聯
文章網址:http://m.newbst.com/article18/cepsdp.html

成都網站建設公司_創新互聯,為您提供軟件開發Google靜態網站企業建站電子商務網站制作

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

綿陽服務器托管