Mysql:fabric to build Ha

Source: Internet
Author: User
Tags create index log mysql client

After you build your fabric, you can create HA group, Shard Group, Ha+shard group, and so on, based on it. Here to explain how to quickly build the 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 has been built, you can ignore this step. If there is no build can refer to the previous instructions.

2, prepare 3 managed MySQL Instance

1 Create 3 MySQL instances

The creation of an instance can refer to related articles.

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

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

Authorization to retain permission descriptions in documents that have at least the previous fabric.

Of course, it can also be granted directly to the ownership limit:

Grant all privileges in *.* to ' fabric ' @ '% ' identified by ' YourPassword ';

Flush privileges;

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

Gtid_mode=on

Log-bin

Log-slave-updates

Enforce-gtid-consistency

Server_id=1//Each instance of this configuration item is different

4 Restart 3 MySQL instances.

3. Configure instance access on Fabric

The description of the Fabric configuration file Fabric.cfg can refer to:

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

The main point here is to ensure that the user name configured in the [Server] zone in FABRIC.CFG is consistent with the users of each instance.

4, the MySQL instance into the management of fabric

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.

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

In selecting the master instance, there are two scenarios: 1 automatically selected, and 2 is specified.

Automatically select one:

Mysqlfabric Group Promote Ha_group

Specify a:

Mysqlfabric Server Promote Ha_group--slave_id=192.168.2.234:33061

5, testing

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

Url:http://www.cnblogs.com/f1194361820/p/6234806.html

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.