Mysql:fabric Build HA

Source: Internet
Author: User

After building the fabric, you can create HA group, Shard Group, Ha+shard group, etc. on its basis. Here's how to quickly build an HA environment.

Fabric

192.168.2.234:33060

Master

192.168.2.234:33061

Slave1

192.168.2.234:33062

Slave2

192.168.2.234:33063

1 , Build Fabric Environment

If it is, you can ignore this step. If there is no build, refer to the previous instructions.

2 , Prepare 3 a Managed MySQL Example

1) Create 3 instances of MySQL

The creation of the instance can be referred to related articles.

2) Create a user on 3 MySQL instances and authorize it.

The user created is to be consistent with the user configured in the [Server] zone in Fabric.cfg.

Authorization to keep at least the permission description in the document of the previous fabric.

Of course, you can also directly grant the ownership limit:

Grant all privileges on * * to ' fabric ' @ ' percent ' identified by ' YourPassword ';

Flush privileges;

3) Add the necessary configuration items to the my.cnf of the 3 MySQL instances:

Gtid_mode=on

Log-bin

Log-slave-updates

Enforce-gtid-consistency

Server_id=1//Different instances of this configuration item are not the same

4) Restart 3 MySQL instances.

3 , in the Fabric on the Configure instance access

A description of the Fabric configuration file fabric.cfg can be found in:

Http://dev.mysql.com/doc/mysql-utilities/1.5/en/fabric-cfgref.html

The main thing here is to ensure that the user name configured for the [server] zone in FABRIC.CFG is consistent with the user for each instance.

4 , the MySQL instance into Fabric the management

1) Create a group:

Mysqlfabric Group Create Ha_group

2) Add MySQL to the group:

mysqlfabric group add ha_group 192.168.2.234:33061
mysqlfabric group add ha_group 192.168.2.234:33062
mysqlfabric group add ha_group 192.168.2.234:33063

3) Select a master instance.

Upon completion of the 2nd, all instances are secondary (i.e. slave),

In selecting the master instance, there are two scenarios: 1 auto-selection, and 2 to specify one.

Automatically select one:

Mysqlfabric Group Promote Ha_group

Specify one:

Mysqlfabric Server Set_status 192.168.2.234:33061 Primary

5 , Test

Use the MySQL client tool, such as Navicat, to connect to these 3 instances, create tables, create INDEX, insert data on the connection to master. As you can see, the other two instances are also automatically synchronized.

Mysql:fabric Build HA

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.