MXS-1639 Run user-given sql commands during promotion, demotion and rejoin
The sql queries are given in two text files, defined by options promotion_sql_file and demotion_sql_file. The files must exist when monitor starts. The files are read line by line, ignoring empty lines and lines starting with '#'. All other lines are sent to the server being promoted, demoted or rejoined. Any error in opening a file, reading it or executing the contents will cause the entire operation to fail. The filed defined in demotion_sql_file is also ran when rejoining a server. This is to ensure a previously failed master is "demoted" properly when it joins the cluster.
This commit is contained in:
@ -77,6 +77,8 @@ typedef struct
|
||||
replicating from the wrong master. */
|
||||
int n_excluded; /**< Number of excluded servers */
|
||||
MXS_MONITORED_SERVER** excluded_servers; /**< Servers banned for master promotion during auto-failover. */
|
||||
const char* promote_sql_file; /**< File with sql commands which are ran to a server being promoted. */
|
||||
const char* demote_sql_file; /**< File with sql commands which are ran to a server being demoted. */
|
||||
|
||||
MXS_MONITOR* monitor;
|
||||
} MYSQL_MONITOR;
|
||||
|
Reference in New Issue
Block a user