Skip to content

Instantly share code, notes, and snippets.

@nathwill
Created April 18, 2016 23:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nathwill/343cee2c5dfd4bcf879871f7935a742e to your computer and use it in GitHub Desktop.
Save nathwill/343cee2c5dfd4bcf879871f7935a742e to your computer and use it in GitHub Desktop.
keepalived configuration for tracking redis master
vrrp_script chk_redis_master {
script "redis-cli info replication | grep -q 'role:master'"
interval 2
weight 2
rise 2
fall 2
}
vrrp_instance redis_vip {
interface eth0
state BACKUP
virtual_router_id 49
priority 100
authentication {
auth_type PASS
auth_pass changeme
}
virtual_ipaddress {
10.2.3.49/24 brd 10.2.3.255 dev eth0
}
track_script {
chk_redis_master
}
}
@DRN88
Copy link

DRN88 commented Jul 7, 2017

Just what I needed. Thanks

@johnlaur
Copy link

script must be a single command; to be able to pipe you need to enlist the help of a shell:

script "/usr/bin/sh -c \"redis-cli  info replication | grep -q role:master\""

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