最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

MySQL-group-replication 配置步驟(推薦)

 更新時(shí)間:2017年03月19日 19:38:14   投稿:jingxian  
下面小編就為大家?guī)?lái)一篇MySQL-group-replication 配置步驟(推薦)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧

MySQL-Group-Replication 是mysql-5.7.17版本開(kāi)發(fā)出來(lái)的新特性;它在master-slave 之間實(shí)現(xiàn)了強(qiáng)一致性,

但是就目前來(lái)說(shuō)主要是性能不太好。

【1】確定當(dāng)前的mysql數(shù)據(jù)庫(kù)版本為5.7.17及以上

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

【2】實(shí)驗(yàn)環(huán)境為一臺(tái)主機(jī)上安裝3臺(tái)mysql,它們?nèi)齻€(gè)組成一個(gè)group-replication 組

/tmp/4406.cnf 內(nèi)容如下:

[mysqld]
####: for global
user          =jianglexing          #  mysql
basedir          =/usr/local/mysql        #  /usr/local/mysql/
datadir          =/tmp/4406/          #  /usr/local/mysql/data
server_id        =4406            #  0
port          =4406            #  3306
socket          =/tmp/4406/mysql.sock        #  /tmp/mysql.sock
auto_increment_increment    =1            #  1
auto_increment_offset      =1            #  1
lower_case_table_names      =1            #  0
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      =4            #  0
binlog_cache_size      =32768            #  32768(32k)
binlog_checksum        =none            #  CRC32
sync_binlog        =1            #  1


####: 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    =2            #  2
innodb_log_file_size      =48M            #  50331648(48M)
innodb_file_format      =Barracuda          #  Barracuda
innodb_file_per_table      =on             #  on
innodb_page_size      =16k            #  16384(16k)
innodb_thread_concurrency    =0            #  0
innodb_read_io_threads      =4            #  4
innodb_write_io_threads      =4            #  4
innodb_purge_threads      =4            #  4
innodb_print_all_deadlocks    =on            #  off
innodb_deadlock_detect      =on            #  on
innodb_lock_wait_timeout    =50            #  50
innodb_spin_wait_delay      =6            #  6
innodb_autoinc_lock_mode    =2            #  1
innodb_stats_persistent      =on            #  on
innodb_stats_persistent_sample_pages  =20            #  20
innodb_adaptive_hash_index    =on            #  on
innodb_change_buffering      =all            #  all
innodb_change_buffer_max_size    =25            #  25
innodb_flush_neighbors      =1            #  1
innodb_flush_method      =O_DIRECT          #  
innodb_doublewrite      =on            #  on
innodb_log_buffer_size      =16M            #  16777216(16M)
innodb_flush_log_at_timeout    =1            #  1
innodb_flush_log_at_trx_commit    =1            #  1
autocommit        =1            #  1

[client]
auto-rehash

/tmp/5506.cnf 內(nèi)容如下:

 

[mysqld]
####: for global
user          =jianglexing          #  mysql
basedir          =/usr/local/mysql        #  /usr/local/mysql/
datadir          =/tmp/5506        #  /usr/local/mysql/data
server_id        =5506            #  0
port          =5506            #  3306
socket          =/tmp/5506/mysql.sock        #  /tmp/mysql.sock
auto_increment_increment    =1            #  1
auto_increment_offset      =1            #  1
lower_case_table_names      =1            #  0
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      =4            #  0
binlog_cache_size      =32768            #  32768(32k)
binlog_checksum        =none            #  CRC32
sync_binlog        =1            #  1


####: 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    =2            #  2
innodb_log_file_size      =48M            #  50331648(48M)
innodb_file_format      =Barracuda          #  Barracuda
innodb_file_per_table      =on             #  on
innodb_page_size      =16k            #  16384(16k)
innodb_thread_concurrency    =0            #  0
innodb_read_io_threads      =4            #  4
innodb_write_io_threads      =4            #  4
innodb_purge_threads      =4            #  4
innodb_print_all_deadlocks    =on            #  off
innodb_deadlock_detect      =on            #  on
innodb_lock_wait_timeout    =50            #  50
innodb_spin_wait_delay      =6            #  6
innodb_autoinc_lock_mode    =2            #  1
innodb_stats_persistent      =on            #  on
innodb_stats_persistent_sample_pages  =20            #  20
innodb_adaptive_hash_index    =on            #  on
innodb_change_buffering      =all            #  all
innodb_change_buffer_max_size    =25            #  25
innodb_flush_neighbors      =1            #  1
innodb_flush_method      =O_DIRECT          #  
innodb_doublewrite      =on            #  on
innodb_log_buffer_size      =16M            #  16777216(16M)
innodb_flush_log_at_timeout    =1            #  1
innodb_flush_log_at_trx_commit    =1            #  1
autocommit        =1            #  1

 /tmp/6606.cnf 內(nèi)容如下:

