yum -y install gcc make cmake ncurses-devel libxml2-devel libtool-ltdl-devel gcc-c++ autoconf automake bison zlib-devel
wget http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz tar -zxvf boost_1_59_0.tar.gz cd boost_1_59_0 ./bootstrap.sh ./b2 stage threading=multi link=shared ./b2 install threading=multi link=shared
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17.tar.gz tar -zxvf mysql-5.7.17.tar.gz cd mysql-5.7.17 cmake . make && make install
mkdir /data/mysql useradd mysql chown -R mysql:mysql /data/mysql chown -R mysql:mysql /usr/local/mysql
/usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --initialize
[mysqld] #基本設置 user=mysql datadir=/data/mysql basedir=/usr/local/mysql port=3306 socket=/usr/local/mysql/mysql.sock pid-file=/usr/local/mysql/mysql.pid log-error=/usr/local/mysql/error.log #複製框架,根據Mysql組複製要求配置複製 #惟一標識號1 server_id=1 gtid_mode=ON #組複製使用全局事務標識符,來精確追蹤哪些事務已在全部server實例上提交,從而能判斷哪些server執行了與已提交事務衝突的事務 enforce_gtid_consistency=ON master_info_repository=TABLE relay_log_info_repository=TABLE binlog_checksun=NONE log_slave_updates=ON #server需記錄applier應用的二進制日誌 log_bin=binlog #MySQL組複製會複製二進制日誌的內容,所以需打開二進制日誌 binlog_format=ROW #組複製依賴於行的複製格式 #組複製設置 transaction_write_set_extraction=XXHASH64 loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" loose-group_replication_start_on_boot=off loose-group_replication_local_address="10.0.0.7:33061" loose-group_replication_group_seeds="10.0.0.7:33061;10.0.0.8:33061;10.0.0.9:33061" loose-group_replication_bootstrap_group=off
nohup /usr/local/mysql/bin/mysqld --defaults-file=/usr/local/mysql/etc/my.cnf &
ln -s /usr/local/mysql/mysql.sock /tmp/mysql.sock
set password=password('123456');
set sql_log_bin=0;
create user rpl_user@'%';
grant replication slave on *.* to rpl_user@'%' 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';
use performance_schema select *from replication_group_members;
install plugin group_replication soname 'group_replication.so';
show plugins\G;
set global group_replication_bootstrap_group=ON;
start group_replication; set global group_replication_bootstrap_group=off;
select *from replication_group_members;
create database test; use test; create table t1( -> c1 int primary key, -> c2 text not null -> ); insert into t1 values (1,"lemon");
show binlog events ;
show binlog events in 'binlog.000002';
10.0.0.8 lemon2
[mysqld] user=mysql datadir=/data/mysql basedir=/usr/local/mysql port=3306 socket=/usr/local/mysql/s1.sock pid-file=/usr/local/mysql/mysql.pid log-error=/usr/local/mysql/error.log 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=ROW transaction_write_set_extraction=XXHASH64 loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" loose-group_replication_start_on_boot=off loose-group_replication_local_address="10.0.0.8:33061" loose-group_replication_group_seeds="10.0.0.7:33061,10.0.0.8:33061,10.0.0.9:33061" loose-group_replication_bootstrap_group=off
set global group_replication_allow_local_disjoint_gtids_join=ON;
vim /etc/hosts 10.0.0.7 lemon 10.0.0.8 lemon2 10.0.0.9 lemon3
select * from global_status where variable_name="group_replication_primary_member";
SELECT * FROM performance_schema.replication_group_members WHERE MEMBER_ID = (SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME= 'group_replication_primary_member');