-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from boomfish/feature/systemd
Add files to run clustercheck under systemd
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,22 @@ Also, you should add the mysqlchk service to `/etc/services` before restarting x | |
|
||
Clustercheck will now listen on port 9200 after xinetd restart, and HAproxy is ready to check MySQL via HTTP poort 9200. | ||
|
||
## Setup with systemd ## | ||
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. | ||
|
||
First, create a clustercheckuser that will be doing the checks. | ||
|
||
mysql> GRANT PROCESS ON *.* TO 'clustercheckuser'@'localhost' IDENTIFIED BY 'clustercheckpassword!' | ||
|
||
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. | ||
|
||
To activate the socket, run the following commands: | ||
|
||
# systemctl enable mysqlchk.socket | ||
# systemctl start mysqlchk.socket | ||
|
||
Systemd will now service requests to port 9200 with the clustercheck script, and HAproxy is ready to check MySQL via HTTP port 9200. | ||
|
||
## Setup with shell return values ## | ||
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. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=Percona XtraDB Cluster node check socket | ||
|
||
[Socket] | ||
ListenStream=9200 | ||
Accept=yes | ||
|
||
[Install] | ||
WantedBy=sockets.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Unit] | ||
Description=Percona XtraDB Cluster node check service | ||
|
||
[Service] | ||
ExecStart=-/usr/bin/clustercheck | ||
StandardInput=socket |