f
n = 2 x f + 1
mysql-8.0
mkdir data
mysql-8.0/bin/mysqld --initialize-insecure --basedir=$PWD/mysql-8.0 --datadir=$PWD/data/s1
mysql-8.0/bin/mysqld --initialize-insecure --basedir=$PWD/mysql-8.0 --datadir=$PWD/data/s2
mysql-8.0/bin/mysqld --initialize-insecure --basedir=$PWD/mysql-8.0 --datadir=$PWD/data/s3
data/s1
data/s3
--initialize-insecure
[mysqld] # server configuration datadir=<full_path_to_data>/data/s1 basedir=<full_path_to_bin>/mysql-8.0/ port=24801 socket=<full_path_to_sock_dir>/s1.sock
report_host=127.0.0.1
server_id=1 gtid_mode=ON enforce_gtid_consistency=ON binlog_checksum=NONE
log_bin=binlog log_slave_updates=ON binlog_format=ROW master_info_repository=TABLE relay_log_info_repository=TABLE
my.cnf
transaction_write_set_extraction=XXHASH64loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"loose-group_replication_start_on_boot=offloose-group_replication_local_address= "127.0.0.1:24901"loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"loose-group_replication_bootstrap_group=off
loose-
transaction_write_set_extraction
group_replication_group_name
group_replication_group_name
group_replication_start_on_boot
group_replication_start_on_boot
group_replication_local_address
group_replication_local_address
group_replication_local_address
group_replication_group_seeds
group_replication_group_seeds
group_replication_local_address
hostname:port
group_replication_group_seeds
group_replication_local_address
performance_schema.replication_group_members
group_replication_bootstrap_group
server_id
datadir
group_replication_local_address
group_replication_recovery
mysql-8.0/bin/mysqld --defaults-file=data/s1/s1.cnf
REPLICATION-SLAVE
MySQL的> SET SQL_LOG_BIN=0;
rpl_user
password
MySQL的> CREATE USER
rpl_user
@'%' IDENTIFIED BY 'password
';MySQL的> GRANT REPLICATION SLAVE ON *.* TO
rpl_user
@'%';MySQL的> FLUSH PRIVILEGES;
mysql> SET SQL_LOG_BIN=1;
CHANGE MASTER TO
rpl_user
password
MySQL的> CHANGE MASTER TO MASTER_USER='
rpl_user
', MASTER_PASSWORD='password
' \\ FOR CHANNEL 'group_replication_recovery';
group_replication_recovery
hostname
hostname
performance_schema.replication_group_members
report_host
rpl_user
group_replication_recovery
rpl_user
rpl_user
group_replication_recovery_public_key_path
group_replication_recovery_get_public_key=ON
group_replication_recovery_get_public_key=ON
INSTALL PLUGIN group_replication SONAME 'group_replication.so';
mysql.session
SHOW PLUGINS;
MySQL的> SHOW PLUGINS;
---------------------------- ---------- -------------------- ---------------------- ------------- |名字|状态|型|图书馆|许可| ---------------------------- ---------- -------------------- ---------------------- ------------- | binlog |主动|存储引擎|空|专有|(…)| group_replication |主动|组复制| group_replication.so |专有| ---------------------------- ---------- -------------------- ---------------------- -------------
ON
SET GLOBAL group_replication_bootstrap_group=ON;START GROUP_REPLICATION;SET GLOBAL group_replication_bootstrap_group=OFF;
START GROUP_REPLICATION
MySQL的> SELECT * FROM performance_schema.replication_group_members;
--------------------------- -------------------------------------- ------------- ------------- --------------- | channel_name | member_id | member_host | member_port | member_state | --------------------------- -------------------------------------- ------------- ------------- --------------- | group_replication_applier | ce9be252-2b71-11e6-b8f4-00212844f856 | Myhost | 24801 |在线| --------------------------- -------------------------------------- ------------- ------------- ---------------
ce9be252-2b71-11e6-b8f4-00212844f856
myhost
mysql>CREATE DATABASE test;
mysql>USE test;
mysql>CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL);
mysql>INSERT INTO t1 VALUES (1, 'Luis');
t1
MySQL的> SELECT * FROM t1;
两| C1 - C2 | | -两| 1 |路易斯-两| MySQL > SHOW BINLOG EVENTS;
+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------+| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------+| binlog.000001 | 4 | Format_desc | 1 | 123 | Server ver: 8.0.2-gr080-log, Binlog ver: 4 || binlog.000001 | 123 | Previous_gtids | 1 | 150 | || binlog.000001 | 150 | Gtid | 1 | 211 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1' || binlog.000001 | 211 | Query | 1 | 270 | BEGIN || binlog.000001 | 270 | View_change | 1 | 369 | view_id=14724817264259180:1 || binlog.000001 | 369 | Query | 1 | 434 | COMMIT || binlog.000001 | 434 | Gtid | 1 | 495 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2' || binlog.000001 | 495 | Query | 1 | 585 | CREATE DATABASE test || binlog.000001 | 585 | Gtid | 1 | 646 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:3' || binlog.000001 | 646 | Query | 1 | 770 | use `test`; CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL) || binlog.000001 | 770 | Gtid | 1 | 831 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:4' || binlog.000001 | 831 | Query | 1 | 899 | BEGIN || binlog.000001 | 899 | Table_map | 1 | 942 | table_id: 108 (test.t1) || binlog.000001 | 942 | Write_rows | 1 | 984 | table_id: 108 flags: STMT_END_F || binlog.000001 | 984 | Xid | 1 | 1011 | COMMIT /* xid=38 */ |+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------+
server_id
[mysqld]# server configurationdatadir=<full_path_to_data>/data/s2basedir=<full_path_to_bin>/mysql-8.0/port=24802socket=<full_path_to_sock_dir>/s2.sock## Replication configuration parameters#server_id=2gtid_mode=ONenforce_gtid_consistency=ONbinlog_checksum=NONE## Group Replication configuration#loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"loose-group_replication_start_on_boot=offloose-group_replication_local_address= "127.0.0.1:24902"loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"loose-group_replication_bootstrap_group= off
mysql-8.0/bin/mysqld --defaults-file=data/s2/s2.cnf
SET SQL_LOG_BIN=0;
CREATE USER
rpl_user
@'%' IDENTIFIED BY 'password
';GRANT REPLICATION SLAVE ON *.* TO
rpl_user
@'%';SET SQL_LOG_BIN=1;
CHANGE MASTER TO MASTER_USER='
rpl_user
', MASTER_PASSWORD='password
' \\ FOR CHANNEL 'group_replication_recovery';
mysql> INSTALL PLUGIN group_replication SONAME 'group_replication.so';
mysql> START GROUP_REPLICATION;
SET GLOBAL
group_replication_bootstrap_group=ON;
super_read_only
super_read_only
super_read_only
performance_schema.replication_group_members
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+---------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+---------------+
| group_replication_applier | 395409e1-6dfa-11e6-970b-00212844f856 | myhost | 24801 | ONLINE |
| group_replication_applier | ac39f1e6-6dfa-11e6-a69d-00212844f856 | myhost | 24802 | ONLINE |
+---------------------------+--------------------------------------+-------------+-------------+---------------+
mysql>SHOW DATABASES LIKE 'test';
+-----------------+ | Database (test) | +-----------------+ | test | +-----------------+ mysql>SELECT * FROM test.t1;
+----+------+ | c1 | c2 | +----+------+ | 1 | Luis | +----+------+ mysql>SHOW BINLOG EVENTS;
+---------------+------+----------------+-----------+-------------+--------------------------------------------------------------------+ | Log_name | Pos | Event_type | Server_id | End_log_pos | Info | +---------------+------+----------------+-----------+-------------+--------------------------------------------------------------------+ | binlog.000001 | 4 | Format_desc | 2 | 123 | Server ver: 8.0.3-log, Binlog ver: 4 | | binlog.000001 | 123 | Previous_gtids | 2 | 150 | | | binlog.000001 | 150 | Gtid | 1 | 211 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1' | | binlog.000001 | 211 | Query | 1 | 270 | BEGIN | | binlog.000001 | 270 | View_change | 1 | 369 | view_id=14724832985483517:1 | | binlog.000001 | 369 | Query | 1 | 434 | COMMIT | | binlog.000001 | 434 | Gtid | 1 | 495 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2' | | binlog.000001 | 495 | Query | 1 | 585 | CREATE DATABASE test | | binlog.000001 | 585 | Gtid | 1 | 646 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:3' | | binlog.000001 | 646 | Query | 1 | 770 | use `test`; CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL) | | binlog.000001 | 770 | Gtid | 1 | 831 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:4' | | binlog.000001 | 831 | Query | 1 | 890 | BEGIN | | binlog.000001 | 890 | Table_map | 1 | 933 | table_id: 108 (test.t1) | | binlog.000001 | 933 | Write_rows | 1 | 975 | table_id: 108 flags: STMT_END_F | | binlog.000001 | 975 | Xid | 1 | 1002 | COMMIT /* xid=30 */ | | binlog.000001 | 1002 | Gtid | 1 | 1063 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:5' | | binlog.000001 | 1063 | Query | 1 | 1122 | BEGIN | | binlog.000001 | 1122 | View_change | 1 | 1261 | view_id=14724832985483517:2 | | binlog.000001 | 1261 | Query | 1 | 1326 | COMMIT | +---------------+------+----------------+-----------+-------------+--------------------------------------------------------------------+
[mysqld] # server configuration datadir=<full_path_to_data>/data/s3 basedir=<full_path_to_bin>/mysql-8.0/ port=24803 socket=<full_path_to_sock_dir>/s3.sock # # Replication configuration parameters # server_id=3 gtid_mode=ON enforce_gtid_consistency=ON binlog_checksum=NONE # # Group Replication configuration # loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" loose-group_replication_start_on_boot=off loose-group_replication_local_address= "127.0.0.1:24903" loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903" loose-group_replication_bootstrap_group= off
mysql-8.0/bin/mysqld --defaults-file=data/s3/s3.cnf
SET SQL_LOG_BIN=0; CREATE USERrpl_user
@'%' IDENTIFIED BY 'password
'; GRANT REPLICATION SLAVE ON *.* TOrpl_user
@'%'; FLUSH PRIVILEGES; SET SQL_LOG_BIN=1; CHANGE MASTER TO MASTER_USER='rpl_user
', MASTER_PASSWORD='password
' \\ FOR CHANNEL 'group_replication_recovery';
INSTALL PLUGIN group_replication SONAME 'group_replication.so'; START GROUP_REPLICATION;
performance_schema.replication_group_members
MySQL >选择*从performance_schema.replication_group_members;--------------------------- -------------------------------------- ------------- ------------- --------------- | channel_name | member_id | member_host | member_port | member_state | --------------------------- -------------------------------------- ------------- ------------- --------------- | group_replication_applier | 395409e1-6dfa-11e6-970b-00212844f856 | Myhost | 24801 |在线| | group_replication_applier | 7eb217ff-6df3-11e6-966c-00212844f856 | Myhost | 24803 |在线| | group_replication_applier | ac39f1e6-6dfa-11e6-a69d-00212844f856 | Myhost | 24802 |在线| --------------------------- -------------------------------------- ------------- ------------- ---------------
mysql>SHOW DATABASES LIKE 'test';
+-----------------+ | Database (test) | +-----------------+ | test | +-----------------+ mysql>SELECT * FROM test.t1;
+----+------+ | c1 | c2 | +----+------+ | 1 | Luis | +----+------+ mysql>SHOW BINLOG EVENTS;
+---------------+------+----------------+-----------+-------------+--------------------------------------------------------------------+ | Log_name | Pos | Event_type | Server_id | End_log_pos | Info | +---------------+------+----------------+-----------+-------------+--------------------------------------------------------------------+ | binlog.000001 | 4 | Format_desc | 3 | 123 | Server ver: 8.0.3-log, Binlog ver: 4 | | binlog.000001 | 123 | Previous_gtids | 3 | 150 | | | binlog.000001 | 150 | Gtid | 1 | 211 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1' | | binlog.000001 | 211 | Query | 1 | 270 | BEGIN | | binlog.000001 | 270 | View_change | 1 | 369 | view_id=14724832985483517:1 | | binlog.000001 | 369 | Query | 1 | 434 | COMMIT | | binlog.000001 | 434 | Gtid | 1 | 495 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2' | | binlog.000001 | 495 | Query | 1 | 585 | CREATE DATABASE test | | binlog.000001 | 585 | Gtid | 1 | 646 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:3' | | binlog.000001 | 646 | Query | 1 | 770 | use `test`; CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL) | | binlog.000001 | 770 | Gtid | 1 | 831 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:4' | | binlog.000001 | 831 | Query | 1 | 890 | BEGIN | | binlog.000001 | 890 | Table_map | 1 | 933 | table_id: 108 (test.t1) | | binlog.000001 | 933 | Write_rows | 1 | 975 | table_id: 108 flags: STMT_END_F | | binlog.000001 | 975 | Xid | 1 | 1002 | COMMIT /* xid=29 */ | | binlog.000001 | 1002 | Gtid | 1 | 1063 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:5' | | binlog.000001 | 1063 | Query | 1 | 1122 | BEGIN | | binlog.000001 | 1122 | View_change | 1 | 1261 | view_id=14724832985483517:2 | | binlog.000001 | 1261 | Query | 1 | 1326 | COMMIT | | binlog.000001 | 1326 | Gtid | 1 | 1387 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:6' | | binlog.000001 | 1387 | Query | 1 | 1446 | BEGIN | | binlog.000001 | 1446 | View_change | 1 | 1585 | view_id=14724832985483517:3 | | binlog.000001 | 1585 | Query | 1 | 1650 | COMMIT | +---------------+------+----------------+-----------+-------------+--------------------------------------------------------------------+
performance_schema.replication_group_member_stats
performance_schema.replication_group_members
performance_schema.replication_connection_status
performance_schema.replication_applier_status
group_replication_recovery
group_replication_applier
performance_schema.replication_group_member_stats
group_replication_flow_control_period
| |
| |
Member_host
replication_group_members
ERROR
super_read_only
ERROR
super_read_only=OFF
group_replication_enforce_update_everywhere_checks
FALSE
super-read-only=ON
group_replication_member_weight
group_replication_member_weight
group_replication_member_weight
server_uuid
group_replication_member_weight
server_uuid
group_replication_member_weight
group_replication_member_weight
MEMBER_ROLE
sql> SELECT MEMBER_HOST, MEMBER_ROLE FROM performance_schema.replication_group_members;
+-------------------------+-------------+
| MEMBER_HOST | MEMBER_ROLE |
+-------------------------+-------------+
| remote1.example.com | PRIMARY |
| remote2.example.com | SECONDARY |
| remote3.example.com | SECONDARY |
+-------------------------+-------------+
group_replication_primary_member
group_replication_primary_member
MySQL的> SHOW STATUS LIKE 'group_replication_primary_member'
group_replication_recovery_retry_count
MySQL的> SET GLOBAL group_replication_recovery_retry_count= 10;
group_replication_recovery_reconnect_interval
MySQL的> SET GLOBAL group_replication_recovery_reconnect_interval= 120;
group_replication_recovery_reconnect_interval
replication_group_members
199b2df7-4aaf-11e6-bb16-28b2bd168d07
199bb88e-4aaf-11e6-babe-28b2bd168d07
1999b9fb-4aaf-11e6-bb54-28b2bd168d07
19ab72fc-4aaf-11e6-bb51-28b2bd168d07
19b33846-4aaf-11e6-ba81-28b2bd168d07
replication_group_members
MySQL的> SELECT * FROM performance_schema.replication_group_members;
--------------------------- -------------------------------------- ------------- ------------- -------------- | channel_name | member_id | member_host | member_port | member_state | --------------------------- -------------------------------------- ------------- ------------- -------------- | group_replication_applier | 1999b9fb-4aaf-11e6-bb54-28b2bd168d07 | 127.0.0.1 | 13002 |在线| | group_replication_applier | 199b2df7-4aaf-11e6-bb16-28b2bd168d07 | 127.0.0.1 | 13001 |在线| | group_replication_applier | 199bb88e-4aaf-11e6-babe-28b2bd168d07 | 127.0.0.1 | 13000 |在线| | group_replication_applier | 19ab72fc-4aaf-11e6-bb51-28b2bd168d07 | 127.0.0.1 | 13003 |在线| | group_replication_applier | 19b33846-4aaf-11e6-ba81-28b2bd168d07 | 127.0.0.1 | 13004 |在线| --------------------------- -------------------------------------- ------------- ------------- --------------
replication_group_members
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 1999b9fb-4aaf-11e6-bb54-28b2bd168d07 | 127.0.0.1 | 13002 | UNREACHABLE |
| group_replication_applier | 199b2df7-4aaf-11e6-bb16-28b2bd168d07 | 127.0.0.1 | 13001 | ONLINE |
| group_replication_applier | 199bb88e-4aaf-11e6-babe-28b2bd168d07 | 127.0.0.1 | 13000 | ONLINE |
| group_replication_applier | 19ab72fc-4aaf-11e6-bb51-28b2bd168d07 | 127.0.0.1 | 13003 | UNREACHABLE |
| group_replication_applier | 19b33846-4aaf-11e6-ba81-28b2bd168d07 | 127.0.0.1 | 13004 | UNREACHABLE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
group_replication_force_members
group_replication_force_members
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 1999b9fb-4aaf-11e6-bb54-28b2bd168d07 | 127.0.0.1 | 13002 | UNREACHABLE |
| group_replication_applier | 199b2df7-4aaf-11e6-bb16-28b2bd168d07 | 127.0.0.1 | 13001 | ONLINE |
| group_replication_applier | 199bb88e-4aaf-11e6-babe-28b2bd168d07 | 127.0.0.1 | 13000 | ONLINE |
| group_replication_applier | 19ab72fc-4aaf-11e6-bb51-28b2bd168d07 | 127.0.0.1 | 13003 | UNREACHABLE |
| group_replication_applier | 19b33846-4aaf-11e6-ba81-28b2bd168d07 | 127.0.0.1 | 13004 | UNREACHABLE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
mysql> SELECT @@group_replication_local_address;
+-----------------------------------+
| @@group_replication_local_address |
+-----------------------------------+
| 127.0.0.1:10000 |
+-----------------------------------+
mysql> SELECT @@group_replication_local_address;
+-----------------------------------+
| @@group_replication_local_address |
+-----------------------------------+
| 127.0.0.1:10001 |
+-----------------------------------+
127.0.0.1:10000
mysql> SET GLOBAL group_replication_force_members="
127.0.0.1:10000,127.0.0.1:10001";
replication_group_members
MySQL的> SELECT * FROM performance_schema.replication_group_members;
--------------------------- -------------------------------------- ------------- ------------- -------------- | channel_name | member_id | member_host | member_port | member_state | --------------------------- -------------------------------------- ------------- ------------- -------------- | group_replication_applier | b5ffe505-4ab6-11e6-b04b-28b2bd168d07 | 127.0.0.1 | 13000 |在线| | group_replication_applier | b60907e7-4ab6-11e6-afb7-28b2bd168d07 | 127.0.0.1 |吉林|在线| --------------------------- -------------------------------------- ------------- ------------- --------------
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | b5ffe505-4ab6-11e6-b04b-28b2bd168d07 | 127.0.0.1 | 13000 | ONLINE |
| group_replication_applier | b60907e7-4ab6-11e6-afb7-28b2bd168d07 | 127.0.0.1 | 13001 | ONLINE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
mysql> SELECT * member_host, member_port, member_state FROM performance_schema.replication_group_members;
+-------------+-------------+--------------+
| member_host | member_port | member_state |
+-------------+-------------+--------------+
| node1 | 3306 | ONLINE |
| node2 | 3306 | ONLINE |
| node3 | 3306 | ONLINE |
+-------------+-------------+--------------+
node1
node3
super_read_only=ON
mysqlbackup --defaults-file=/etc/my.cnf --backup-image=/backups/my.mbi_`date +%d%m_%H%M` \
--backup-dir=/backups/backup_`date +%d%m_%H%M` --user=root -pmYsecr3t \
--host=127.0.0.1 --no-history-logging backup-to-image
--no-history-logging
node1
node1
node1
node2/backups # scp my.mbi_2206_1429 node1:/backups
node1
mysqlbackup --defaults-file=/etc/my.cnf \
--backup-image=/backups/my.mbi_2206_1429 \
--backup-dir=/tmp/restore_`date +%d%m_%H%M` copy-back-and-apply-log
group_replication_start_on_boot=OFF super_read_only=ON event_scheduler=OFF
mysql> RESET MASTER;
node2
MySQL的> RESET SLAVE ALL;
gtid_executed
backup_gtid_executed.sql
datadir
gtid_executed
MySQL的> SET SQL_LOG_BIN=OFF;
MySQL的> SOURCE
datadir
/meta/backup_gtid_executed.sqlMySQL的> SET SQL_LOG_BIN=ON;
mysql>CHANGE MASTER TO MASTER_USER='
mysql>rpl_user
', MASTER_PASSWORD='password
' / FOR CHANNEL 'group_replication_recovery';START GROUP_REPLICATION;
super_read_only=ON
MySQL的> SET global event_scheduler=ON;
group_replication_start_on_boot=ON super_read_only=ON event_scheduler=ON
group_replication_ip_whitelist
2017-10-07T06:40:49.320686Z 4 [Note] Plugin group_replication reported: '[GCS] Added automatically IP ranges 192.0.2.21/24,198.51.100.44,203.0.113.0/24,127.0.0.1/32 to the whitelist'
mysql> STOP GROUP_REPLICATION; mysql> SET GLOBAL group_replication_ip_whitelist="192.0.2.21/24,198.51.100.44,203.0.113.0/24,example.org,www.example.com/24"; mysql> START GROUP_REPLICATION;
--loose-group_replication_group_seeds
donor> SET SQL_LOG_BIN=0; donor> CREATE USER 'rec_ssl_user'@'%' REQUIRE SSL; donor> GRANT replication slave ON *.* TO 'rec_ssl_user'@'%'; donor> SET SQL_LOG_BIN=1;
new_member> SET GLOBAL group_replication_recovery_use_ssl=1; new_member> SET GLOBAL group_replication_recovery_ssl_ca= '.../cacert.pem'; new_member> SET GLOBAL group_replication_recovery_ssl_cert= '.../client-cert.pem'; new_member> SET GLOBAL group_replication_recovery_ssl_key= '.../client-key.pem';
new_member> CHANGE MASTER TO MASTER_USER="rec_ssl_user" FOR CHANNEL "group_replication_recovery"; new_member> START GROUP_REPLICATION;
group_replication_ssl_mode
[mysqld] ssl_ca = "cacert.pem" ssl_capath = "/.../ca_directory" ssl_cert = "server-cert.pem" ssl_cipher = "DHE-RSA-AEs256-SHA" ssl_crl = "crl-server-revoked.crl" ssl_crlpath = "/.../crl_directory" ssl_key = "server-key.pem" group_replication_ssl_mode= REQUIRED
group_replication_ssl_mode
group_replication_allow_local_disjoint_gtids_join
--group-replication-allow-local-disjoint-gtids-join=value | |
group_replication_allow_local_disjoint_gtids_join | |
OFF |
group_replication_allow_local_lower_version_join
--group-replication-allow-local-lower-version-join=value | |
group_replication_allow_local_lower_version_join | |
OFF |
group_replication_auto_increment_increment
--group-replication-auto-increment-increment=value | |
group_replication_auto_increment_increment | |
7 | |
1 | |
65535 |
group_replication_bootstrap_group
--group-replication-bootstrap-group=value | |
group_replication_bootstrap_group | |
OFF |
OFF
group_replication_communication_debug_options
--group-replication-communication-debug-options=value | |
group_replication_communication_debug_options | |
GCS_DEBUG_NONE | |
|
GCS_DEBUG_TRACE
GCS_DEBUG_NONE
GCS_DEBUG_BASIC
GCS_DEBUG_TRACE
XCOM_DEBUG_BASIC
XCOM_DEBUG_TRACE
GCS_DEBUG_ALL
GCS_DEBUG_NONE
group_replication_components_stop_timeout
--group-replication-components-stop-timeout=value | |
group_replication_components_stop_timeout | |
31536000 | |
2 | |
31536000 |
group_replication_compression_threshold
--group-replication-compression-threshold=value | |
group_replication_compression_threshold | |
1000000 | |
0 | |
4294967295 |
group_replication_enforce_update_everywhere_checks
--group-replication-enforce-update-everywhere-checks=value | |
group_replication_enforce_update_everywhere_checks | |
OFF |
group_replication_exit_state_action
--group-replication-exit-state-action=value | |
group_replication_exit_state_action | |
ABORT_SERVER | |
|
group_replication_exit_state_action
group_replication_exit_state_action
group_replication_flow_control_applier_threshold
--group-replication-flow-control-applier-threshold=value | |
group_replication_flow_control_applier_threshold | |
25000 | |
0 | |
2147483647 |
group_replication_flow_control_certifier_threshold
--group-replication-flow-control-certifier-threshold=value | |
group_replication_flow_control_certifier_threshold | |
25000 | |
0 | |
2147483647 |
group_replication_flow_control_hold_percent
--group-replication-flow-control-hold-percent=value | |
group_replication_flow_control_hold_percent | |
10 | |
0 | |
100 |
group_replication_flow_control_max_commit_quota
--group-replication-flow-control-max-commit-quota=value | |
group_replication_flow_control_max_commit_quota | |
0 | |
0 | |
2147483647 |
group_replication_flow_control_min_quota
group_replication_flow_control_member_quota_percent
--group-replication-flow-control-member-quota-percent=value | |
group_replication_flow_control_member_quota_percent | |
0 | |
0 | |
100 |
group_replication_flow_control_min_quota
--group-replication-flow-control-min-quota=value | |
group_replication_flow_control_min_quota | |
0 | |
0 | |
2147483647 |
group_replication_flow_control_max_commit_quota
group_replication_flow_control_min_recovery_quota
--group-replication-flow-control-min-recovery-quota=value | |
group_replication_flow_control_min_recovery_quota | |
0 | |
0 | |
2147483647 |
group_replication_flow_control_max_commit_quota
group_replication_flow_control_mode
--group-replication-flow-control-mode=value | |
group_replication_flow_control_mode | |
QUOTA | |
|
group_replication_flow_control_period
--group-replication-flow-control-period=value | |
group_replication_flow_control_period | |
1 | |
1 | |
60 |
group_replication_flow_control_release_percent
--group-replication-flow-control-release-percent=value | |
group_replication_flow_control_release_percent | |
50 | |
0 | |
1000 |
group_replication_force_members
--group-replication-force-members=value | |
group_replication_force_members | |
host1:port1
START GROUP_REPLICATION
--group-replication-group-name=value | |
group_replication_group_name | |
--group-replication-group-seeds=value | |
group_replication_group_seeds | |
host1:port1
START
GROUP_REPLICATION
group_replication_gtid_assignment_block_size
--group-replication-gtid-assignment-block-size=value | |
group_replication_gtid_assignment_block_size | |
1000000 | |
1 | |
9223372036854775807 | |
4294967295 |
group_replication_ip_whitelist
--group-replication-ip-whitelist=value | |
group_replication_ip_whitelist | |
AUTOMATIC |
AUTOMATIC
192.0.2.22,198.51.100.0/24,example.org,www.example.com/24
group_replication_local_address
--group-replication-local-address=value | |
group_replication_local_address | |
host:port
host:port
group_replication_member_weight
--group-replication-member-weight=value | |
group_replication_member_weight | |
50 | |
0 | |
100 |
member-1
: group_replication_member_weight=30, server_uuid=aaaa
member-2
: group_replication_member_weight=40, server_uuid=bbbb
member-3
: group_replication_member_weight=40, server_uuid=cccc
member-4
: group_replication_member_weight=40, server_uuid=dddd
member-2
member-4
member
group_replication_poll_spin_loops
--group-replication-poll-spin-loops=value | |
group_replication_poll_spin_loops | |
0 | |
0 | |
18446744073709551615 | |
4294967295 |
group_replication_recovery_complete_at
--group-replication-recovery-complete-at=value | |
group_replication_recovery_complete_at | |
TRANSACTIONS_APPLIED | |
|
TRANSACTIONS_CERTIFIED
group_replication_recovery_get_public_key
--group-replication-recovery-get-public-key | |
group_replication_recovery_get_public_key | |
OFF |
caching_sha2_password
group_replication_recovery_public_key_path
group_replication_recovery_get_public_key
group_replication_recovery_public_key_path
--group-replication-recovery-public-key-path | |
group_replication_recovery_public_key_path | |
NULL |
sha256_password
sha256_password
group_replication_recovery_public_key_path
group_replication_recovery_get_public_key
group_replication_recovery_reconnect_interval
--group-replication-recovery-reconnect-interval=value | |
group_replication_recovery_reconnect_interval | |
60 | |
0 | |
31536000 |
group_replication_recovery_retry_count
--group-replication-recovery-retry-count=value | |
group_replication_recovery_retry_count | |
10 | |
0 | |
31536000 |
group_replication_recovery_ssl_ca
--group-replication-recovery-ssl-ca=value | |
group_replication_recovery_ssl_ca | |
group_replication_recovery_ssl_capath
--group-replication-recovery-ssl-capath=value | |
group_replication_recovery_ssl_capath | |
group_replication_recovery_ssl_cert
--group-replication-recovery-ssl-cert=value | |
group_replication_recovery_ssl_cert | |
group_replication_recovery_ssl_cipher
--group-replication-recovery-ssl-cipher=value | |
group_replication_recovery_ssl_cipher | |
group_replication_recovery_ssl_crl
--group-replication-recovery-ssl-crl=value | |
group_replication_recovery_ssl_crl | |
group_replication_recovery_ssl_crlpath
--group-replication-recovery-ssl-crlpath=value | |
group_replication_recovery_ssl_crlpath | |
group_replication_recovery_ssl_key
--group-replication-recovery-ssl-key=value | |
group_replication_recovery_ssl_key | |
group_replication_recovery_ssl_verify_server_cert
--group-replication-recovery-ssl-verify-server-cert=value | |
group_replication_recovery_ssl_verify_server_cert | |
OFF |
group_replication_recovery_use_ssl
--group-replication-recovery-use-ssl=value | |
group_replication_recovery_use_ssl | |
OFF |
group_replication_single_primary_mode
--group-replication-single-primary-mode=value | |
group_replication_single_primary_mode | |
ON |
--group-replication-ssl-mode=value | |
group_replication_ssl_mode | |
DISABLED | |
|
group_replication_start_on_boot
--group-replication-start-on-boot=value | |
group_replication_start_on_boot | |
ON |
group_replication_transaction_size_limit
--group-replication-transaction-size-limit=value | |
group_replication_transaction_size_limit | |
150000000 | |
0 | |
0 | |
2147483647 |
group_replication_unreachable_majority_timeout
--group-replication-unreachable-majority-timeout=value | |
group_replication_unreachable_majority_timeout | |
0 | |
0 | |
31536000 |
STOP GROUP
REPLICATION
ERROR
super_read_only=ON
ERROR
group_replication_primary_member
group_replication_primary_member
InnoDB
InnoDB
--log-bin[=log_file_name]
--log-slave-updates
--binlog-format=row
--gtid-mode=ON
--master-info-repository=TABLE
--relay-log-info-repository=TABLE
mysql.slave_relay_log_info
FILE
--transaction-write-set-extraction=XXHASH64
slave_parallel_workers
slave_preserve_commit_order=1
slave_parallel_type=LOGICAL_CLOCK
slave_preserve_commit_order=1
slave_parallel_workers=0
slave_parallel_type
slave_preserve_commit_order
--binlog-checksum=NONE
InnoDB
REPEATABLE
READ
READ COMMITTED
READ
COMMITTED
GET_LOCK()
SERIALIZABLE
group_replication_single_primary_mode=OFF
group_replication_enforce_update_everywhere_checks=ON
LOAD DATA
INFILE
SELECT .. FOR UPDATE
group_replication_applier
group_replication_local_address
CHANGE MASTER
TO
group_replication_local_address
relay_log
STOP GROUP_REPLICATION
START GROUP_REPLICATION
group_replication_local_address
198.51.100.179
group_replication_local_address=203.0.113.1:33061
hostname
port
performance_schema.replication_group_members
/etc/hosts
--report-host
--skip-name-resolve
MEMBER_PORT
--report-port
COMMIT
START
TRANSACTION ... COMMIT
group_replication_poll_spin_loops
mysql> SET GLOBAL group_replication_poll_spin_loops= 10000;
STOP GROUP_REPLICATION; SET GLOBAL group_replication_compression_threshold= 2097152; START GROUP_REPLICATION;