--mysql High-Availability official documentation: https://dev.mysql.com/doc/refman/5.7/en/group-replication.htmlmysql:https://www.mysql.com/ downloads/: Download this: MySQL Community Server (GPL) 5.7. Version 19-Installation Reference Link: Introduction to the principle of #mysql group replication: http://blog.itpub.net/29510932/ viewspace-2055679/#mysql group-replication Installation Deployment Introduction http://blog.csdn.net/yuanlin65/article/details/53782020 Installation topology diagram: 172.27.129.2 mysql-ha-s1172.27.129.3 mysql-ha-s2172.27.129.4 mysql-ha-s3 Installation User: Work installation location:/MNT/DISK01
#mysql-HA-S1 Installation --Pre-Installation # Create work user Groupadd workuseradd-g work work #设置hostname以及hostshostnamectl set-hostname mysql-ha-s1 #在/etc/hosts Add three machines to the host parsing 172.27.129.2 mysql-ha-s1172.27.129.3 mysql-ha-s2172.27.129.4 mysql-ha-s3 # Shut down the server firewall with selinux# shut down firewall systemctl stop firewalld.servicesystemctl disable Firewalld.servicefirewall-cmd--state #关闭selinux/usr/sbin/sestatus-vsetenforce 0sed-i ' s/selinux=enforcing/selinux=disabled/g '/etc/selinux/config #设置/mnt/disk01 permissions chmod 777/mnt/disk01 #开始安装进程 # Enter work user su-worktar-zxvf/home/work/ mysql-5.7.19-linux-glibc2.12-x86_64.tar.gzmv/home/work/mysql-5.7.19-linux-glibc2.12-x86_64/home/work/ mysql-5.7.19 #安装数据库-configuration files are stored separately from the data/home/work/mysql-5.7.19/bin/mysqld--no-defaults--initialize--explicit_ Defaults_for_timestamp--basedir=/mnt/disk01/mysql/--datadir=/mnt/disk01/data Note: Please record the initial password in the installation prompt, for example: [email protected]: sdk>co; rq3b+ #mysql配置文件内容: [mysqld]# server configurationdatadir=/mnt/disk01/databasedir=/mnt/disk01/mysql#Set plugin local valueplugin_dir=/home/work/mysql-5.7.19/lib/pluginport=24801socket=/tmp/mysql.sock # base Configserver_id=1gtid_mode=onuser=mysqlenforce_gtid_consistency=onmaster_info_repository=tablerelay_log_info_ repository=tablebinlog_checksum=nonelog_slave_updates=onlog_bin=binlogbinlog_format=row # Group Replicationtransaction_write_set_extraction=xxhash64loose-group_replication_group_name= " Aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa "Loose-group_replication_start_on_boot=offloose-group_replication_local_ address= "172.27.129.2:24901" loose-group_replication_group_seeds= " 172.27.129.2:24901,172.27.129.3:24901,172.27.129.4:24901 "Loose-group_replication_bootstrap_group= off # Open Mutil_mode Configloose-group_replication_single_primary_mode=falseloose-group_replication_enforce_update_ everywhere_checks= true# Create the configuration file Touch/mnt/disk01/mysql/my.cnf write the above configuration to the configuration file. #配置mysql环境变量vi ~/.bash_profile Add the following on the "Export PATH" line: path= $PATH:/home/work/mysql-5.7.19/bin Make the configuration file effective: source ~/.bash_profile #启动mysql数据库/home/work/mysql-5.7.19/bin/mysqld--defaults-file=/mnt/disk01/mysql/my.cnf & #非交互式修改初始密码/home/work/mysql-5.7.19/bin/mysqladmin-s/tmp/mysql.sock-u root-p ' sdk>co; rq3b+ ' password ' your passwd ' #登录数据库: mysql-uroot-p ' your passwd ' #初始化与安装启动group-replicationset sql_log_bin = 0; CREATE USER [email protected] '% '; GRANT REPLICATION SLAVE On * * to [email protected] '% ' identified by ' rpl_pass '; FLUSH privileges; SET sql_log_bin=1; Change MASTER to Master_user= ' Rpl_user ', master_password= ' rpl_pass ' for CHANNEL ' group_replication_recovery '; INSTALL PLUGIN group_replication SONAME ' group_replication.so '; SET GLOBAL Group_replication_bootstrap_group=on; START group_replication; SET GLOBAL Group_replication_bootstrap_group=off; #查询启动状态SELECT * from Performance_schema.replication_group_members; #安装完毕
#mysql-ha-s2 and MYSQL-HA-S3 installationNote: The entire reference S1 installation, there are several changes. 1, note my.cnf server_id postponed to 2 and 32, note my.cnf loose-group_replication_local_address rollover 3, MySQL initialization and startup script as follows: SET Sql_log_ bin=0; CREATE USER [email protected] '% '; GRANT REPLICATION SLAVE On * * to [e-mail protected] '% ' identified by ' rpl_pass '; FLUSH privileges; SET sql_log_bin=1; Change MASTER to Master_user= ' Rpl_user ', master_password= ' rpl_pass ' for CHANNEL ' group_replication_recovery '; INSTALL PLUGIN group_replication SONAME ' group_replication.so ';set global group_replication_allow_local_disjoint_gtids_join=on;START group_replication; No other difference. The installation is complete and the test can be done.
"Environment Deployment" CENTOS7 installation mysql-5.7.19 group-replication