Last active
March 31, 2019 02:02
-
-
Save dotmanila/4a3811db1d1d6b2fb5882faf55d1f1e9 to your computer and use it in GitHub Desktop.
pt-heartbeat implementation via Orchestrator nodes.
This file contains hidden or 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
#!/bin/bash | |
OC=/usr/bin/orchestrator-client | |
IPADDR=$(/sbin/ip ad sh dev eth0 scope global | grep -oE "inet\s(.*)\/" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") | |
RAFTLEADER=$($OC -c raft-leader | cut -d: -f1) | |
if [ "x${IPADDR}" != "x${RAFTLEADER}" ]; then | |
exit 0 | |
fi | |
for h in $($OC -c api --path masters | jq -r 'map(select(.IsDowntimed == false))[] | .Key.Hostname'); do | |
pt-heartbeat --create-table --create-table-engine=InnoDB --check-read-only \ | |
--database=percona --table=heartbeat --host=$h --update --daemonize \ | |
--run-time=299 --defaults-file=/etc/my.cnf.d/orchestrator.cnf | |
done | |
# pt-heartbeat --create-table --create-table-engine=InnoDB --check-read-only \ | |
# --database=percona --table=heartbeat --host=localhost --update --daemonize \ | |
# --run-time=299 --defaults-file=/root/.my.cnf --read-only-interval=298 --replace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment