prevent a galera node from bootstrapping



  • I have bootstrapped a node as the first node in a new galera cluster. then when I joined another node to it. the node joind as bootstrap but there are no grastat.dat file in that joind node because I made sure to delete that file so it can not join as bootstrap. here is the log on the joind node

    Server version: 10.4.22-MariaDB-log MariaDB Server
    2022-04-24  0:02:05 0 [Warning] WSREP: Could not open state file for reading: '/var/lib/mysql//grastate.dat'
    2022-04-24  0:02:05 0 [Note] WSREP: Found saved state: 00000000-0000-0000-0000-000000000000:-1, safe_to_bootstrap: 1
    

    my question is from where that node find that saved state in the logs that tells it that it is safe to bootstrap ?

    and how to prevent the node from bootstrapping ever ?



  • The grastate.dat file is where the host finds the information about its current state. This includes the UUID, the seqno, and the safe to bootstrap parameter.

    When the grastate.dat file does not exist in the data directory, then the host will bootstrap with the default state, which is safe_to_bootstrap = 1. You can see that in the Galera code https://github.com/codership/galera/blob/d99293226a1c78a737a9ceeabd38a73f3920d529/galera/src/saved_state.cpp#L26 . That is also why you see the information that the UUID is 00000000-0000-0000-0000-000000000000 and the seqno is -1

    After the host has joined into the cluster, you can check the grastate.dat file. It should now have a valid UUID, a seqno of -1 (which indicates that the host is working), and the safe to bootstrap parameter is set to 0.

    As danblack already commented, bootstrapping is a manual process, to recover the cluster after a crash, so you cannot explicitly prevent that a node bootstraps. You can read more about the safe to bootstrap protection in these https://galeracluster.com/library/training/tutorials/restarting-cluster.html . But to sum it up, Galera will only set safe_to_bootstrap to 1 when it can determine which host had the highest state before the shutdown. This is an info to you, that this is the host that you should bootstrap from and you will still need to manually intervene to repair the cluster.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2