I am not quite certain if I understand your question completely, but let's consider two scenarios:
After an orderly, manual shutdown of the cluster, you will know which node you shut down last. Just begin the startup sequence with that node, and bring them up manually one after the other.
But suppose your shutdown was accidental, due to a power outage or similar. You will not know which node considers itself "the last to go down". However, you can check the file grastate.dat
on the individual cluster members and search for the flag safe_to_bootstrap: 1
. If there is exactly one node that has this flag set to 1, boot that one first.
Otherwise, as described in https://galeracluster.com/2016/11/introducing-the-safe-to-bootstrap-feature-in-galera-cluster/, start mysqld with the --wsrep-recover
switch, compare the UUIDs in the "Recovered position" line in the output and set the safe_to_bootstrap
flag to 1 by hand on the node with the highest UUID. Then, proceed as above.
Those were the procedures for manually starting the nodes. I'm asking about a way to automate this in a more robust way in a different question.