文章目录
  
  1、安装mysql
  
  2、修改配置文件:
  
  3、安装group_replicatin插件,启动group_replication
  
  4、添加节点node-02 node-03:
  
  有关复制组的相关原理介绍:http://note.youdao.com/noteshare?id=9eb41d6de1af00e41314297282a43bc1
  
  环境:
  
  ip hostname
  
  192…168.8.80 node-01
  
  192…168.8.81 node-02
  
  192…168.8.83 node-03
  
  1、安装mysql
  
  [root@mysql]# yum install http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm
  
  [root@mysql]# yum -y install Percona-Server-server-57
  
  [root@mysql]# cat /var/log/mysqld.log |grep "root@localhost"
  
  2018-11-02T05:41:32.373113Z 1 [Note] A temporary password is generated for root@localhost: m-3SAGso6w43
  
  [root@mysql]# mysql -uroot -pm-3SAGso6w43
  
  mysql> show variables like '%vali%';
  
  mysql> set global validate_password_length=4;
  
  mysql> alter user 'root'@'localhost' identified by 'root123';
  
  2、修改配置文件:
  
  my.cnf配置文件里修改参数: server-id、loose-group_replication_local_address
  
  [mysqld]
  
  pid-file=/var/run/mysqld/mysqld.pid
  
  log-error=/var/log/mysqld.log
  
  datadir=/var/lib/mysql
  
  socket=/var/lib/mysql/mysql.sock
  
  # Disabling symbolic-links is recommended to prevent assorted security risks
  
  symbolic-links=0
  
  # Settings user and group are ignored when systemd is used.
  
  # If you need to run mysqld under a different user or group,
  
  # customize your systemd unit file for mariadb according to the
  
  # instructions in http://fedoraproject.org/wiki/Systemd
  
  server-id = 101
  
  log-bin = master-bin
  
  log-bin-index = master-bin.index
  
  binlog_format = row
  
  gtid-mode = ON
  
  enforce-gtid-consistency = ON
  
  log-bin=mysql-bin
  
  log-slave-updates
  
  master_info_repository=TABLE
  
  relay_log_info_repository=TABLE
  
  binlog_checksum=NONE
  
  ## group replication 配置
  
  #如果server启动时尚未加载复制插件,group_replicaton 变量使用loose-前缀将指示server继续启动。
  
  transaction_write_set_extraction=XXHASH64 #表示server必须为每个事物收集写集合,并使用XXHASH64 哈希算法将其编码为散列。
  
  loose_group_replication_start_on_boot=OFF
  
  loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
  
  loose-group_replication_start_on_boot=off
  
  loose-group_replication_local_address="192..168.8.80:33061"
  
  loose-group_replication_group_seeds="192..168.8.80:33061,192..168.8.81:33061,192..168.8.83:33061"
  
  loose-group_replication_bootstrap_group= off
  
  loose-group_replication_single_primary_mode=FALSE
  
  loose-group_replication_enforce_update_everywhere_checks= TRUE
  
  loose-group_replication_ip_whitelist="192..168.8.80,192..168.8.81,192..168.8.83"
  
  [mysqld_safe]
  
  log-error=/var/log/mariadb/mariadb.log
  
  pid-file=/var/run/mariadb/mariadb.pid
  
  #
  
  # include all files from the config directory
  
  #
  
  !includedir /etc/my.cnf.d
  
  3、安装group_replicatin插件,启动group_replication
  
  [root@mysql]# mysql -uroot -proot123
  
  mysql> set sql_log_bin=0;
  
  mysql> grant replication slave on *.* to 'rep'@'%' identified by 'rep123';
  
  mysql> flush privileges;
  
  mysql> set sql_log_bin=1;
  
  mysql> change master to master_user=www.mcyllpt.com 'rep',master_password='rep123' for channel 'group_replication_recovery';
  
  mysql> install plugin group_replication soname 'group_replication.so';
  
  mysql> show plugins;
  
  +-----------------------------+----------+--------------------+----------------------+---------+
  
  | Name | Status | Type | Library | License |
  
  +-----------------------------+----------+--------------------+----------------------+---------+
  
  | group_replication | ACTIVE | GROUP REPLICATION | group_replication.so | GPL |
  
  +-----------------------------+----------+--------------------+----------------------+---------+
  
  mysql> set global group_replication_bootstrap_group=ON;
  
  mysql> start group_replication;
  
  mysql> set global group_replication_bootstrap_group=OFF;
  
  mysql> select * from performance_schema.replication_group_members;
  
  +---------------------------+--------------------------------------+---------------------+-------------+--------------+
  
  | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
  
  +---------------------------+--------------------------------------+---------------------+-------------+--------------+
  
  | group_replication_applier | f38e5798-de61-11e8-91e6-fa163e180951 | node-01 | 3306 | ONLINE |
  
  +---------------------------+--------------------------------------+---------------------+-------------+--------------+
  
  4、添加节点node-02 node-03:
  
  安装mysql、my.cnf 同上
  
  安装group_replicatin插件,启动group_replication
  
  mysql> set sql_log_bin=0;
  
  mysql> grant replication slave on www.xgll521.com *yongshiyule178.com.* to 'rep'@'%' identified by 'rep123';
  
  mysql> flush privileges;
  
  mysql> set sql_log_bin=1;
  
  mysql> change master to master_user='rep',master_password='rep123' for channel 'group_replication_recovery';
  
  mysql> set global group_replication_allow_local_disjoint_www.michenggw.com gtids_join=ON;
  
  mysql> start group_replication;
  
  mysql> select * from performance_www.yigouyule2.cn schema.replication_group_members;
  
  +---------------------------+--------------------------------------+---------------------+-------------+--------------+
  
  | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
  
  +---------------------------+--------------------------------------+---------------------+-------------+--------------+
  
  | group_replication_applier | 433cc62e-dd00-11e8-a653-fa163e4f3761 | node-03 | 3306 | ONLINE |
  
  | group_replication_applier | af4e8b5d-bc99-11e8-9ad1-fa163e230ff6 | node-02 | 3306 | ONLINE |
  
  | group_replication_applier | f38e5798-de61-11e8-91e6-fa163e180951 | node-01 | 3306 | ONLINE |
  
  +---------------------------+--------------------------------------+---------------------+-------------+-------------

