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 :
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 :
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:
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.
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.