Mysql Galera Autostart from boot --wsrep-new-cluster

Soth picture Soth · Apr 29, 2014 · Viewed 7.4k times · Source

To recover from a blackout I need to start the Galera cluster when the system boots and I can only do this with the following:

service mysql start --wsrep-new-cluster

"service mysql start" will get launched on boot but will fail because it is the only one in the cluster. How do I get the cluster to start from boot and not fail if it is the only one there?

EDIT

Looks like I have to leave gcomm:// blank for it to start but it is not the best solution as if another server came online first then it would fail.

#galera settings
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_name="my_wsrep_cluster"
wsrep_cluster_address="gcomm://"
wsrep_sst_method=rsync
wsrep_provider_options="pc.bootstrap=true"

Answer

StanleyD picture StanleyD · Sep 13, 2014

My solution is to edit init scripts - This is solution for debian - location my init script is /etc/init.d/mysql then I found this line:

/usr/bin/mysqld_safe "${@:2}" > /dev/null 2>&1 &

and I added parameter --wsrep-new-cluster

/usr/bin/mysqld_safe --wsrep-new-cluster "${@:2}" > /dev/null 2>&1 &

and it is working after boot.