Wednesday, January 30, 2013

How to start a Percona XtraDB Cluster

How to start a Percona XtraDB Cluster:
Before version 5.5.28 of Percona XtraDB Cluster, the easiest way was to join the cluster using wsrep_urls in [mysqld_safe] section of my.cnf.
So with a cluster of 3 nodes like this :
node1 = 192.168.1.1

node2 = 192.168.1.2

node3 = 192.168.1.3

we defined the setting like this :
wsrep_urls=gcomm://192.168.1.1:4567,gcomm://192.168.1.2:4567,gcomm://192.168.1.3:4567

With that line above in my.cnf on each node, when PXC (mysqld) was started, the node tried to join the cluster on the first IP, if no node was running on that IP, the next IP was tried and so on…. until the node could join the cluster or after it tried and didn’t find any node running the cluster, in that case mysqld failed to start.

To avoid this, when all nodes where down and you wanted to start the cluster, it was possible to have wsrep_urls defined like this :
wsrep_urls=gcomm://192.168.1.1:4567,gcomm://192.168.1.2:4567,gcomm://192.168.1.3:4567,gcomm://

That was a nice feature, especially for people that didn’t want to modify my.cnf after starting the first node initializing the cluster or people automating their deployment with a configuration management system.
Now, since wsrep_urls is deprecated since version 5.5.28 what is the better option to start the cluster ?
In my.cnf, [mysqld] section this time, you can use wsrep_cluster_address with the following syntax:
wsrep_cluster_address=gcomm://192.168.1.1,192.168.1.2,192.168.1.3

As you can see the port is not needed and gcomm:// is specified only once.

Note:In Debian and Ubuntu, the ip of the node cannot be present in that variable due to a glibc error:



130129 17:03:45 [Note] WSREP: gcomm: connecting to group 'testPXC', peer '192.168.80.1:,192.168.80.2:,192.168.80.3:'

17:03:45 UTC - mysqld got signal 11 ;

This could be because you hit a bug. It is also possible that this binary

or one of the libraries it was linked against is corrupt, improperly built,

or misconfigured. This error can also be caused by malfunctioning hardware.

[...]

/usr/sbin/mysqld(_Z23wsrep_start_replicationv+0x111)[0x664c21]

/usr/sbin/mysqld(_Z18wsrep_init_startupb+0x65)[0x664da5]

/usr/sbin/mysqld[0x5329af]

/usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x8bd)[0x534fad]

/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f3bb24b676d]

/usr/sbin/mysqld[0x529d1d]



So what can be done to initialize the cluster when all nodes are down ? There are two options:

  • modify my.cnf and set wsrep_cluster_address=gcomm:// then when the node is started change it again, this is not my favourite option.

  • start mysql using the following syntax (it works only on RedHat and CentOS out of the box):

    /etc/init.d/myslqd start --wsrep-cluster-address="gcomm://"

    As there is no need to modify my.cnf, this is how I recommend to do it.


The post How to start a Percona XtraDB Cluster appeared first on MySQL Performance Blog.

DIGITAL JUICE

No comments:

Post a Comment

Thank's!