Skip to content

Instantly share code, notes, and snippets.

@sts
Last active June 14, 2024 13:14
Show Gist options
  • Save sts/6a17d4af6f905cbc28a6 to your computer and use it in GitHub Desktop.
Save sts/6a17d4af6f905cbc28a6 to your computer and use it in GitHub Desktop.
Percona XDB Clustercheck with SystemD
# /etc/systemd/system/clustercheck.socket
[Unit]
Description=MySQL Clustercheck Socket
[Socket]
ListenStream=9200
Accept=true
[Install]
WantedBy=sockets.target
# /etc/systemd/system/[email protected]
[Unit]
Description=MySQL Clustercheck
After=network.target
[Service]
User=nobody
ExecStart=-/usr/bin/clustercheck clustercheck AoWdTTItrUqNo9aNY
StandardInput=socket
# /etc/rsyslog.d/mysql_clustercheck.conf
#
# systemd log fixup - No, we don't want to log mysql clustercheck systemd
# messages everytime haproxy connects (every 500ms per LB in our case)
if $programname == 'systemd' and $msg contains 'Starting MySQL Clustercheck' then stop
if $programname == 'systemd' and $msg contains 'Started MySQL Clustercheck' then stop

Systemd Clustercheck

Clustercheck is a script to make a proxy (ie. haproxy) capable of monitoring Percona XtraDB Cluster nodes properly. This is a config to run clustercheck/mysqlchk from systemd instead of xinetd.

INSTALL

cp clustercheck.socket /etc/systemd/system
cp [email protected] /etc/systemd/system
systemctl enable clustercheck.socket
systemctl start clustercheck.socket
@agrisvv
Copy link

agrisvv commented Jun 14, 2024

This disable flooding journald. # 4 = warning
[Service]
LogLevelMax=4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment