日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql 5.7 的组复制

發(fā)布時(shí)間:2025/3/19 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql 5.7 的组复制 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

組復(fù)制

簡介

組復(fù)制分單主模式和多主模式,mysql 的復(fù)制技術(shù)僅解決了數(shù)據(jù)同步的問題,如果 master 宕機(jī),意味著數(shù)據(jù)庫管理員需要介入,應(yīng)用系統(tǒng)可能需要修改數(shù)據(jù)庫連接地址或者重啟才能實(shí)現(xiàn)。(這里也可以使用數(shù)據(jù)庫中間件產(chǎn)品來避免應(yīng)用系統(tǒng)數(shù)據(jù)庫連接的問題,例如 mycat 和 atlas 等產(chǎn)品)。組復(fù)制在數(shù)據(jù)庫層面上做到了,只要集群中大多數(shù)主機(jī)可用,則服務(wù)可用,也就是說3臺服務(wù)器的集群,允許其中1臺宕機(jī)。組復(fù)制的流程圖如下

特點(diǎn)

高一致性
基于原生復(fù)制及 paxos 協(xié)議的組復(fù)制技術(shù),并以插件的方式提供,提供一致數(shù)據(jù)安全保證;
高容錯性
只要不是大多數(shù)節(jié)點(diǎn)壞掉就可以繼續(xù)工作,有自動檢測機(jī)制,當(dāng)不同節(jié)點(diǎn)產(chǎn)生資源爭用沖突時(shí),不會出現(xiàn)錯誤,按照先到者優(yōu)先原則進(jìn)行處理,并且內(nèi)置了自動化腦裂防護(hù)機(jī)制;
高擴(kuò)展性
節(jié)點(diǎn)的新增和移除都是自動的,新節(jié)點(diǎn)加入后,會自動從其他節(jié)點(diǎn)上同步狀態(tài),直到新節(jié)點(diǎn)和其他節(jié)點(diǎn)保持一致,如果某節(jié)點(diǎn)被移除了,其他節(jié)點(diǎn)自動更新組信息,自動維護(hù)新的組信息;
高靈活性
有單主模式和多主模式,單主模式下,會自動選主,所有更新操作都在主上進(jìn)行;
多主模式下,所有 server 都可以同時(shí)處理更新操作。

實(shí)驗(yàn)

實(shí)驗(yàn)環(huán)境

server1:172.25.54.1

server2:172.25.54.2

server3:172.25.54.3

由于先前有做過其他數(shù)據(jù)庫實(shí)驗(yàn), 所以需要進(jìn)行清理

  • 配置server1——作為第一個節(jié)點(diǎn)
[root@server1 ~]# cd /var/lib/mysql/ [root@server1 mysql]# rm -fr * [root@server1 mysql]# cd [root@server1 ~]# vim /etc/my.cnf server_id=1 gtid_mode=ON enforce_gtid_consistency=ON master_info_repository=TABLE relay_log_info_repository=TABLE binlog_checksum=NONE log_slave_updates=ON log_bin=binlog binlog_format=ROWtransaction_write_set_extraction=XXHASH64 loose-group_replication_group_name="2cbe319c-9c7c-11e8-92dd-5254009c0397" loose-group_replication_start_on_boot=off loose-group_replication_local_address= "172.25.54.1:24901" //本機(jī)IP loose-group_replication_group_seeds= "172.25.54.1:24901,172.25.54.2:24901,172.25.54.3:24901" loose-group_replication_bootstrap_group=off loose-group_replication_single_primary_mode=off loose-group_replication_enforce_update_everywhere_checks=on loose-group_replication_ip_whitelist="172.25.54.0/24,127.0.0.1/8"

loose-group_replication_group_name的獲取方式如下:
注意:三臺機(jī)子配置文件中的loose-group_replication_group_name是一樣的

[root@server3 ~]# mysql -p5820hhXM\!\@# mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 22 Server version: 5.7.17-log MySQL Community Server (GPL)Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> select uuid(); +--------------------------------------+ | uuid() | +--------------------------------------+ | 2cbe319c-9c7c-11e8-92dd-5254009c0397 | +--------------------------------------+ 1 row in set (0.00 sec)mysql> Bye [root@server1 ~]# > /var/log/mysqld.log [root@server1 ~]# /etc/init.d/mysqld start Initializing MySQL database: [ OK ] Installing validate password plugin: [ OK ] Starting mysqld: [ OK ] [root@server1 ~]# grep password /var/log/mysqld.log 2018-08-10T10:26:52.210939Z 1 [Note] A temporary password is generated for root@localhost: (fUBB,jWD8Lp 2018-08-10T10:27:15.966802Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.Rjm21c.sql' started. 2018-08-10T10:27:16.023917Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.Rjm21c.sql' ended. 2018-08-10T10:27:17.741454Z 0 [Note] Shutting down plugin 'sha256_password' 2018-08-10T10:27:17.741460Z 0 [Note] Shutting down plugin 'mysql_native_password' 2018-08-10T10:27:19.818513Z 3 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO) [root@server1 ~]# mysql -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root@server1 ~]# mysql -p5820hhXM\!\@# mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root@server1 ~]# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.7.17-logCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> ALTER USER root@localhost identified by '5820hhXM!@#'; Query OK, 0 rows affected (0.11 sec)mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec)mysql> SET SQL_LOG_BIN=0; Query OK, 0 rows affected (0.00 sec)mysql> GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%' IDENTIFIED BY '5820hhXM!@#'; Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)mysql> reset master; Query OK, 0 rows affected (0.18 sec)mysql> SET SQL_LOG_BIN=1; Query OK, 0 rows affected (0.00 sec)mysql> CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='5820hhXM!@#' FOR CHANNEL 'group_replication_recovery'; Query OK, 0 rows affected, 2 warnings (0.35 sec)mysql> INSTALL PLUGIN group_replication SONAME 'group_replication.so'; Query OK, 0 rows affected (0.23 sec)mysql> SHOW PLUGINS; +----------------------------+----------+--------------------+----------------------+---------+ | Name | Status | Type | Library | License | +----------------------------+----------+--------------------+----------------------+---------+ | binlog | ACTIVE | STORAGE ENGINE | NULL | GPL | | mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL | | sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL | | PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL | | CSV | ACTIVE | STORAGE ENGINE | NULL | GPL | | MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL | | INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_TEMP_TABLE_INFO | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_FIELDS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_DATAFILES | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_SYS_VIRTUAL | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL | | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL | | ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL | | BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL | | partition | ACTIVE | STORAGE ENGINE | NULL | GPL | | ngram | ACTIVE | FTPARSER | NULL | GPL | | validate_password | ACTIVE | VALIDATE PASSWORD | validate_password.so | GPL | | group_replication | ACTIVE | GROUP REPLICATION | group_replication.so | GPL | +----------------------------+----------+--------------------+----------------------+---------+ 46 rows in set (0.00 sec)mysql> SET GLOBAL group_replication_bootstrap_group=ON; Query OK, 0 rows affected (0.00 sec)mysql> START GROUP_REPLICATION; Query OK, 0 rows affected (1.63 sec)mysql> SET GLOBAL group_replication_bootstrap_group=OFF; Query OK, 0 rows affected (0.00 sec)mysql> SELECT * FROM performance_schema.replication_group_members; +---------------------------+--------------------------------------+-------------+-------------+--------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | +---------------------------+--------------------------------------+-------------+-------------+--------------+ | group_replication_applier | aa28042d-9c7d-11e8-9a37-52540040ca21 | server1 | 3306 | ONLINE | +---------------------------+--------------------------------------+-------------+-------------+--------------+ 1 row in set (0.00 sec)mysql> CREATE DATABASE test; Query OK, 1 row affected (0.07 sec)mysql> USE test; Database changed mysql> CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL); Query OK, 0 rows affected (0.38 sec)mysql> INSERT INTO t1 VALUES (1, 'Luis'); Query OK, 1 row affected (0.10 sec)mysql> SELECT * FROM t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | +----+------+ 1 row in set (0.00 sec)mysql> Bye [root@server1 ~]#
  • 配置server2——第二節(jié)點(diǎn)
