Docker部署MySQL8 MGR

  • 时间:
  • 浏览:1
  • 来源:大发PK10APP下载_大发PK10APP官方

server_id = 2loose-group_replication_local_address= "172.17.0.8:360 61"hosts文件记得加入映射

最近想试试用docker部署一套MySQL8的MGR多主,按照官方文档搞了好几天不成功,网上大主次是基于5.7安装的,这麼参考意义价值。人太好有这些是基于8版本的否则 配置文件都在对,这里就不喷了。所以有这篇文章是当时人的另另一一两个 经验总结,也希望能帮助在MySQL8.0.3版本以上(为哪些说8.0.3,底下会提到,嘿嘿)部署MGR的这些人儿(无论单主还是多主模式)。人太好我以前成功配置过MySQL5.7的单主和多主,否则 和8还是有一定区别的。本文宿主机系统版本是CentOS7.3,MySQL最新稳定版8.0.12为主。

前期准备工作:

运行另另一一两个 test名称的容器

docker run -d -it --name test centos

进入容器安装MySQL

docker exec -it test bash执行如下安装命令

set global group_replication_single_primary_mode=FALSE;set global group_replication_enforce_update_everywhere_checks=TRUE;

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

stop group_replication;set global group_replication_recovery_get_public_key=ON;start group_replication;

mysql -u root -p"qpzsd24a5l;E"mysql第一次须要修改密码

docker run -d -it --privileged --name=mysql-mgr-node1 mysql8.0.12 /usr/sbin/initdocker run -d -it --privileged --name=mysql-mgr-node2 mysql8.0.12 /usr/sbin/initdocker run -d -it --privileged --name=mysql-mgr-node3 mysql8.0.12 /usr/sbin/init执行成功后还能否 进去容器查看MySQL服务自动启动了,这点我须要人太好很糙好奇~~~有知道的这些人儿欢迎留言。

systemctl restart mysqld进入mysql修改密码及mgr配置,命令和mysql-mgr-node2节点一模一样

server_id = 3loose-group_replication_local_address= "172.17.0.9:360 61"同样hosts文件记得加入映射

transaction_write_set_extraction = XXHASH64

loose-group_replication_group_name = 'ce9be252-2b71-11e6-b8f4-00212844f856'

loose-group_replication_start_on_boot = off

loose-group_replication_local_address= "172.17.0.7:360 61"

loose-group_replication_group_seeds= "172.17.0.7:360 61,172.17.0.8:360 61,172.17.0.9:360 61"

loose-group_replication_bootstrap_group = off

重启mysql服务

systemctl restart mysqld查看/var/log/mysqld.log底下会有另另一一两个 临时的密码用于登录mysql服务器

1)2018-09-14T06:18:04.866248Z 0 [ERROR] [MY-011526] [Repl] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: fc283fd2-b7e0-11e8-bde9-0242ac160 09:1 > Group transactions: ce9be252-2b71-11e6-b8f4-00212844f856:1-2'

2018-09-14T06:18:04.866384Z 0 [ERROR] [MY-011522] [Repl] Plugin group_replication reported: 'The member contains transactions not present in the group. The member will now exit the group.'

所有节点重启MySQL服务,否则 执行

reset master;配置第另另一一两个 引导组的MySQL节点后,添加入第两个MySQL节点到组群克隆。

alter user 'root'@'localhost' identified by 'Bdqn@123';刚开始配置mgr组群克隆

systemctl restart mysqld进入mysql修改密码及mgr配置

yum install yum-utils wget -ywget https://dev.mysql.com/get/mysql60 -community-release-el7-1.noarch.rpmrpm -ivh mysql60 -community-release-el7-1.noarch.rpmyum install mysql-server –y安装完成后直接退出容器,不须要启动。否则 运行如下命令生成镜像

server_id = 1

gtid_mode = ON

enforce_gtid_consistency = ON

binlog_checksum = NONE

cat /etc/my.cnf[mysqld]

docker commit 容器ID mysql8.0.12使用docker images还能否 进行查看