mysql5.7 MRG集群部署学习的更多相关文章

  1. mysql5.7.25集群部署和方案设计(附PXC一键部署脚本)

    还记得我们之前部署mysql集群有多麻烦嘛?波哥来救你们啦!~ 我已将项目上传到了我的github仓库中,大家可以点击仓库地址出现的连接登录查看相应的代码!如果觉得不错别忘了转发.点赞哦! 部署步骤: ...

  2. k8s 集群部署--学习

    kubernetes是google开源的容器集群管理系统,提供应用部署.维护.扩展机制等功能,利用kubernetes能方便管理跨集群运行容器化的应用,简称:k8s(k与s之间有8个字母) Pod:若 ...

  3. Elasticsearch学习总结 (Centos7下Elasticsearch集群部署记录)

    一.  ElasticSearch简单介绍 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.Elasticse ...

  4. rocketmq学习(二) rocketmq集群部署与图形化控制台安装

    1.rocketmq图形化控制台安装 虽然rocketmq为用户提供了使用命令行管理主题.消费组以及broker配置的功能,但对于不够熟练的非运维人员来说,命令行的管理界面还是较难使用的.为此,我们可 ...

  5. Docker学习-Kubernetes - 集群部署

    Docker学习 Docker学习-VMware Workstation 本地多台虚拟机互通,主机网络互通搭建 Docker学习-Docker搭建Consul集群 Docker学习-简单的私有Dock ...

  6. Quartz学习笔记:集群部署&高可用

    Quartz学习笔记:集群部署&高可用 集群部署 一个Quartz集群中的每个节点是一个独立的Quartz应用,它又管理着其他的节点.这就意味着你必须对每个节点分别启动或停止.Quartz集群 ...

  7. Dubbo入门到精通学习笔记(二十):MyCat在MySQL主从复制的基础上实现读写分离、MyCat 集群部署(HAProxy + MyCat)、MyCat 高可用负载均衡集群Keepalived

    文章目录 MyCat在MySQL主从复制的基础上实现读写分离 一.环境 二.依赖课程 三.MyCat 介绍 ( MyCat 官网:http://mycat.org.cn/ ) 四.MyCat 的安装 ...

  8. Cassandra1.2文档学习(7)—— 规划集群部署

    数据参考:http://www.datastax.com/documentation/cassandra/1.2/webhelp/index.html#cassandra/architecture/a ...

  9. kafka学习总结之集群部署和zookeeper

    1.  集群部署 kafka集群的瓶颈主要在网络和磁盘上:kafka依赖于zookeeper,zookeeper集群的节点采用奇数个,3个节点允许一个节点失败,5个节点允许2个节点失败. 图 1 ka ...

随机推荐

  1. Xshell6破解

    链接: https://pan.baidu.com/s/1P9kMmGdLfpPPxEgUxNXrhw 提取码: s3js

  2. JavaScript之DOM查询

    DOM查询 - 通过具体的元素节点来查询 - 元素.getElementsByTagName() - 通过标签名查询当前元素的指定后代元素,返回数组 - 元素.childNodes - 获取当前元素的 ...

  3. Hibernate-ORM:04.Hibernate中的get()和load()

    ------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 本篇博客会讲如何用get()或load()查询单个对象和对缓存的简单操作,以及他俩的区别和相同(前面有的那些配 ...

  4. centos linux 因别名问题引起的麻烦及解决技巧

    老男孩儿-19期 L005-13节中分享.自己整理后发到自己微博中留档. 原文:http://oldboy.blog.51cto.com/2561410/699046 实例:老男孩linux实战培训第 ...

  5. Java Algorithm Problems

    Java Algorithm Problems 程序员的一天 从开始这个Github已经有将近两年时间, 很高兴这个repo可以帮到有需要的人. 我一直认为, 知识本身是无价的, 因此每逢闲暇, 我就 ...

  6. 教你用Bootstrap开发漂亮的前端界面

    Bootstrap介绍: Bootstrap 是最受欢迎的 HTML.CSS 和 JS 框架,用于开发响应式布局.移动设备优先的 WEB 项目. Bootstrap的特点: 一.预处理脚本:虽然可以直 ...

  7. C++怎么用二维数组作为形参传入

    原文地址:http://blog.csdn.net/xuleicsu/article/details/919801 如何将二维数组作为函数的参数传递 今天写程序的时候要用到二维数组作参数传给一个函数, ...

  8. 怎么使用pipenv管理你的python项目

    原文链接:https://robots.thoughtbot.com/how-to-manage-your-python-projects-with-pipenv 翻译者:Jiong 在thought ...

  9. bbbbbeta

    about beta 写在开头:(小声bb,无任何专业知识) 好了正文开始了 = = beta冲刺对于来说可能是让我觉得非常有成就感的叭,相比于alpha,每天都能写代码的感觉真好鸭(认真脸)(虽然天 ...

  10. vector sort AND 友元

    # include<iostream> # include<string> # include<algorithm> # include<stdio.h> ...