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