MySQL-Group-Replication 是mysql-5.7.17版本开发出来的新特性;它在master-slave 之间实现了强一致性,

但是就目前来说主要是性能不太好。

【1】确定当前的mysql数据库版本为5.7.17及以上

/usr/local/mysql/bin/mysqld --version
/usr/local/mysql/bin/mysqld Ver 5.7. for linux-glibc2. on x86_64 (MySQL Community Server (GPL))

【2】实验环境为一台主机上安装3台mysql,它们三个组成一个group-replication 组

  /tmp/4406.cnf 内容如下:

[mysqld]
####: for global
user =jianglexing # mysql
basedir =/usr/local/mysql # /usr/local/mysql/
datadir =/tmp// # /usr/local/mysql/data
server_id = #
port = #
socket =/tmp//mysql.sock # /tmp/mysql.sock
auto_increment_increment = #
auto_increment_offset = #
lower_case_table_names = #
secure_file_priv = # null ####: for binlog
binlog_format =row # row
log_bin =mysql-bin # off
binlog_rows_query_log_events =on # off
log_slave_updates =on # off
expire_logs_days = #
binlog_cache_size = # (32k)
binlog_checksum =none # CRC32
sync_binlog = # ####: for error-log
log_error =mysql-err.log # /usr/local/mysql/data/localhost.localdomain.err ####: for slow query log ####: for gtid
gtid_mode =on # off
enforce_gtid_consistency =on # off ####: for replication
master_info_repository =table # file
relay_log_info_repository =table # file ####: for group replication
transaction_write_set_extraction =XXHASH64 # off
loose-group_replication_group_name ="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" #
loose-group_replication_start_on_boot =off # off
loose-group_replication_local_address ="127.0.0.1:24901" #
loose-group_replication_group_seeds ="127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group =off # off ####: for innodb
default_storage_engine =innodb # innodb
default_tmp_storage_engine =innodb # innodb
innodb_data_file_path =ibdata1:12M:autoextend # ibdata1:12M:autoextend
innodb_temp_data_file_path =ibtmp1:12M:autoextend # ibtmp1:12M:autoextend
innodb_log_group_home_dir =./ # ./
innodb_log_files_in_group = #
innodb_log_file_size =48M # (48M)
innodb_file_format =Barracuda # Barracuda
innodb_file_per_table =on # on
innodb_page_size =16k # (16k)
innodb_thread_concurrency = #
innodb_read_io_threads = #
innodb_write_io_threads = #
innodb_purge_threads = #
innodb_print_all_deadlocks =on # off
innodb_deadlock_detect =on # on
innodb_lock_wait_timeout = #
innodb_spin_wait_delay = #
innodb_autoinc_lock_mode = #
innodb_stats_persistent =on # on
innodb_stats_persistent_sample_pages = #
innodb_adaptive_hash_index =on # on
innodb_change_buffering =all # all
innodb_change_buffer_max_size = #
innodb_flush_neighbors = #
innodb_flush_method =O_DIRECT #
innodb_doublewrite =on # on
innodb_log_buffer_size =16M # (16M)
innodb_flush_log_at_timeout = #
innodb_flush_log_at_trx_commit = #
autocommit = # [client]
auto-rehash

  /tmp/5506.cnf 内容如下:

[mysqld]
####: for global
user =jianglexing # mysql
basedir =/usr/local/mysql # /usr/local/mysql/
datadir =/tmp/ # /usr/local/mysql/data
server_id = #
port = #
socket =/tmp//mysql.sock # /tmp/mysql.sock
auto_increment_increment = #
auto_increment_offset = #
lower_case_table_names = #
secure_file_priv = # null ####: for binlog
binlog_format =row # row
log_bin =mysql-bin # off
binlog_rows_query_log_events =on # off
log_slave_updates =on # off
expire_logs_days = #
binlog_cache_size = # (32k)
binlog_checksum =none # CRC32
sync_binlog = # ####: for error-log
log_error =mysql-err.log # /usr/local/mysql/data/localhost.localdomain.err ####: for slow query log ####: for gtid
gtid_mode =on # off
enforce_gtid_consistency =on # off ####: for replication
master_info_repository =table # file
relay_log_info_repository =table # file ####: for group replication
transaction_write_set_extraction =XXHASH64 # off
loose-group_replication_group_name ="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" #
loose-group_replication_start_on_boot =off # off
loose-group_replication_local_address ="127.0.0.1:24902" #
loose-group_replication_group_seeds ="127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group =off # off ####: for innodb
default_storage_engine =innodb # innodb
default_tmp_storage_engine =innodb # innodb
innodb_data_file_path =ibdata1:12M:autoextend # ibdata1:12M:autoextend
innodb_temp_data_file_path =ibtmp1:12M:autoextend # ibtmp1:12M:autoextend
innodb_log_group_home_dir =./ # ./
innodb_log_files_in_group = #
innodb_log_file_size =48M # (48M)
innodb_file_format =Barracuda # Barracuda
innodb_file_per_table =on # on
innodb_page_size =16k # (16k)
innodb_thread_concurrency = #
innodb_read_io_threads = #
innodb_write_io_threads = #
innodb_purge_threads = #
innodb_print_all_deadlocks =on # off
innodb_deadlock_detect =on # on
innodb_lock_wait_timeout = #
innodb_spin_wait_delay = #
innodb_autoinc_lock_mode = #
innodb_stats_persistent =on # on
innodb_stats_persistent_sample_pages = #
innodb_adaptive_hash_index =on # on
innodb_change_buffering =all # all
innodb_change_buffer_max_size = #
innodb_flush_neighbors = #
innodb_flush_method =O_DIRECT #
innodb_doublewrite =on # on
innodb_log_buffer_size =16M # (16M)
innodb_flush_log_at_timeout = #
innodb_flush_log_at_trx_commit = #
autocommit = #

  /tmp/6606.cnf 内容如下:

[mysqld]
####: for global
user =jianglexing # mysql
basedir =/usr/local/mysql # /usr/local/mysql/
datadir =/tmp// # /usr/local/mysql/data
server_id = #
port = #
socket =/tmp//mysql.sock # /tmp/mysql.sock
auto_increment_increment = #
auto_increment_offset = #
lower_case_table_names = #
secure_file_priv = # null ####: for binlog
binlog_format =row # row
log_bin =mysql-bin # off
binlog_rows_query_log_events =on # off
log_slave_updates =on # off
expire_logs_days = #
binlog_cache_size = # (32k)
binlog_checksum =none # CRC32
sync_binlog = # ####: for error-log
log_error =mysql-err.log # /usr/local/mysql/data/localhost.localdomain.err ####: for slow query log ####: for gtid
gtid_mode =on # off
enforce_gtid_consistency =on # off ####: for replication
master_info_repository =table # file
relay_log_info_repository =table # file ####: for group replication
transaction_write_set_extraction =XXHASH64 # off
loose-group_replication_group_name ="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" #
loose-group_replication_start_on_boot =off # off
loose-group_replication_local_address ="127.0.0.1:24903" #
loose-group_replication_group_seeds ="127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group =off # off ####: for innodb
default_storage_engine =innodb # innodb
default_tmp_storage_engine =innodb # innodb
innodb_data_file_path =ibdata1:12M:autoextend # ibdata1:12M:autoextend
innodb_temp_data_file_path =ibtmp1:12M:autoextend # ibtmp1:12M:autoextend
innodb_log_group_home_dir =./ # ./
innodb_log_files_in_group = #
innodb_log_file_size =48M # (48M)
innodb_file_format =Barracuda # Barracuda
innodb_file_per_table =on # on
innodb_page_size =16k # (16k)
innodb_thread_concurrency = #
innodb_read_io_threads = #
innodb_write_io_threads = #
innodb_purge_threads = #
innodb_print_all_deadlocks =on # off
innodb_deadlock_detect =on # on
innodb_lock_wait_timeout = #
innodb_spin_wait_delay = #
innodb_autoinc_lock_mode = #
innodb_stats_persistent =on # on
innodb_stats_persistent_sample_pages = #
innodb_adaptive_hash_index =on # on
innodb_change_buffering =all # all
innodb_change_buffer_max_size = #
innodb_flush_neighbors = #
innodb_flush_method =O_DIRECT #
innodb_doublewrite =on # on
innodb_log_buffer_size =16M # (16M)
innodb_flush_log_at_timeout = #
innodb_flush_log_at_trx_commit = #
autocommit = #