[mysqld]
####: for global
user          =jianglexing          #  mysql
basedir          =/usr/local/mysql        #  /usr/local/mysql/
datadir          =/tmp/6606/        #  /usr/local/mysql/data
server_id        =6606            #  0
port          =6606            #  3306
socket          =/tmp/6606/mysql.sock        #  /tmp/mysql.sock
auto_increment_increment    =1            #  1
auto_increment_offset      =1            #  1
lower_case_table_names      =1            #  0
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      =4            #  0
binlog_cache_size      =32768            #  32768(32k)
binlog_checksum        =none            #  CRC32
sync_binlog        =1            #  1


####: 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    =2            #  2
innodb_log_file_size      =48M            #  50331648(48M)
innodb_file_format      =Barracuda          #  Barracuda
innodb_file_per_table      =on             #  on
innodb_page_size      =16k            #  16384(16k)
innodb_thread_concurrency    =0            #  0
innodb_read_io_threads      =4            #  4
innodb_write_io_threads      =4            #  4
innodb_purge_threads      =4            #  4
innodb_print_all_deadlocks    =on            #  off
innodb_deadlock_detect      =on            #  on
innodb_lock_wait_timeout    =50            #  50
innodb_spin_wait_delay      =6            #  6
innodb_autoinc_lock_mode    =2            #  1
innodb_stats_persistent      =on            #  on
innodb_stats_persistent_sample_pages  =20            #  20
innodb_adaptive_hash_index    =on            #  on
innodb_change_buffering      =all            #  all
innodb_change_buffer_max_size    =25            #  25
innodb_flush_neighbors      =1            #  1
innodb_flush_method      =O_DIRECT          #  
innodb_doublewrite      =on            #  on
innodb_log_buffer_size      =16M            #  16777216(16M)
innodb_flush_log_at_timeout    =1            #  1
innodb_flush_log_at_trx_commit    =1            #  1
autocommit        =1            #  1

【3】初始化三個(gè)數(shù)據(jù)庫(kù)實(shí)例

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

./bin/mysqld --defautls-file=/tmp/5506.cnf --datadir=/tmp/5506 --initialize-insecrue

./bin/mysqld --defautls-file=/tmp/6606.cnf --datadir=/tmp/6606 --initialize-insecrue

【4】配置group-replication 的初始實(shí)例

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

-- 增加用戶
    set sql_log_bin=0;
    create user rpl_user@'%' identified by '123456';
    grant replication slave,replication client on *.* to rpl_user@'%';
    create user rpl_user@'127.0.0.1' identified by '123456';
    grant replication slave,replication client on *.* to rpl_user@'127.0.0.1';
    create user rpl_user@'localhost' identified by '123456';
    grant replication slave,replication client on *.* to rpl_user@'localhost';
    set sql_log_bin=1;

-- 增加復(fù)制憑證
    change master to 
      master_user='rpl_user',
      master_password='123456'
      for channel 'group_replication_recovery';

-- 安裝組復(fù)制物件
    install plugin group_replication soname 'group_replication.so';

-- 啟動(dòng)組復(fù)制
    set global group_replication_bootstrap_group=on;
    start group_replication;
    set global group_replication_bootstrap_group=off;

【5】5506 實(shí)例的配置過(guò)程如下:

/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 '123456';
    grant replication slave,replication client on *.* to rpl_user@'%';
    create user rpl_user@'127.0.0.1' identified by '123456';
    grant replication slave,replication client on *.* to rpl_user@'127.0.0.1';
    create user rpl_user@'localhost' identified by '123456';
    grant replication slave,replication client on *.* to rpl_user@'localhost';
    set sql_log_bin=1;

-- 增加復(fù)制憑證
    change master to 
      master_user='rpl_user',
      master_password='123456'
      for channel 'group_replication_recovery';

-- 安裝組復(fù)制物件
    install plugin group_replication soname 'group_replication.so';

-- 啟動(dòng)組復(fù)制
    start group_replication; # 注意這里不是初始化了,只要加入就行

【6】6606 實(shí)例的操作與5506的操作一樣,這樣group replication 的配置就完成了。