[root@server2 ~]# cd /var/lib/mysql [root@server2 mysql]# rm -fr * [root@server2 mysql]# cd [root@server2 ~]# vim /etc/my.cnf server_id=2 gtid_mode=ON enforce_gtid_consistency=ON master_info_repository=TABLE relay_log_info_repository=TABLE binlog_checksum=NONE log_slave_updates=ON log_bin=binlog binlog_format=ROWtransaction_write_set_extraction=XXHASH64 loose-group_replication_group_name="2cbe319c-9c7c-11e8-92dd-5254009c0397" loose-group_replication_start_on_boot=off loose-group_replication_local_address= "172.25.54.2:24901" loose-group_replication_group_seeds= "172.25.54.1:24901,172.25.54.2:24901,172.25.54.3:24901" loose-group_replication_bootstrap_group=off loose-group_replication_single_primary_mode=off loose-group_replication_enforce_update_everywhere_checks=on loose-group_replication_ip_whitelist="172.25.54.0/24,127.0.0.1/8" [root@server2 ~]# > /var/log/mysqld.log [root@server2 ~]# /etc/init.d/mysqld start Initializing MySQL database: [ OK ] Installing validate password plugin: [ OK ] Starting mysqld: [ OK ] [root@server2 ~]# grep password /var/log/mysqld.log 2018-08-10T09:59:46.029171Z 1 [Note] A temporary password is generated for root@localhost: s6j>A-gnKrry 2018-08-10T10:00:17.118035Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.lgZovY.sql' started. 2018-08-10T10:00:17.300585Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.lgZovY.sql' ended. 2018-08-10T10:00:19.341664Z 0 [Note] Shutting down plugin 'sha256_password' 2018-08-10T10:00:19.341669Z 0 [Note] Shutting down plugin 'mysql_native_password' 2018-08-10T10:00:21.885500Z 3 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO) [root@server2 ~]# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.17-logCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> ALTER USER root@localhost identified by '5820hhXM!@#'; Query OK, 0 rows affected (0.13 sec)mysql> SET SQL_LOG_BIN=0; Query OK, 0 rows affected (0.00 sec)mysql> GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%' IDENTIFIED BY '5820hhXM!@#'; Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)mysql> reset master; Query OK, 0 rows affected (0.24 sec)mysql> SET SQL_LOG_BIN=1; Query OK, 0 rows affected (0.00 sec)mysql> CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='5820hhXM!@#' FOR CHANNEL 'group_replication_recovery'; Query OK, 0 rows affected, 2 warnings (0.69 sec)mysql> INSTALL PLUGIN group_replication SONAME 'group_replication.so'; Query OK, 0 rows affected (0.14 sec)mysql> START GROUP_REPLICATION; Query OK, 0 rows affected (5.93 sec)mysql> SELECT * FROM performance_schema.replication_group_members; +---------------------------+--------------------------------------+-------------+-------------+--------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | +---------------------------+--------------------------------------+-------------+-------------+--------------+ | group_replication_applier | 1c479d6f-9c84-11e8-a5a3-5254009c0397 | server2 | 3306 | ONLINE | | group_replication_applier | aa28042d-9c7d-11e8-9a37-52540040ca21 | server1 | 3306 | ONLINE | +---------------------------+--------------------------------------+-------------+-------------+--------------+ 2 rows in set (0.00 sec)mysql> use test; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> show tables; +----------------+ | Tables_in_test | +----------------+ | t1 | +----------------+ 1 row in set (0.00 sec)mysql> select * from t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | +----+------+ 1 row in set (0.00 sec)
  • 配置server3——第三節(jié)點(diǎn)
