MXS-1509: Add ignore_external_masters
parameter
The new parameter allows ignoring of master servers that are external to the monitor configuration. This allows sub-trees of the actual replication tree to be used as fully fledged replication trees.
This commit is contained in:
@ -120,6 +120,23 @@ 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.
|
||||||
|
|
||||||
|
### `ignore_external_masters`
|
||||||
|
|
||||||
|
Ignore any servers that are not monitored by this monitor but are a part of the
|
||||||
|
replication topology. This option was added in MaxScale 2.1.12 and is disabled
|
||||||
|
by default.
|
||||||
|
|
||||||
|
MaxScale detects if a master server replicates from an external server. When
|
||||||
|
this is detected, the server is assigned the `Slave` and `Slave of External
|
||||||
|
Server` labels and will be treated as a slave server. Most of the time this
|
||||||
|
topology is used when MaxScale is used for read scale-out without master
|
||||||
|
servers, a Galera cluster with read replicas being a prime example of this
|
||||||
|
setup. Sometimes this is not the desired behavior and the external master server
|
||||||
|
should be ignored. Most of the time this is due to multi-source replication.
|
||||||
|
|
||||||
|
When this option is enabled, all servers that have the `Master, Slave, Slave of
|
||||||
|
External Server, Running` labels will instead get the `Master, Running` labels.
|
||||||
|
|
||||||
### `detect_standalone_master`
|
### `detect_standalone_master`
|
||||||
|
|
||||||
Detect standalone master servers. This feature takes a boolean parameter and is
|
Detect standalone master servers. This feature takes a boolean parameter and is
|
||||||
|
@ -192,6 +192,10 @@ enum
|
|||||||
(((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE|SERVER_MAINT)) == \
|
(((server)->status & (SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE|SERVER_MAINT)) == \
|
||||||
(SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE))
|
(SERVER_RUNNING|SERVER_MASTER|SERVER_SLAVE))
|
||||||
|
|
||||||
|
#define SERVER_IS_SLAVE_OF_EXTERNAL_MASTER(s) (((s)->status & \
|
||||||
|
(SERVER_RUNNING|SERVER_SLAVE_OF_EXTERNAL_MASTER)) == \
|
||||||
|
(SERVER_RUNNING|SERVER_SLAVE_OF_EXTERNAL_MASTER))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Allocate a new server
|
* @brief Allocate a new server
|
||||||
*
|
*
|
||||||
|
@ -66,6 +66,7 @@ typedef struct
|
|||||||
bool detectStaleMaster; /**< Monitor flag for MySQL replication Stale Master detection */
|
bool detectStaleMaster; /**< Monitor flag for MySQL replication Stale Master detection */
|
||||||
bool detectStaleSlave; /**< Monitor flag for MySQL replication Stale Master detection */
|
bool detectStaleSlave; /**< Monitor flag for MySQL replication Stale Master detection */
|
||||||
bool multimaster; /**< Detect and handle multi-master topologies */
|
bool multimaster; /**< Detect and handle multi-master topologies */
|
||||||
|
bool ignore_external_masters; /**< Ignore masters outside of the monitor configuration */
|
||||||
int disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */
|
int disableMasterFailback; /**< Monitor flag for Galera Cluster Master failback */
|
||||||
int availableWhenDonor; /**< Monitor flag for Galera Cluster Donor availability */
|
int availableWhenDonor; /**< Monitor flag for Galera Cluster Donor availability */
|
||||||
int disableMasterRoleSetting; /**< Monitor flag to disable setting master role */
|
int disableMasterRoleSetting; /**< Monitor flag to disable setting master role */
|
||||||
|
@ -129,6 +129,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{"detect_standalone_master", 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"},
|
||||||
{"allow_cluster_recovery", MXS_MODULE_PARAM_BOOL, "true"},
|
{"allow_cluster_recovery", MXS_MODULE_PARAM_BOOL, "true"},
|
||||||
|
{"ignore_external_masters", MXS_MODULE_PARAM_BOOL, "false"},
|
||||||
{
|
{
|
||||||
"script",
|
"script",
|
||||||
MXS_MODULE_PARAM_PATH,
|
MXS_MODULE_PARAM_PATH,
|
||||||
@ -280,6 +281,7 @@ 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->ignore_external_masters = config_get_bool(params, "ignore_external_masters");
|
||||||
handle->detect_standalone_master = config_get_bool(params, "detect_standalone_master");
|
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->allow_cluster_recovery = config_get_bool(params, "allow_cluster_recovery");
|
handle->allow_cluster_recovery = config_get_bool(params, "allow_cluster_recovery");
|
||||||
@ -1338,6 +1340,19 @@ monitorMain(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear external slave status from master if configured to do so.
|
||||||
|
* This allows parts of a multi-tiered replication setup to be used
|
||||||
|
* in MaxScale.
|
||||||
|
*/
|
||||||
|
if (root_master && SERVER_IS_SLAVE_OF_EXTERNAL_MASTER(root_master->server) &&
|
||||||
|
SERVER_IS_MASTER(root_master->server) && handle->ignore_external_masters)
|
||||||
|
{
|
||||||
|
monitor_clear_pending_status(root_master,
|
||||||
|
SERVER_SLAVE | SERVER_SLAVE_OF_EXTERNAL_MASTER);
|
||||||
|
server_clear_status_nolock(root_master->server, SERVER_SLAVE | SERVER_SLAVE_OF_EXTERNAL_MASTER);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After updating the status of all servers, check if monitor events
|
* After updating the status of all servers, check if monitor events
|
||||||
* need to be launched.
|
* need to be launched.
|
||||||
|
Reference in New Issue
Block a user