以上這篇MySQL-group-replication 配置步驟(推薦)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Mysql數(shù)據(jù)庫(kù)的一些命令

    Mysql數(shù)據(jù)庫(kù)的一些命令

    如果你習(xí)慣用 windows 的數(shù)據(jù)庫(kù),也就是在 圖形界面上操作數(shù)據(jù)庫(kù)的話,那么當(dāng)你在命令上 操作 mysql 將會(huì)感到陌生,其實(shí)只要你掌握了一些基本命令,還有經(jīng)常使用,熟練起來(lái)了, 將會(huì)相當(dāng)方便,而且很快速
    2013-11-11
  • MySQL數(shù)據(jù)庫(kù)所在服務(wù)器磁盤滿了的故障分析和解決方法

    MySQL數(shù)據(jù)庫(kù)所在服務(wù)器磁盤滿了的故障分析和解決方法

    這篇文章主要給大家介紹了MySQL數(shù)據(jù)庫(kù)所在服務(wù)器磁盤滿了的故障分析和解決方法,文中通過(guò)代碼示例給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下
    2024-02-02
  • Centos 6.4源碼安裝mysql-5.6.28.tar.gz教程

    Centos 6.4源碼安裝mysql-5.6.28.tar.gz教程

    這篇文章主要為大家詳細(xì)介紹了Centos 6.4源碼安裝mysql-5.6.28.tar.gz教程,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-01-01
  • MySQL查詢性能優(yōu)化索引下推

    MySQL查詢性能優(yōu)化索引下推

    這篇文章主要介紹了MySQL查詢性能優(yōu)化索引下推,文章圍繞主題展開(kāi)詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下,希望對(duì)你的學(xué)習(xí)有所幫助
    2022-08-08
  • MySQL允許遠(yuǎn)程登錄的操作實(shí)現(xiàn)

    MySQL允許遠(yuǎn)程登錄的操作實(shí)現(xiàn)

    本文主要介紹了MySQL允許遠(yuǎn)程登錄的操作實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2025-02-02
  • 高效利用mysql索引指南

    高效利用mysql索引指南

    這篇文章主要介紹了高效利用mysql索引指南,你知道如何創(chuàng)建恰當(dāng)?shù)乃饕龁??在?shù)據(jù)量小的時(shí)候,不合適的索引對(duì)性能并不會(huì)有太大的影響,但是當(dāng)數(shù)據(jù)逐漸增大時(shí),性能便會(huì)急劇的下降。,需要的朋友可以參考下
    2019-06-06
  • MySQL錯(cuò)誤代碼大全

    MySQL錯(cuò)誤代碼大全

    本章列出了當(dāng)你用任何主機(jī)語(yǔ)言調(diào)用MySQL時(shí)可能出現(xiàn)的錯(cuò)誤。首先列出了服務(wù)器錯(cuò)誤消息。其次列出了客戶端程序消息
    2014-01-01
  • mysql一對(duì)多關(guān)聯(lián)查詢分頁(yè)錯(cuò)誤問(wèn)題的解決方法

    mysql一對(duì)多關(guān)聯(lián)查詢分頁(yè)錯(cuò)誤問(wèn)題的解決方法

    這篇文章主要介紹了mysql一對(duì)多關(guān)聯(lián)查詢分頁(yè)錯(cuò)誤問(wèn)題的解決方法,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-09-09
  • mysql 啟動(dòng)錯(cuò)誤1067 問(wèn)題及解決方法

    mysql 啟動(dòng)錯(cuò)誤1067 問(wèn)題及解決方法

    這篇文章主要介紹了mysql 啟動(dòng)錯(cuò)誤1067 問(wèn)題及解決方法的相關(guān)資料,需要的朋友可以參考下
    2016-11-11
  • MySQL主從復(fù)制不一致的原因分析以及解決

    MySQL主從復(fù)制不一致的原因分析以及解決

    這篇文章主要介紹了MySQL主從復(fù)制不一致的原因分析以及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12

最新評(píng)論

伊吾县| 息烽县| 孟连| 宾阳县| 天祝| 平顺县| 津南区| 班戈县| 东源县| 大方县| 黄平县| 老河口市| 陕西省| 汉中市| 正宁县| 略阳县| 兰西县| 边坝县| 延吉市| 玉龙| 北海市| 巨野县| 江都市| 轮台县| 平昌县| 邵武市| 镇康县| 青州市| 南充市| 青铜峡市| 锡林浩特市| 河北省| 惠水县| 临泽县| 成武县| 泸州市| 准格尔旗| 湘乡市| 江安县| 富源县| 高台县|