[root@server3 ~]# cd /var/lib/mysql [root@server3 mysql]# rm -fr * [root@server3 mysql]# cd [root@server3 ~]# vim /etc/my.cnf server_id=3 gtid_mode=ON enforce_gtid_consistency=ON master_info_repository=TABLE relay_log_info_repository=TABLE binlog_checksum=NONE log_slave_updates=ON log_bin=binlog binlog_format=ROWtransaction_write_set_extraction=XXHASH64 loose-group_replication_group_name="2cbe319c-9c7c-11e8-92dd-5254009c0397" loose-group_replication_start_on_boot=off loose-group_replication_local_address= "172.25.54.3:24901" loose-group_replication_group_seeds= "172.25.54.1:24901,172.25.54.2:24901,172.25.54.3:24901" loose-group_replication_bootstrap_group=off loose-group_replication_single_primary_mode=off loose-group_replication_enforce_update_everywhere_checks=on loose-group_replication_ip_whitelist="172.25.54.0/24,127.0.0.1/8" [root@server3 ~]# > /var/log/mysqld.log [root@server3 ~]# /etc/init.d/mysqld start Initializing MySQL database: [ OK ] Installing validate password plugin: [ OK ] Starting mysqld: [ OK ] [root@server3 ~]# grep password /var/log/mysqld.log 2018-08-10T10:26:52.210939Z 1 [Note] A temporary password is generated for root@localhost: (fUBB,jWD8Lp 2018-08-10T10:27:15.966802Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.Rjm21c.sql' started. 2018-08-10T10:27:16.023917Z 0 [Note] Execution of init_file '/var/lib/mysql/install-validate-password-plugin.Rjm21c.sql' ended. 2018-08-10T10:27:17.741454Z 0 [Note] Shutting down plugin 'sha256_password' 2018-08-10T10:27:17.741460Z 0 [Note] Shutting down plugin 'mysql_native_password' 2018-08-10T10:27:19.818513Z 3 [Note] Access denied for user 'UNKNOWN_MYSQL_USER'@'localhost' (using password: NO) [root@server3 ~]# mysql -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root@server3 ~]# mysql -p5820hhXM\!\@# mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root@server3 ~]# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.7.17-logCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> ALTER USER root@localhost identified by '5820hhXM!@#'; Query OK, 0 rows affected (0.13 sec)mysql> SET SQL_LOG_BIN=0; Query OK, 0 rows affected (0.00 sec)mysql> GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%' IDENTIFIED BY '5820hhXM!@#'; Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)mysql> reset master; Query OK, 0 rows affected (0.24 sec)mysql> SET SQL_LOG_BIN=1; Query OK, 0 rows affected (0.00 sec)mysql> CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='5820hhXM!@#' FOR CHANNEL 'group_replication_recovery'; Query OK, 0 rows affected, 2 warnings (0.69 sec)mysql> INSTALL PLUGIN group_replication SONAME 'group_replication.so'; Query OK, 0 rows affected (0.14 sec)mysql> START GROUP_REPLICATION; Query OK, 0 rows affected (5.93 sec)mysql> SELECT * FROM performance_schema.replication_group_members; +---------------------------+--------------------------------------+-------------+-------------+--------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | +---------------------------+--------------------------------------+-------------+-------------+--------------+ | group_replication_applier | e59abed0-9c87-11e8-b17e-52540053a9de | server3 | 3306 | ONLINE | | group_replication_applier | 1c479d6f-9c84-11e8-a5a3-5254009c0397 | server2 | 3306 | ONLINE | | group_replication_applier | aa28042d-9c7d-11e8-9a37-52540040ca21 | server1 | 3306 | ONLINE | +---------------------------+--------------------------------------+-------------+-------------+--------------+ 3 rows in set (0.00 sec)mysql> use test; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -ADatabase changed mysql> select * from t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | +----+------+ 1 row in set (0.00 sec)

測試

  • server3
mysql> INSERT INTO t1 VALUES (2, 'fly'); Query OK, 1 row affected (0.40 sec)mysql> select * from t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | | 2 | fly | +----+------+ 2 rows in set (0.00 sec)mysql>
  • server1
mysql> select * from t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | | 2 | fly | +----+------+ 2 rows in set (0.00 sec)
  • server2
mysql> mysql> select * from t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | | 2 | fly | +----+------+ 2 rows in set (0.00 sec)
  • server1
mysql> INSERT INTO t1 VALUES (3, 'tutu'); Query OK, 1 row affected (0.27 sec)
  • server2
mysql> select * from t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | | 2 | fly | | 3 | tutu | +----+------+ 3 rows in set (0.00 sec)
  • server3
mysql> select * from t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | | 2 | fly | | 3 | tutu | +----+------+ 3 rows in set (0.00 sec)

總結(jié)

以上是生活随笔為你收集整理的mysql 5.7 的组复制的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。