Skip to content

Instantly share code, notes, and snippets.

@jayjanssen
Created April 2, 2013 17:55
Show Gist options
  • Save jayjanssen/5294528 to your computer and use it in GitHub Desktop.
Save jayjanssen/5294528 to your computer and use it in GitHub Desktop.
keepalived vip a reader and writer vip (no LB) and PXC cluster check
vrrp_script prefer_node1 {
script "test `hostname` == 'node1'"
interval 600
weight 5
}
vrrp_script prefer_node2 {
script "test `hostname` == 'node2'"
interval 600
weight 5
}
vrrp_script repel_writer_vip {
script "ip address show dev em1 to 192.168.20.100 | bash -c '! grep -v inet'"
interval 2
weight -10
}
vrrp_script bad_pxc {
script "/usr/bin/clustercheck"
interval 2
weight -100
}
vrrp_instance writer_vip {
interface em1
state MASTER
virtual_router_id 60
priority 101
virtual_ipaddress {
192.168.20.100
}
track_script {
prefer_node1
bad_pxc
}
track_interface {
em1
}
}
vrrp_instance reader_vip {
interface em1
state MASTER
virtual_router_id 61
priority 101
virtual_ipaddress {
192.168.20.101
}
track_script {
repel_writer_vip
prefer_node2
bad_pxc
}
track_interface {
em1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment