标签:client 名称 mgr base 失败 mat 主键 容错 导致
[client] port = 3306 socket = /usr/local/mysql/tmp/mysql.sock [mysqld] port = 3306 socket = /usr/local/mysql/tmp/mysql.sock back_log = 80 basedir = /usr/local/mysql tmpdir = /tmp datadir = /usr/local/mysql/data #-------------------gobal variables------------# 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 = /usr/local/mysql/log/mysql-bin transaction_write_set_extraction = XXHASH64 #以便在server收集写集合的同时将其记录到二进制日志。写集合基于每行的主键,并且是行更改后的唯一标识此标识将用于检测冲突。 loose-group_replication_group_name = ‘ce9be252-2b71-11e6-b8f4-00212889f856‘ #组的名字可以随便起,但不能用主机的GTID loose-group_replication_start_on_boot = off #为了避免每次启动自动引导具有相同名称的第二个组,所以设置为OFF。 loose-group_replication_bootstrap_group = off #同上 loose-group_replication_local_address = ‘192.168.1.88:33061‘ #写自己主机所在IP loose-group_replication_group_seeds =‘192.168.1.88:33061,192.168.1.89:33061,192.168.1.90:33061‘ loose-group_replication_single_primary_mode = off #关闭单主模式的参数 loose-group_replication_enforce_update_everywhere_checks = on #开启多主模式的参数 max_connect_errors = 20000 max_connections = 2000 wait_timeout = 3600 interactive_timeout = 3600 net_read_timeout = 3600 net_write_timeout = 3600 table_open_cache = 1024 table_definition_cache = 1024 thread_cache_size = 512 open_files_limit = 10000 character-set-server = utf8 collation-server = utf8_bin skip_external_locking performance_schema = 1 user = mysql myisam_recover_options = DEFAULT skip-name-resolve local_infile = 0 lower_case_table_names = 0 #--------------------innoDB------------# innodb_buffer_pool_size = 2000M innodb_data_file_path = ibdata1:200M:autoextend innodb_flush_log_at_trx_commit = 1 innodb_io_capacity = 600 innodb_lock_wait_timeout = 120 innodb_log_buffer_size = 8M innodb_log_file_size = 200M innodb_log_files_in_group = 3 innodb_max_dirty_pages_pct = 85 innodb_read_io_threads = 8 innodb_write_io_threads = 8 innodb_support_xa = 1 innodb_thread_concurrency = 32 innodb_file_per_table innodb_rollback_on_timeout #------------session variables-------# join_buffer_size = 8M key_buffer_size = 256M bulk_insert_buffer_size = 8M max_heap_table_size = 96M tmp_table_size = 96M read_buffer_size = 8M sort_buffer_size = 2M max_allowed_packet = 64M read_rnd_buffer_size = 32M #------------MySQL Log----------------# log-bin = my3306-bin binlog_format = row #组复制依赖基于行的复制格式 sync_binlog = 1 expire_logs_days = 15 max_binlog_cache_size = 128M max_binlog_size = 500M binlog_cache_size = 64k slow_query_log log-slow-admin-statements log_warnings = 1 long_query_time = 0.25 #---------------replicate--------------# relay-log-index = relay3306.index relay-log = relay3306 server-id =88 #每个db的id唯一 init_slave = ‘set sql_mode=STRICT_ALL_TABLES‘ log-slave-updates [myisamchk] key_buffer = 512M sort_buffer_size = 512M read_buffer = 8M write_buffer = 8M [mysqlhotcopy] interactive-timeout [mysqld_safe] open-files-limit = 8192 log-error = /usr/local/mysql/log/mysqld_error.log
(1)关闭88的数据库实例
(2)在89节点操作
查询组成员,发现88已不在组中
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | f308d2d6-6c93-11e7-a5b1-000c2979c7bf | mgr90 | 3306 | ONLINE |
| group_replication_applier | f39c169e-6c93-11e7-a550-000c291d7bdb | mgr89 | 3306 | ONLINE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
2 rows in set (0.00 sec)
(3)写入数据
mysql> insert into t1 values(2,‘Mr.Li‘);
Query OK, 1 row affected (0.02 sec)
mysql> select * from t1;
+----+----------+
| c1 | c2 |
+----+----------+
| 1 | lalala |
| 2 | Mr.Li |
+----+----------+
5 rows in set (0.00 sec)
(4)启动88的数据库
修改配置文件,自动启动组复制
loose-group_replication_start_on_boot = on
group_replication_allow_local_disjoint_gtids_join = on
(5)再次查看组成员,发现88已重新加入组
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 715e9af4-6c93-11e7-aabf-000c291abb1f | mgr88 | 3306 | ONLINE |
| group_replication_applier | f308d2d6-6c93-11e7-a5b1-000c2979c7bf | mgr90 | 3306 | ONLINE |
| group_replication_applier | f39c169e-6c93-11e7-a550-000c291d7bdb | mgr89 | 3306 | ONLINE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
3 rows in set (0.00 sec)
(6)查看数据,发现数据已同步
mysql> use test1;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from t1;
+----+----------+
| c1 | c2 |
+----+----------+
| 1 | lalala |
| 2 | Mr.Li |
+----+----------+
5 rows in set (0.00 sec)
|
[MGR——Mysql的组复制之多主模式 ] 详细搭建部署过程
标签:client 名称 mgr base 失败 mat 主键 容错 导致
原文地址:http://www.cnblogs.com/manger/p/7211932.html