TASSTA Documentation Center TASSTA Documentation Center More products
Hide table of contents Hide details Search My account

Starting a cluster

On the first selected node, execute:

/etc/init.d/mysql bootstrap

When the first node is up and running, execute the following command on the subsequent nodes:

/etc/init.d/mysql start

It will now automatically retrieve the cluster map and connect to the rest of the nodes and form a cluster.

  • Never bootstrap when you want to reconnect a node to an existing cluster
  • Never run bootstrap on more than one node.

Safe-to-Bootstrap flag facilitates the decision and prevents unsafe choices by keeping track of the order in which nodes are being shut down. The node that was shut down last will be marked as "Safe-to-Bootstrap". All the other nodes will be marked as unsafe to bootstrap from. Looking at /var/lib/mysql/grastate.dat:

# GALERA saved state
version: 2.1
uuid:    8bcf4a34-aedb-14e5-bcc3-d3e36277729f
seqno:   2575
safe_to_bootstrap: 0

In case of unclean shutdown or hard crash, all nodes will have safe_to_bootstrap: 0. Consult the InnoDB storage engine to determine which node has committed the last transaction in the cluster. The number after the UUID string on the "Recovered position" line is the one to look for. Pick the node that has the highest number and edit its grastate.dat to set safe_to_bootstrap: 1, as shown in the example below:

# GALERA saved state
version: 2.1
uuid:    8bcf4a34-aedb-14e5-bcc3-d3e36277729f
seqno:   -1
safe_to_bootstrap: 1

You can then perform the standard bootstrap command on the chosen node.