MySQL5.7 MGR安装配置


MySQL5.7 MGR安装配置一、服务器规划mysql_mgr_01 192.168.10.223mysql_mgr_02 192.168.10.224mysql_mgr_03 192.168.10.225

二、配置文件1. mysql_mgr_01[root@mysql_mgr_01 tmp]# cat /etc/my.cnf[mysqld]sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONserver-id=330601port = 3306log_bin = /data/mysql/binlog/mysql_mgr01-bin#expire_logs_days=10explicit_defaults_for_timestamp=truedatadir=/data/mysql/datasocket=/data/mysql/run/mysql.sockskip-external-lockingpid-file=/data/mysql/run/mysql.pidinnodb_file_per_table = on#skip_name_resolve = oncharacter-set-server = utf8mb4character-set-client-handshak开发云主机域名e = FALSEcollation-server = utf8mb4_unicode_ciinit_connect=’SET NAMES utf8mb4’slow_query_log = onlong_query_time = 2slow_query_log_file = /data/mysql/slow_logs/mysql-slow.logbinlog_rows_query_log_events=ONrelay-log=/data/mysql/relaylog/mysql_mgr_01-relay-bin
## Replication configuration parameters#gtid_mode=ONenforce_gtid_consistency=ONmaster_info_repository=TABLErelay_log_info_repository=TABLEbinlog_checksum=NONElog_slave_updates=ONbinlog_format=ROW
## Group Replication configuration#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= “192.168.10.223:24901″loose-group_replication_group_seeds= “192.168.10.223:24901,192.168.10.224:24902,192.168.10.225:24903″loose-group_replication_bootstrap_group=offgroup_replication_member_weight = 100
symbolic-links=0[mysqld_safe]log-error=/data/mysql/logs/mysql.logpid-file=/data/mysql/run/mysql.pid[mysql]default-character-set = utf8mb4socket=/data/mysql/run/mysql.sock[client]#default-character-set = utf8mb4socket=/data/mysql/run/mysql.sock
2. mysql_mgr_02[root@mysql_mgr_02 tmp]# cat /etc/my.cnf[mysqld]sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONserver-id=330602port = 3306log_bin = /data/mysql/binlog/mysql_mgr02-bin#expire_logs_days=10explicit_defaults_for_timestamp=truedatadir=/data/mysql/datasocket=/data/mysql/run/mysql.sockskip-external-lockingpid-file=/data/mysql/run/mysql.pidinnodb_file_per_table = on#skip_name_resolve = onrelay-log=/data/mysql/relaylog/mysql_mgr_02-relay-bincharacter-set-server = utf8mb4character-set-client-handshake = FALSEcollation-server = utf8mb4_unicode_ciinit_connect=’SET NAMES utf8mb4’slow_query_log = onlong_query_time = 2slow_query_log_file = /data/mysql/slow_logs/mysql-slow.logsymbolic-links=0
## Replication configuration parameters#gtid_mode=ONenforce_gtid_consistency=ONmaster_info_repository=TABLErelay_log_info_repository=TABLEbinlog_checksum=NONElog_slave_updates=ONbinlog_format=ROW
## Group Replication configuration#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= “192.168.10.224:24902″loose-group_replication_group_seeds= “192.168.10.223:24901,192.168.10.224:24902,192.168.10.225:24903″loose-group_replication_bootstrap_group=offgroup_replication_member_weight = 80
[mysqld_safe]log-error=/data/mysql/logs/mysql.logpid-file=/data/mysql/run/mysql.pid
[mysql]default-character-set = utf8mb4socket=/data/mysql/run/mysql.sock
[client]#default-character-set = utf8mb4socket=/data/mysql/run/mysql.sock
3. mysql_mgr_03[root@mysql_mgr_03 tmp]# cat /etc/my.cnf[mysqld]sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONserver-id=330603port = 3306log_bin = /data/mysql/binlog/mysql_mgr03-bin#expire_logs_days=10explicit_defaults_for_timestamp=truedatadir=/data/mysql/datasocket=/data/mysql/run/mysql.sockskip-external-lockingpid-file=/data/mysql/run/mysql.pidinnodb_file_per_table = on#skip_name_resolve = onrelay-log=/data/mysql/relaylog/mysql_mgr_03-relay-bincharacter-set-server = utf8mb4character-set-client-handshake = FALSEcollation-server = utf8mb4_unicode_ciinit_connect=’SET NAMES utf8mb4’slow_query_log = onlong_query_time = 2slow_query_log_file = /data/mysql/slow_logs/mysql-slow.logsymbolic-links=0
## Replication configuration parameters#gtid_mode=ONenforce_gtid_consistency=ONmaster_info_repository=TABLErelay_log_info_repository=TABLEbinlog_checksum=NONElog_slave_updates=ONbinlog_format=ROW
## Group Replication configuration#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= “192.168.10.225:24903″loose-group_replication_group_seeds= “192.168.10.223:24901,192.168.10.224:24902,192.168.10.225:24903″loose-group_replication_bootstrap_group=offgroup_replication_member_weight = 90
[mysqld_safe]log-error=/data/mysql/logs/mysql.logpid-file=/data/mysql/run/mysql.pid
[mysql]default-character-set = utf8mb4socket=/data/mysql/run/mysql.sock
[client]#default-character-set = utf8mb4socket=/data/mysql/run/mysql.sock

三、MGR配置1. mysql_mgr_01[mysql_mgr_01]
#关闭SQL_LOG_BINSET SQL_LOG_BIN=0;
#创建组复制使用的帐号密码CREATE USER rpl_user@’%’ IDENTIFIED BY ‘password’;GRANT REPLICATION SLAVE ON *.* TO rpl_user@’%’;
FLUSH PRIVILEGES;
#开启SQL_LOG_BINSET SQL_LOG_BIN=1;
#安装组复制插件group_replication.soINSTALL PLUGIN group_replication SONAME ‘group_replication.so’;
CHANGE MASTER TO MASTER_USER=’rpl_user’, MASTER_PASSWORD=’password’ FOR CHANNEL ‘group_replication_recovery’;
#初始化主节点SET GLOBAL group_replication_bootstrap_group=ON;START GROUP_REPLICATION;SET GLOBAL group_replication_bootstrap_group=OFF;
#查看组复制成员状态SELECT * FROM performance_schema.replication_group_members;
#备份mysqldump -uroot -p –all-databases –master-data=2 –single-transaction>/tmp/all.sql
2. mysql_mgr_02[mysql_mgr_02]
#恢复备份
#安装组复制插件group_replication.soINSTALL PLUGIN group_replication SONAME ‘group_replication.so’;
CHANGE MASTER TO MASTER_USER=’rpl_user’, MASTER_PASSWORD=’password’ FOR CHANNEL ‘group_replication_recovery’;
#启动组复制START GROUP_REPLICATION;

3. mysql_mgr_03[mysql_mgr_03]
#恢复备份
#安装组复制插件group_replication.soINSTALL PLUGIN group_replication SONAME ‘group_replication.so’;
CHANGE MASTER TO MASTER_USER=’rpl_user’, MASTER_PASSWORD=’password’ FOR CHANNEL ‘group_replication_recovery’;
#启动组复制START GROUP_REPLICATION;

相关推荐: mysql基于日志的主从复制是什么

这篇文章主要介绍了mysql基于日志的主从复制是什么,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获。下面让小编带着大家一起了解一下。 总有人问我 会不会读写分离,我有时真的不知道怎么回答,这么滴吧,技术本身不难你,难的是咱们能不能遇…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 06/10 11:29
下一篇 06/10 11:29

相关推荐