I would like to setup a Galera Cluster with 3 servers.
But i have a question who can be a problem :
- How can i add a new IP in wsrep_cluster_address parameter to allow this new server to be sync in the cluster without interruption ? (restarting mariadb)
Thanks
Best Answer
In general you don't need to do this. When cluster is running it discovers all other nodes dynamically from any node it connects first, so you specify just any joined node(s) in this setting:
However, it is recommended you specify all nodes in this variable. It is supported even to specify all nodes including itself, so you just specify the same string into all node's configuration. But, you don't need to restart node. This setting is needed in case you'll restart it, for it to be able to join a running cluster, but when cluster is assembled all nodes know all others anyway. So in general you build a cluster, and then update
wsrep_cluster_address
in the config files, but you don't need to restart nodes afterwards.However, if ISTs are configured properly, node restart is relatively fast, because it only tranfers missing writesets from active nodes (so "incremental" state transfer), not the complete dataset as it would in case of SST. So you may restart node without major disruption. Your application should be able to cope with this small disruption, for example, reconnect to any other alive node (or else Galera cluster is useless).
This means, you might well join 2nd and 3rd nodes into the cluster, then update configuration on 1st node and restart it; during its downtime there will be a quorum 2 of 3 notes, and when it is ready it will rejoin a cluster using its
wsrep_cluster_address
variable. I'll even suggest to do this, just to know what happens when you restart a node.Also note, Galera's
wsrep_*
configuration directives are system variables. Many of them can be set interactively without restart. Thewsrep_cluster_address
can be changed at runtime:this may cause the node reconnection.
So it is not much different, to set it like this, or to simply restart a node after updating it's config file.