Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jayjanssen/5263809 to your computer and use it in GitHub Desktop.

Select an option

Save jayjanssen/5263809 to your computer and use it in GitHub Desktop.
Total WIP
vrrp_script chk_node1 {
script "test `hostname` == 'node1'"
interval 2
weight 5
}
vrrp_script chk_node3 {
script "test `hostname` == 'node3'"
interval 2
weight 2
}
vrrp_script reader_preferred {
script "test `hostname` == 'node2'"
interval 2
weight 5
}
vrrp_script repel_master_ip {
script "ip address show dev eth1 to 192.168.70.100 | grep inet"
interval 2
weight -10
}
vrrp_instance WRITER {
interface eth1
state MASTER
virtual_router_id 60
priority 101
virtual_ipaddress {
192.168.70.100
}
track_script {
chk_node1
chk_node3
}
track_interface {
eth1
}
}
vrrp_instance READER {
interface eth1
state MASTER
virtual_router_id 61
priority 101
virtual_ipaddress {
192.168.70.101
}
track_interface {
eth1
}
}
virtual_server 192.168.70.101 3306 {
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
protocol TCP
ha_suspend
real_server 192.168.70.2 3306 {
weight 1
TCP_CHECK {
connect_timeout 10
connect_port 3306
}
}
real_server 192.168.70.3 3306 {
weight 1
TCP_CHECK {
connect_timeout 10
connect_port 3306
}
}
real_server 192.168.70.4 3306 {
weight 1
TCP_CHECK {
connect_timeout 10
connect_port 3306
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment