Skip to content

Commit 4a630b3

Browse files
committed
Merge pull request #10 from matthewfischer/master
Add a way to manually disable the node
2 parents 838eb1a + 7d2f29a commit 4a630b3

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,8 @@ The clustercheck script accepts several arguments:
8686
- **available_when_readonly** (default 1): Depending on this setting and the MySQL status variable 'read_only', the node is reported available
8787
- **defaults_extra_file** (default /etc/my.cnf): This file (if exists) will be passed to the mysql-command with the commandline option --defaults-extra-file
8888

89-
Note: You can also specify the username and password for the check in the **defaults_extra_file** and pass empty values for **user** and **pass**. That way, nobody can see the username and password (which can otherwise be seen, since they are passed to the MySQL CLI)
89+
Note: You can also specify the username and password for the check in the **defaults_extra_file** and pass empty values for **user** and **pass**. That way, nobody can see the username and password (which can otherwise be seen, since they are passed to the MySQL CLI)
90+
91+
## Manually removing a node from the cluster ##
92+
93+
By touching /var/tmp/clustercheck.disabled, an admin may force clustercheck to return 503, regardless as to the actual state of the node. This is useful when the node is being put into maintenance mode.

clustercheck

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ if [[ $1 == '-h' || $1 == '--help' ]];then
1515
exit
1616
fi
1717

18+
# if the disabled file is present, return 503. This allows
19+
# admins to manually remove a node from a cluster easily.
20+
if [ -e "/var/tmp/clustercheck.disabled" ]; then
21+
# Shell return-code is 1
22+
echo -en "HTTP/1.1 503 Service Unavailable\r\n"
23+
echo -en "Content-Type: text/plain\r\n"
24+
echo -en "Connection: close\r\n"
25+
echo -en "Content-Length: 51\r\n"
26+
echo -en "\r\n"
27+
echo -en "Percona XtraDB Cluster Node is manually disabled.\r\n"
28+
sleep 0.1
29+
exit 1
30+
fi
31+
1832
MYSQL_USERNAME="${1-clustercheckuser}"
1933
MYSQL_PASSWORD="${2-clustercheckpassword!}"
2034
AVAILABLE_WHEN_DONOR=${3:-0}

0 commit comments

Comments
 (0)