Rename failover and failover_recovery

The names of the parameters were misleading as MaxScale doesn't perform
the actual failover but only detects if one has been done.
This commit is contained in:
Markus Mäkelä
2017-03-03 10:46:37 +02:00
parent 0581ab1afe
commit 916cb4df08
3 changed files with 41 additions and 41 deletions

View File

@ -119,9 +119,10 @@ This functionality is similar to the [Multi-Master Monitor](MM-Monitor.md)
functionality. The only difference is that the MySQL monitor will also detect functionality. The only difference is that the MySQL monitor will also detect
traditional Master-Slave topologies. traditional Master-Slave topologies.
### `failover` ### `detect_standalone_master`
Failover mode. This feature takes a boolean parameter is disabled by default. Detect standalone master servers. This feature takes a boolean parameter and is
disabled by default. In MaxScale 2.1.0, this parameter was called `failover`.
This parameter is intended to be used with simple, two node master-slave pairs This parameter is intended to be used with simple, two node master-slave pairs
where the failure of the master can be resolved by "promoting" the slave as the where the failure of the master can be resolved by "promoting" the slave as the
@ -137,15 +138,16 @@ looking at the system variables of the server in question.
By default, MaxScale will only attempt to deduce if the server can be used as a By default, MaxScale will only attempt to deduce if the server can be used as a
slave server (controlled by the `detect_stale_slave` parameter). When the slave server (controlled by the `detect_stale_slave` parameter). When the
`failover` mode is enabled, MaxScale will also attempt to deduce whether the `detect_standalone_master` mode is enabled, MaxScale will also attempt to deduce
server can be used as a master server. This is done by checking that the server whether the server can be used as a master server. This is done by checking that
is not in read-only mode and that it is not configured as a slave. the server is not in read-only mode and that it is not configured as a slave.
The failover mode in mysqlmon is completely passive in the sense that it does This mode in mysqlmon is completely passive in the sense that it does not modify
not modify the cluster or any of the servers in it. It only labels the last the cluster or any of the servers in it. It only labels the last remaining
remaining server in a cluster as the master server. server in a cluster as the master server.
Before a failover can be initiated, the following conditions must have been met: Before a server is labeled as a standalone master, the following conditions must
have been met:
- Previous attempts to connect to other servers in the cluster have failed, - Previous attempts to connect to other servers in the cluster have failed,
controlled by the `failcount` parameter controlled by the `failcount` parameter
@ -158,10 +160,7 @@ In 2.1.1, the following additional condition was added:
- The last running server is not configured as a slave - The last running server is not configured as a slave
When these conditions are met, the monitor will label the last remaining server If the value of the `allow_cluster_recovery` parameter is set to false, the monitor
as a master.
If the value of the `failover_recovery` parameter is set to false, the monitor
sets all other servers into maintenance mode. This is done to prevent accidental sets all other servers into maintenance mode. This is done to prevent accidental
use of the failed servers if they came back online. If the failed servers come use of the failed servers if they came back online. If the failed servers come
back up, the maintenance mode needs to be manually cleared once replication has back up, the maintenance mode needs to be manually cleared once replication has
@ -173,32 +172,33 @@ been set up.
### `failcount` ### `failcount`
Number of failures that must occur on all failed servers before a failover is Number of failures that must occur on all failed servers before a standalone
initiated. The default value is 5 failures. server is labeled as a master. The default value is 5 failures.
The monitor will attempt to contact all servers once per monitoring cycle. When The monitor will attempt to contact all servers once per monitoring cycle. When
_failover_ mode is enabled, all of the failed servers must fail _failcount_ `detect_standalone_master` is enabled, all of the failed servers must fail
number of connection attempts before a failover is initiated. _failcount_ number of connection attempts before the last server is labeled as
the master.
The formula for calculating the actual number of milliseconds before failover The formula for calculating the actual number of milliseconds before the server
can start is `monitor_interval * failcount`. This means that to trigger a is labeled as the master is `monitor_interval * failcount`.
failover after 10 seconds of master failure with a _monitor_interval_ of 1000
milliseconds, the value of _failcount_ must be 10.
### `failover_recovery` ### `allow_cluster_recovery`
Allow recovery after failover. This feature takes a boolean parameter is Allow recovery after the cluster has dropped down to one server. This feature
enabled by default. takes a boolean parameter is enabled by default. This parameter requires that
`detect_standalone_master` is set to true. In MaxScale 2.1.0, this parameter was
called `failover_recovery`.
When this parameter is disabled, if a failover has been triggered and the last When this parameter is disabled, if the last remaining server is labeled as the
remaining server is chosen as the master, the monitor will set all of the failed master, the monitor will set all of the failed servers into maintenance
servers into maintenance mode. When this option is enabled, the failed servers mode. When this option is enabled, the failed servers are allowed to rejoin the
are allowed to rejoin the cluster. cluster.
This option should be enabled when failover in MaxScale is used in conjunction This option should be enabled only when MaxScale is used in conjunction with an
with an external agent that resets the slave status for new master servers. One external agent that automatically reintegrates failed servers into the
of these agents is the _replication-manager_ which clears the slave cluster. One of these agents is the _replication-manager_ which automatically
configuration for each new master and removes the read-only mode. configures the failed servers as new slaves of the current master.
## Example 1 - Monitor script ## Example 1 - Monitor script

View File

@ -74,10 +74,10 @@ typedef struct
char* script; /*< Script to call when state changes occur on servers */ char* script; /*< Script to call when state changes occur on servers */
uint64_t events; /*< enabled events */ uint64_t events; /*< enabled events */
HASHTABLE *server_info; /**< Contains server specific information */ HASHTABLE *server_info; /**< Contains server specific information */
bool failover; /**< If simple failover is enabled */ bool detect_standalone_master; /**< If standalone master are detected */
int failcount; /**< How many monitoring cycles servers must be int failcount; /**< How many monitoring cycles servers must be
down before failover is initiated */ down before failover is initiated */
bool failover_recovery; /**< Allow servers to rejoin the cluster in failover mode */ bool allow_cluster_recovery; /**< Allow failed servers to rejoin the cluster */
bool warn_failover; /**< Log a warning when failover happens */ bool warn_failover; /**< Log a warning when failover happens */
} MYSQL_MONITOR; } MYSQL_MONITOR;

View File

@ -125,9 +125,9 @@ MXS_MODULE* MXS_CREATE_MODULE()
{"detect_stale_slave", MXS_MODULE_PARAM_BOOL, "true"}, {"detect_stale_slave", MXS_MODULE_PARAM_BOOL, "true"},
{"mysql51_replication", MXS_MODULE_PARAM_BOOL, "false"}, {"mysql51_replication", MXS_MODULE_PARAM_BOOL, "false"},
{"multimaster", MXS_MODULE_PARAM_BOOL, "false"}, {"multimaster", MXS_MODULE_PARAM_BOOL, "false"},
{"failover", MXS_MODULE_PARAM_BOOL, "false"}, {"detect_standalone_master", MXS_MODULE_PARAM_BOOL, "false"},
{"failcount", MXS_MODULE_PARAM_COUNT, "5"}, {"failcount", MXS_MODULE_PARAM_COUNT, "5"},
{"failover_recovery", MXS_MODULE_PARAM_BOOL, "true"}, {"allow_cluster_recovery", MXS_MODULE_PARAM_BOOL, "true"},
{ {
"script", "script",
MXS_MODULE_PARAM_PATH, MXS_MODULE_PARAM_PATH,
@ -279,9 +279,9 @@ startMonitor(MXS_MONITOR *monitor, const MXS_CONFIG_PARAMETER* params)
handle->detectStaleSlave = config_get_bool(params, "detect_stale_slave"); handle->detectStaleSlave = config_get_bool(params, "detect_stale_slave");
handle->replicationHeartbeat = config_get_bool(params, "detect_replication_lag"); handle->replicationHeartbeat = config_get_bool(params, "detect_replication_lag");
handle->multimaster = config_get_bool(params, "multimaster"); handle->multimaster = config_get_bool(params, "multimaster");
handle->failover = config_get_bool(params, "failover"); handle->detect_standalone_master = config_get_bool(params, "detect_standalone_master");
handle->failcount = config_get_integer(params, "failcount"); handle->failcount = config_get_integer(params, "failcount");
handle->failover_recovery = config_get_bool(params, "failover_recovery"); handle->allow_cluster_recovery = config_get_bool(params, "allow_cluster_recovery");
handle->mysql51_replication = config_get_bool(params, "mysql51_replication"); handle->mysql51_replication = config_get_bool(params, "mysql51_replication");
handle->script = config_copy_string(params, "script"); handle->script = config_copy_string(params, "script");
handle->events = config_get_enum(params, "events", mxs_monitor_event_enum_values); handle->events = config_get_enum(params, "events", mxs_monitor_event_enum_values);
@ -1010,7 +1010,7 @@ void do_failover(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *db)
{ {
MXS_WARNING("Failover initiated, server '%s' is now the master.%s", MXS_WARNING("Failover initiated, server '%s' is now the master.%s",
db->server->unique_name, db->server->unique_name,
handle->failover_recovery ? handle->allow_cluster_recovery ?
"" : " All other servers are set into maintenance mode."); "" : " All other servers are set into maintenance mode.");
handle->warn_failover = false; handle->warn_failover = false;
} }
@ -1019,7 +1019,7 @@ void do_failover(MYSQL_MONITOR *handle, MXS_MONITOR_SERVERS *db)
monitor_set_pending_status(db, SERVER_MASTER); monitor_set_pending_status(db, SERVER_MASTER);
monitor_clear_pending_status(db, SERVER_SLAVE); monitor_clear_pending_status(db, SERVER_SLAVE);
} }
else if (!handle->failover_recovery) else if (!handle->allow_cluster_recovery)
{ {
server_set_status_nolock(db->server, SERVER_MAINT); server_set_status_nolock(db->server, SERVER_MAINT);
monitor_set_pending_status(db, SERVER_MAINT); monitor_set_pending_status(db, SERVER_MAINT);
@ -1298,7 +1298,7 @@ monitorMain(void *arg)
/** Now that all servers have their status correctly set, we can check /** Now that all servers have their status correctly set, we can check
if we need to do a failover */ if we need to do a failover */
if (handle->failover) if (handle->detect_standalone_master)
{ {
if (failover_required(handle, mon->databases)) if (failover_required(handle, mon->databases))
{ {