Details
-
New Feature
-
Status: Closed (View Workflow)
-
Trivial
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Hi,
currently, galera monitor only one state, such as "Synced", to route queries.
But, if we use xtrabackup, the node could be in "Donor/Unsynced" and still accept reads and writes.
This is important if only one node is in the cluster, and another node starts synchronising from it.
The folowing ideal workflow should be available, at least as an option:
Monitor Start
- Check if wsrep_cluster_status is 'Primary'
If no -> no traffic
If yes: - Check if wsrep_local_state_comment is Synced (or status is == 4)
If 4: -> traffic
If <> 2: -> no traffic
If 2 (Donor/Unsynced): - Check wrep_sst_method variable if it is 'xtrabackup%'
If no -> no traffic
If yes -> traffic
Joffrey
I add a snippet used in python for reference:
 |
# Check 1) We need to have "Primary State"
|
else:
|
cur = db.query('select variable_value from information_schema.global_status where variable_name="wsrep_cluster_status"') myreturn = cur.fetchone()
|
# Check 2) We must be in synced mode (local_state = 4)
|
if (myreturn[0] == "Primary"):
|
cur = db.query('select variable_value from information_schema.global_status where variable_name="wsrep_local_state"') myreturn = cur.fetchone()
|
if not (myreturn[0] == "4"):
|
if (myreturn[0] == "2"):
|
cur = db.query('select count(1) from information_schema.global_variables where variable_name="wsrep_sst_method" and variable_value like "xtrabackup%"') myreturn = cur.fetchone()
|
if (myreturn[0] == 0):
|
myerrors += 1
|
myerrormsg += "The node is in Donor mode, and you are not using xtrabackup SST" else:
|
myerrors += 1
|
myerrormsg += "The node is not Synced (4) or Donor (2)" else:
|
myerrors += 1
|
myerrormsg += "The node is not member of a Primary Cluster" if(myerrors > 0):
|
mariadb_offline(myerrormsg) else:
|
mariadb_online()
|