Install Percona cluster 5.6 on Ubuntu 12.04

(0 comments)

percona1

What is it Percona Cluster?

Percona XtraDB Cluster is an active/active high availability and high scalability open source solution for MySQL® clustering. It integrates Percona Server and Percona XtraBackup with the Galera library of MySQL high availability solutions in a single package which enables you to create a cost-effective MySQL high availability cluster

The Cluster we will be created on these nodes:

Node1:
hostname:per1
IP: 10.185.0.20
Node2:
hostname:per2
IP: 10.185.0.42

 

To retrieve Percona Cluster packages you have to add a key:

$ apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A

Add this to /etc/apt/sources.list   in end of file:

deb http://repo.percona.com/apt precise main
deb-src http://repo.percona.com/apt precise main

First we need update and upgrade the ubuntu nodes, we need the same libraries on two or more nodes:

$sudo apt-get update

and may be:

$sudo apt-get upgrade
$sudo apt-get dist-upgrade
$sudo reboot
$apt-cache search percona|grep full
percona-xtradb-cluster-full-55- Percona XtraDB Cluster with Galera
percona-xtradb-cluster-full-56- Percona XtraDB Cluster with Galera

Lets install 56

$sudo apt-get install percona-xtradb-cluster-full-56

-----------------

After rebooting stop mysql, if it started:

sudo /etc/init.d/mysql stop

Edit file my.cnf, if not exist, create it:

-------------

[mysqld]
datadir=/var/lib/mysql
user=mysql
wsrep_provider=/usr/lib/libgalera_smm.so
#wsrep_node_incoming_address=10.185.0.20
wsrep_cluster_address=gcomm://0.0.0.0   #  important!!!!  first running uncomment it for init cluster at first time
#wsrep_cluster_address=gcomm://10.185.0.20,10.185.0.42
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
wsrep_node_address=10.185.0.20
wsrep_sst_method=xtrabackup
wsrep_cluster_name=my_cluster0
wsrep_sst_auth="root:passwd@"
#wsrep_debug=1
# INNODB #
innodb_flush_method = O_DIRECT
innodb_log_files_in_group = 2
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table = 1
#innodb_buffer_pool_size = 2G

------

save it and try start mysql:

$sudo service mysql start

then check status:

$mysql -u root -ppasswd@ -e "show status like 'wsrep%';"

+------------------------------+--------------------------------------+
| Variable_name | Value |
+------------------------------+--------------------------------------+
| wsrep_local_state_uuid | b299724b-2ec5-11e4-baf7-4211948c6a81 |

...

| wsrep_local_state_comment | Synced |
| wsrep_cert_index_size | 0 |
| wsrep_causal_reads | 0 |
| wsrep_cert_interval | 0.000000 |
| wsrep_incoming_addresses |10.185.0.20:3306 |

...

| wsrep_cluster_state_uuid | b299724b-2ec5-11e4-baf7-4211948c6a81 |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 1 |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <[email protected]> |
| wsrep_provider_version | 3.6(r3a949e6) |
| wsrep_ready | ON |
+------------------------------+--------------------------------------+

If it looks good.

Go to the second node

you have to do the same operations:

install percona (see above)

update & upgrade & dist-upgrade

file my.cnf is the same except:

#wsrep_cluster_address=gcomm://   #should be comment
wsrep_cluster_address=gcomm://10.185.0.20,10.185.0.42   #uncomment it

save it and try to start mysql:

$sudo service mysql start

if there are not any errors, you can check the status of the connection :

$mysql -u root -ppasswd@ -e "show status like 'wsrep%';"

+------------------------------+--------------------------------------+
| Variable_name | Value |
+------------------------------+--------------------------------------+
| wsrep_local_state_uuid | b299724b-2ec5-11e4-baf7-4211948c6a81 |
| wsrep_protocol_version | 6 |

...

| wsrep_local_send_queue_avg | 0.000000 |
| wsrep_local_recv_queue | 0 |
| wsrep_local_recv_queue_avg | 0.000000 |
| wsrep_commit_oooe | 0.000000 |
| wsrep_commit_oool | 0.000000 |
...

wsrep_commit_window | 0.000000 |
| wsrep_local_state | 4 |
| wsrep_local_state_comment | Synced |
| wsrep_cert_index_size | 0 |
| wsrep_causal_reads | 0 |
| wsrep_cert_interval | 0.000000 |
| wsrep_incoming_addresses | 10.185.0.42:3306,10.185.0.20:3306 |
| wsrep_evs_repl_latency | 0/0/0/0/0 |
| wsrep_cluster_conf_id | 4 |
| wsrep_cluster_size | 2 |
| wsrep_cluster_state_uuid | b299724b-2ec5-11e4-baf7-4211948c6a81 |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 0 |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <[email protected]> |
| wsrep_provider_version | 3.6(r3a949e6) |
| wsrep_ready | ON |
+------------------------------+--------------------------------------+

-----------

status

wsrep_cluster_state_uuid     | b299724b-2ec5-11e4-baf7-4211948c6a81

should be the same in first node

and

wsrep_incoming_addresses     | 10.185.0.42:3306,10.185.0.20:3306

now we have two nodes in cluster.

Cluster can accept connection in both IP addresses:

10.185.0.42:3306 or 10.185.0.20:3306

Now we can edit the config file in node1:

#wsrep_cluster_address=gcomm://   #should be comment
wsrep_cluster_address=gcomm://10.185.0.20,10.185.0.42   #uncomment it

$sudo service mysql stop

$sudo service mysql start

After that you can check status again

$mysql -u root -ppasswd@ -e "show status like 'wsrep%';"

should works!

 

Currently unrated

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required