【3】初始化三个数据库实例

cd /usr/local/mysql/
./bin/mysqld --defautls-file=/tmp/.cnf --datadir=/tmp/ --initialize-insecrue ./bin/mysqld --defautls-file=/tmp/.cnf --datadir=/tmp/ --initialize-insecrue ./bin/mysqld --defautls-file=/tmp/.cnf --datadir=/tmp/ --initialize-insecrue

【4】配置group-replication 的初始实例

/usr/local/mysql/bin/mysqld --defaults-file=/tmp/.cnf &
mysql -h127.0.0.1 -uroot -P4406

-- 增加用户
set sql_log_bin=0;
create user rpl_user@'%' identified by '';
grant replication slave,replication client on *.* to rpl_user@'%';
create user rpl_user@'127.0.0.1' identified by '';
grant replication slave,replication client on *.* to rpl_user@'127.0.0.1';
create user rpl_user@'localhost' identified by '';
grant replication slave,replication client on *.* to rpl_user@'localhost';
set sql_log_bin=1; -- 增加复制凭证
change master to
master_user='rpl_user',
master_password=''
for channel 'group_replication_recovery'; -- 安装组复制物件
install plugin group_replication soname 'group_replication.so'; -- 启动组复制
set global group_replication_bootstrap_group=on;
start group_replication;
set global group_replication_bootstrap_group=off;

【5】5506 实例的配置过程如下:

/usr/local/mysql/bin/mysqld --defaults-file=/tmp/5506.cnf &
 mysql -h127.0.0.1 -uroot -P5506

-- 增加用户
set sql_log_bin=0;
create user rpl_user@'%' identified by '';
grant replication slave,replication client on *.* to rpl_user@'%';
create user rpl_user@'127.0.0.1' identified by '';
grant replication slave,replication client on *.* to rpl_user@'127.0.0.1';
create user rpl_user@'localhost' identified by '';
grant replication slave,replication client on *.* to rpl_user@'localhost';
set sql_log_bin=1; -- 增加复制凭证
change master to
master_user='rpl_user',
master_password=''
for channel 'group_replication_recovery'; -- 安装组复制物件
install plugin group_replication soname 'group_replication.so'; -- 启动组复制
start group_replication; # 注意这里不是初始化了,只要加入就行

【6】6606 实例的操作与5506的操作一样,这样group replication 的配置就完成了。

-----------

