Saturday, 18 April 2015

MySQL Fabric - Part 1

Every now and againg life is strange, let me explain why.

As I have already said, this year I got a new job and what's more with the new company I came to the agreement to administer the following databases : Oracle and Sybase.

Since I haven't ever worked with sybase it's been hard and what's more challenging.

I was sure I would have had lots of stuff to do when I decided to take on this new job.

By the way I wasn't afraid about that instead I was disappointed only not to have been able to working with MySQL.

However, a new opportunity came up which made it possible to use MySQL again. So I'm here once more writing about MySQL.

Let's start with a new MySQL topic, shall we ?


How to install MySQL Fabric

First of all I'm going to explain what MySQL Fabric is and what's more how we can add High availability to our MySQL servers.

MySQL Fabric is an extensible framework for managing farms of MySQL servers.

For example these farms can be made up by :
  • One MySQL Master node,
  • A few of MySQL Slave nodes,
  • One MySQL Fabric node.
Let's get down to the installation of the Fabric node, shall we ?

Following you'll find the server details and role :
  • mysqltest01 (fabric node)
  • mysqltest02 (master node)
  • mysqltest03 (slave node)
1) The first step is to install as root the following RPMS :

rpm -ivh mysql-connector-python-2.0.3-1.el6.noarch.rpm
rpm -ivh mysql-utilities-1.5.3-1.el6.noarch.rpm

2) A MySQL database is required for configuring the Fabric. If you have got lots of money you'll install an enterprise database edition release. Otherwise a community edition is fine. If you need help to install a MySQL  database on linux you can look at a previous post of mine.

3) The installation of the database ends up adding the following parameters the the my.cnf configuration file.

gtid-mode=on
enforce-gtid-consistency=true
master-info-repository=TABLE
relay-log-info-repository=TABLE
sync-master-info=1
report-host=xxx.xxx.x.100
report-port=3306
server-id=1
binlog-format=ROW
log-bin=/mysql/mysql5.6/logs/binlogs/fab-bin.log
log-slave-updates=true


4) The following user is now necessary to create it into the database.


CREATE USER fabric@localhost;
GRANT ALL ON fabric.* TO fabric@localhost identified by 'xxxxx';

5) Modify the fabric config file /etc/mysql/fabric.cfg adding and what's more modifying the following parameters :

sysconfdir = /etc/mysql
mysqldump_program = /usr/local/mysql/bin/mysqldump
mysqlclient_program = /usr/local/mysql/bin/mysql

6) Execute as root the following command :

mysqlfabric manage setup --param=storage.user=fabric

This command is going to create a Fabric database into the MySQL database. The new fabric database will be used as a repository for Fabric metadata objects.

mysql> use fabric
  
    Database changed
    mysql> show tables;
    +-------------------+
    | Tables_in_fabric  |
    +-------------------+
    | checkpoints       |
    | error_log         |
    | group_replication |
    | group_view        |
    | groups            |
    | log               |
    | machines          |
    | permissions       |
    | proc_view         |
    | providers         |
    | role_permissions  |
    | roles             |
    | servers           |
    | shard_maps        |
    | shard_ranges      |
    | shard_tables      |
    | shards            |
    | user_roles        |
    | users             |
    +-------------------+



To be continued ....

See you soon.

Byeeee

No comments:

Post a Comment