Instances running MySQL 8.0.16 and later support the Group
Replication automatic rejoin functionality, which enables you to
configure instances to automatically rejoin the cluster after
being expelled. See
Responses to Failure Detection and Network Partitioning for
background information. AdminAPI provides the
autoRejoinTries
option to configure the
number of tries instances make to rejoin the cluster after being
expelled. By default instances do not automatically rejoin the
cluster. You can configure the
autoRejoinTries
option at either the cluster
level or for an individual instance using the following
commands:
dba.createCluster()
Cluster.addInstance()
Cluster.setOption()
Cluster.setInstanceOption()
The autoRejoinTries
option accepts positive
integer values between 0 and 2016 and the default value is 3.
When using the automatic rejoin functionality, your cluster is
more tolerant to faults, especially temporary ones such as
unreliable networks. But if quorum has been lost, you should not
expect members to automatically rejoin the cluster, because
majority is required to rejoin instances.
Instances running MySQL version 8.0.12 and later have the
group_replication_exit_state_action
variable, which you can configure using the AdminAPI
exitStateAction
option. This controls what
instances do in the event of leaving the cluster unexpectedly.
By default the exitStateAction
option is
READ_ONLY,
which means that instances which
leave the cluster unexpectedly become read-only. If
exitStateAction
is set to
OFFLINE_MODE
, instances which leave the
cluster unexpectedly become read-only and also enter offline
mode, where they disconnect existing clients and do not accept
new connections (except from clients with administrator
privileges). If exitStateAction
is set to
ABORT_SERVER
then in the event of leaving the
cluster unexpectedly, the instance shuts down MySQL, and it has
to be started again before it can rejoin the cluster. Note that
when you are using the automatic rejoin functionality, the
action configured by the exitStateAction
option only happens in the event that all attempts to rejoin the
cluster fail.
There is a chance you might connect to an instance and try to configure it using the AdminAPI, but at that moment the instance could be rejoining the cluster. This could happen whenever you use any of these operations:
Cluster.status()
dba.getCluster()
Cluster.rejoinInstance()
Cluster.addInstance()
Cluster.removeInstance()
Cluster.rescan()
These operations might provide extra information
while the instance is automatically rejoining the cluster. In
addition, when you are using
,
if the target instance is automatically rejoining the cluster
the operation aborts unless you pass in
Cluster
.removeInstance()force:true
.