MySQL-group-replication 配置的更多相关文章

  1. MySQL Group Replication配置

    MySQL Group Replication简述 MySQL 组复制实现了基于复制协议的多主更新(单主模式). 复制组由多个 server成员构成,并且组中的每个 server 成员可以独立地执行事 ...

  2. Mysql Group Replication 简介及单主模式组复制配置【转】

    一 Mysql Group Replication简介    Mysql Group Replication(MGR)是一个全新的高可用和高扩张的MySQL集群服务.    高一致性,基于原生复制及p ...

  3. mysql group replication 安装&配置详解

    一.原起: 之前也有写过mysql-group-replication (mgr) 相关的文章.那时也没有什么特别的动力要写好它.主要是因为在 mysql-5.7.20 之前的版本的mgr都有着各种各 ...

  4. MySQL Group Replication 技术点

    mysql group replication,组复制,提供了多写(multi-master update)的特性,增强了原有的mysql的高可用架构.mysql group replication基 ...

  5. 细细探究MySQL Group Replicaiton — 配置维护故障处理全集

             本文主要描述 MySQL Group Replication的简易原理.搭建过程以及故障维护管理内容.由于是新技术,未在生产环境使用过,本文均是虚拟机测试,可能存在考虑不周跟思路有误 ...

  6. MySQL Group Replication 动态添加成员节点

    前提: MySQL GR 3节点(node1.node2.node3)部署成功,模式定为多主模式,单主模式也是一样的处理. 在线修改已有GR节点配置 分别登陆node1.node2.node3,执行以 ...

  7. Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication

    Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication Overview Galera Cluster 由 Coders ...

  8. Mysql 5.7 基于组复制(MySQL Group Replication) - 运维小结

    之前介绍了Mysq主从同步的异步复制(默认模式).半同步复制.基于GTID复制.基于组提交和并行复制 (解决同步延迟),下面简单说下Mysql基于组复制(MySQL Group Replication ...

  9. 细细探究MySQL Group Replicaiton — 配置维护故障处理全集(转)

    如果转载,请注明博文来源: www.cnblogs.com/xinysu/   ,版权归 博客园 苏家小萝卜 所有.望各位支持! 

  10. MySQL group replication介绍

    “MySQL group replication” group replication是MySQL官方开发的一个开源插件,是实现MySQL高可用集群的一个工具.第一个GA版本正式发布于MySQL5.7 ...

随机推荐

  1. [转]Spring MVC 事务配置

    Spring MVC事务配置 要了解事务配置的所有方法,请看一下<Spring事务配置的5种方法> 本文介绍两种配置方法:  <tx:advice/>就是告诉事务管理器:怎么做 ...

  2. 通过简单的SSH隧道实现穿越上网(转)

    说明:很惊讶,原来强大的SSH也能实现穿越上网,且配置真的很简单,比OpenVPN简单很多.当然,除了代理简单上网之外,其余功能就没OpenVPN那么的强大,对于用哪个就需要自己去衡量.SSH建立的隧 ...

  3. 未能加载文件或程序集“System.Web.Razor 2.0.0 or system.web.webpages.razor 2.0.0

    出现这种问题,有两种情况: 一.bin目录下没有相应的dll,可以将相应dll拷贝至bin目录或者设置相关dll的属性“复制到本地”:true 二.如果是高于Visual Studio2013版本的开 ...

  4. uboot如何检测XC2440是从Nand或Nor启动

    转:http://blog.chinaunix.net/uid-22030783-id-3347621.html 在XC2440开发板上做uboot从nandflash启动时,需要检测硬件启动方式,启 ...

  5. ENVI裁剪

    一.basic tools-->resize data进行规则裁剪 虽然是进行图像重采样工具,但也可以用于简单快速的裁剪 1. 选中要裁剪的图像: 对话框下面选择spatial subset(构 ...

  6. Java 8:不要再用循环了 Stream替代for循环

    原文:http://www.importnew.com/14841.html 在这篇文章里,我们将会去了解传统循环的一些替代方案.在Java 8的新功能特性中,最棒的特性就是允许我们去表达我们想要完成 ...

  7. okHttp,greenDao,EventBus组合框架项目中实战

    okHttp,greenDao,EventBus组合封装 zzyandroid 介绍 开门见山,大体思路是在Activity中启动服务,通过服务创建Http请求,请求处理结果通过EventBus通知前 ...

  8. SQL 的四种分类 DDL,DML,DCL,TCL

    DDL (数据定义问题) 数据定义语言 - Data Definition Language 用来定义数据库的对象,如数据表.视图.索引等DDL不需要commit.CREATEALTERDROPTRU ...

  9. 二.Consumer、Producer简单例子

    1.先导入jar包,我使用的是maven <dependency> <groupId>com.alibaba.rocketmq</groupId> <arti ...

  10. delphi 自定义内存管理

    1.主要通过GetMemoryManager来hook原来的内存管理. 2.通过SetMemoryManager来设置你自己的新的内存管理,可以用一个内存池来优化和管理程序的内存调用情况. proce ...