Wednesday, April 2, 2014

Configuring and running MySQL Fabric 1.4.2

To install and run MySQL Fabric, we need:
  • Python 2.6 or 2.7
  • Connector Python (MySQL Fabric-aware Version 1.2.1 or later)
  • One or more MySQL servers installed and running (5.6.10 or later):
    • Backing Store
    • Managed Servers
  • MySQL Utilities 1.4.2 or later

Python 2.6 or 2.7

We can use the following command to check whether python is installed in our machine or not:

$ python --version

If you don't have the appropriate version installed, please, read through the following web page and find out how to download and install python 2.6 or 2.7:

MySQL 5.6

Information on how to download and install MySQL can be found at the following web page:


If MySQL is already installed, please, check its version through the following command:

$ mysqld --version

In this post, we assume that the installation provides access to the mysqltest framework.

Connector Python 1.2.1

On Unix-like systems such as Linux distributions, Solaris, Mac OS X, and FreeBSD, we can download Connector Python as a tar archive from:

To install Connector/Python from the .tar.gz file, download the latest version and follow these steps:

$ tar xvzf mysql-connector-python-1.2.1.tar
$ cd mysql-connector-python-1.2.1
$ sudo python install

Information on other platforms and other packages can be found also at the aforementioned link.

MySQL Utilities 1.4.2

On Unix-like systems such as Linux distributions, Solaris, Mac OS X, and FreeBSD, we can download MySQL Utilities which contains MySQL Fabric as a tar archive from:


$ tar xvzf mysql-utilities-1.4.2.tar.gz
$ cd mysql-utilities-1.4.2
$ sudo python install

Information on other platforms and other packages can be found also at the aforementioned link.

Configuring MySQL Fabric

Now that all components required to run MySQL Fabric are installed, we can configure MySQL Fabric and run it. The first step consists in running two or more MySQL servers which will be used as a backing store and instances managed by MySQL Fabric.
In order to ease the presentation and avoid cluttering it with too many details, we assume that the mysqltest framework is installed and exploit it to start several MySQL servers. Note though this is used to offer a sneak peek at MySQL Fabric and should never be used in production.

Create the suite/rpl/t/rpl_fabric_gtid.cnf file with the following content:

!include ../my.cnf




We can add as many entries as many MySQL severs are required to run our tests. In our very simple example, only two MySQL servers are necessary though.

Create a /rpl/t/rpl_fabric_gtid.test file with the following content:

--source include/

Then execute the following command to start a set of MySQL servers:

$ ./ rpl_fabric_gtid --mem --start

From a different terminal, change the /usr/local/etc/mysql/fabric.cfg configuration file:

address = localhost:13000
user = root
password =
database = fabric

user = root
password =

address = localhost:32274
disable_authentication = yes
user= admin
password = adminpass
realm = MySQL Fabric

(Only the relevant information for this post is presented here)

Choose one of the MySQL servers as the backing store which is used to store metadata on shards and the servers being managed. The backing store's address can be found in the "storage" section along with the "user" and "password" that MySQL Fabric will use to access it. The user does not need to be "root" though. Any user with the following privileges is fine:

CREATE USER 'fabric'@'localhost' IDENTIFIED BY 'secret';
GRANT ALL ON fabric.* TO 'fabric'@'localhost';

See for further details on adding a user account. After configuring a user to access the backing store, we need to set up a user  to access the MySQL servers that will be managed by MySQL Fabric. This user does not need to be "root" either. Any user with the following privileges is fine:

GRANT ALL ON *.* TO 'fabric'@'localhost';
SET PASSWORD FOR 'fabric'@'localhost' = PASSWORD('secret');

Then we need to configure an address where MySQL Fabric will be listening to incoming requests to fetch and update information on shards, servers, etc. It is worth mentioning that MySQL Fabric provides an authentication mechanism to check whether users have the necessary privileges to fetch or update any information. However, we will disable it in order to avoid cluttering the post with too much information and revisit this specific feature in another post. So after changing the necessary options in the configuration file, we are ready to set up the backing store:

$ mysqlfabric manage setup

Running MySQL Fabric

To run MySQL Fabric, execute the following command:

$ mysqlfabric manage start

Now that MySQL Fabric is up and running, we can start playing with it. MySQL Fabric organizes servers into high-availability groups. Currently, only the standard MySQL Replication is available.

In the following example, we create the "my_group" group and add the "localhost:13001" to it.

$ mysqlfabric group create my_group
$ mysqlfabric group add localhost:13001

We can execute the following commands to get some help on the mysqlfabric command-line utility:

$ mysqlfabric help commands
$ mysqlfabric help groups
$ mysqlfabric help group-command command

The "mysqlfabric help commands" list all commands available. Commands in MySQL Fabric are organized in groups and "mysqlfabric help groups" can be used to list all groups available. Finally, to print detailed information on a command, we can use "mysqlfabric help group-command command" where "group-command" and "command" must be substitute for the real group's name and command's name, respectively.

1 comment:

amala amala said...

Thank you for sharing such a nice and interesting blog with us. I have seen that all will say the same thing repeatedly. But in your blog, I had a chance to get some useful and unique information. I would like to suggest your blog in my dude circle.
Jobs in Chennai
Jobs in Bangalore
Jobs in Delhi
Jobs in Hyderabad
Jobs in Kolkata
Jobs in Mumbai
Jobs in Noida
Jobs in Pune