一、准备工作
准备至少三台Linux系统的主机
主机 | 系统 |
---|---|
192.168.2.143 | centos7 |
192.168.2.144 | centos7 |
192.168.2.145 | centos7 |
说明:以下操作如未单独说明,就需要在每台节点主机上执行
二、安装mysql8
- 1、安装
[root@mysql143 ~]# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
[root@mysql143 ~]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
[root@mysql143 ~]# yum install -y mysql-community-server
[root@mysql143 ~]# vim /etc/my.cnf
将下列写入配置文件,注意这里的server_id每台主机不能一样,loose-group_replication_group_name这个通过uuid生成,loose-group_replication_local_address和report_host填写每台主叫自己的ip地址
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
pid-file=/var/run/mysqld/mysqld.pid
port=3306
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
log-error = /var/log/mysqld.log
transaction_write_set_extraction=XXHASH64
transaction-isolation=READ-COMMITTED
loose-group_replication_group_name ="f8c4f4a4-9d9a-4a10-8c86-7f3c1e4605a5"
loose-group_replication_start_on_boot=OFF
loose-group_replication_local_address= "192.168.2.143:33061"
loose-group_replication_group_seeds= "192.168.2.143:33061,192.168.2.144:33061,192.168.2.145:33061"
loose-group_replication_bootstrap_group=OFF
report_host=192.168.2.143
report_port=330