2 nodes cluster automatic failover

Hello, I know that 2 nodes clusters are not ideal but if I remember correctly with percona 5.7 when one node went down the other one continued to work
with 8.0 instead I get this error when I try to read from the db
WSREP has not yet prepared node for application use
I know that I can manually force that node to bootstrap but would it be possible to automatically make it work?

Hi Samanosuke,

The same problem will happen with 5.7 or any other version as long as the primary node shuts down ungracefully. If the primary shuts down gracefully then the 2nd node will continue to operate smoothly

That is the reason why you should have a 3 node cluster. if you don’t plan on having a 3rd node then at least set up arbitrator: Set up Galera arbitrator - Percona XtraDB Cluster

Regards

thanks, I guess I remembered wrong or I only tried graceful shutdowns in the past

if I have a single arbitrator on one of the two nodes I imagine I would still get a split brain if that node goes down, same if I have 2 arbitrators on the two nodes but what happens if I have the arbitrator on another server but both the arbitrator and one of the nodes go down?

Hi again,

A 3 node topology can survive a 1 node (either regular node or arbitrator) shutting down ungracefully. The arbitrator should be on a different server than the nodes; otherwise that will defeat the purpose of having them in case of a network issue.

4 node topology can also survive only 1 ungraceful shutdown because the majority of the cluster needs to survive and be able to reach each other for the remaining nodes to continue operating. I.e 51% of 4 (rounded to 3). You can potentially adjust galera weights but I would not suggest messing with that

Last you can read on how to recover different galera clusters depending on what happened:

Regards

1 Like