Skip to content

Commit d5da8be

Browse files
authored
Merge pull request #15 from boomfish/feature/systemd
Add files to run clustercheck under systemd
2 parents 14d829c + 4ab9275 commit d5da8be

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ Also, you should add the mysqlchk service to `/etc/services` before restarting x
5454

5555
Clustercheck will now listen on port 9200 after xinetd restart, and HAproxy is ready to check MySQL via HTTP poort 9200.
5656

57+
## Setup with systemd ##
58+
This setup will register a socket on TCP port 9200 and an associated instantiated service with systemd. Connections to the socket will be forwarded to the clustercheck script from this repository to report the status of the node.
59+
60+
First, create a clustercheckuser that will be doing the checks.
61+
62+
mysql> GRANT PROCESS ON *.* TO 'clustercheckuser'@'localhost' IDENTIFIED BY 'clustercheckpassword!'
63+
64+
Copy the clustercheck from the repository to `/usr/bin` and make it executable. Then copy the `mysqlck.socket` and `[email protected]` files (under `systemd`) in the repository to `/usr/lib/systemd/system` and make them world-readable.
65+
66+
To activate the socket, run the following commands:
67+
68+
# systemctl enable mysqlchk.socket
69+
# systemctl start mysqlchk.socket
70+
71+
Systemd will now service requests to port 9200 with the clustercheck script, and HAproxy is ready to check MySQL via HTTP port 9200.
72+
5773
## Setup with shell return values ##
5874
If you do not want to use the setup with xinetd, you can also execute `clustercheck` on the commandline and check for the return value.
5975

systemd/mysqlchk.socket

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[Unit]
2+
Description=Percona XtraDB Cluster node check socket
3+
4+
[Socket]
5+
ListenStream=9200
6+
Accept=yes
7+
8+
[Install]
9+
WantedBy=sockets.target

systemd/[email protected]

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Unit]
2+
Description=Percona XtraDB Cluster node check service
3+
4+
[Service]
5+
ExecStart=-/usr/bin/clustercheck
6+
StandardInput=socket

0 commit comments

Comments
 (0)