规划
Mysql Gtid主从配置
https://blog.51cto.com/9025736/2500516
consul集群搭建
https://blog.51cto.com/9025736/2500976
创建mysql用户并授权(mysql服务器需要授权)
MySQL [(none)]> grant all on *.* to 'han'@'%' identified by 'hanye131';
MySQL [(none)]> flush privileges;
配置consul (consul client端 server3 和server4)
[root@server4 consul.d]# cd /etc/consul.d
[root@server4 consul.d]# cat mysql-write.json
{
"services": [
{
"name": "mysql-master",
"tags": [
"mysql-179"
],
"address": "192.168.31.179",
"port": 3306,
"checks": [