MySQL 45th article ~ Preliminary MGR

Source: Internet
Author: User
Tags uuid

A brief introduction: Mgr has not had time to test, today we come to the preliminary understanding constructs the Bai

Second environment: mysql5.7.20 single machine start three instances

Three MySQL Build:

1 Setting up related directories +

Mkdir-p/data/mysql/data_3306

Mkdir-p/data/mysql/data_3307

Mkdir-p/data/mysql/data_3308

2 Script Initialization

/usr/local/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql/ data_3306

/usr/local/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql/ data_3307
/usr/local/mysql/bin/mysqld--initialize-insecure--user=mysql--basedir=/usr/local/mysql--datadir=/data/mysql/ data_3308

3 Change Password

Mysql-uroot-s/tmp/mysql_3306.sock-e "Set password for ' root ' @ ' localhost ' = password (' test ');"

Mysql-uroot-ptest-s/tmp/mysql_3306.sock-e "Flush Privileges"

Mysql-uroot-s/tmp/mysql_3307.sock-e "Set password for ' root ' @ ' localhost ' = password (' test ');"
Mysql-uroot-ptest-s/tmp/mysql_3307.sock-e "Flush Privileges"

Mysql-uroot-s/tmp/mysql_3308.sock-e "Set password for ' root ' @ ' localhost ' = password (' test ');"
Mysql-uroot-ptest-s/tmp/mysql_3308.sock-e "Flush Privileges"

4 Start command

Nohup/usr/local/mysql/bin/mysqld_safe--DEFAULTS-FILE=/ETC/MY_3306.CNF &

Nohup/usr/local/mysql/bin/mysqld_safe--DEFAULTS-FILE=/ETC/MY_3307.CNF &
Nohup/usr/local/mysql/bin/mysqld_safe--DEFAULTS-FILE=/ETC/MY_3308.CNF &

Quad MGR Configuration

1 configuration file Additions

Gtid_mode = On

Enforce_gtid_consistency = On

Master_info_repository = TABLE
Relay_log_info_repository = TABLE
Binlog_checksum = NONE
Log_slave_updates = On
Transaction_write_set_extraction = XXHASH64
Loose-group_replication_group_name= "01e5fb97-be64-41f7-bafd-3afc7a6ab555"
Loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:13306"//except here different others are the same
Loose-group_replication_group_seeds= "127.0.0.1:13306,127.0.0.1:13307,127.0.0.1:13308"
Loose-group_replication_bootstrap_group = Off

2 Restart the service, create a copy account, respectively

Set sql_log_bin=0;

GRANT REPLICATION slave,replication CLIENT on * * to ' repl ' @ '% ' identified by ' repl ';
Flush privileges;
Set sql_log_bin=1;

3 Primary Node execution

Change Master to master_user= ' Repl ', master_password= ' repl ' 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;

4 Execution from node

Change Master to master_user= ' Repl ', master_password= ' repl ' for Channel ' group_replication_recovery ';
Install plugin group_replication soname ' group_replication.so ';
START group_replication;

5 Viewing status

SELECT * from Performance_schema.replication_group_members;

Three members are online and the building is successful

6 View Master Members

1 Select Variable_value from performance_schema.global_status where variable_name = ' group_replication_primary_member '  ; Get the main UUID

2 Select * from Performance_schema.replication_group_members; Determine primary based on UUID

7 Testing

1 Create a table with a primary key and insert the data (MGR schema the table must have a primary key)

2 See if other nodes have data

Five notes

This article is the first attempt of the single master Mgr and will continue to supplement

MySQL 45th article ~ Preliminary MGR

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.