2台でLVS(failover)
2台でデータベースサーバを動かして片方マスター、片方スレーブにしてfailoverの設定
データ更新はあまりないのでデータ同期は夜中のバッチ
ネットワークを止めたりすると仮想IPアドレスが移るのだけど
サービスを止めても(ポートが閉じても)移らない
そうゆうものなんでしょうね
以下keepalivedの設定(global_defsは抜いて)
でもifdownとか書いてきれいではないがとりあえず目的は達成
-------------------------
Master Server(10.0.0.206)
-------------------------
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.208/24 brd 10.0.0.255 dev eth0
}
}
virtual_server 10.0.0.208 8100 {
delay_loop 3
lvs_sched wlc
lvs_method NAT
nat_mask 255.255.255.0
protocol TCP
real_server 127.0.0.1 8100 {
weight 1
inhibit_on_failure
notify_up STRING
notify_down "/etc/init.d/keepalived stop"
TCP_CHECK {
connect_port 8100
connect_timeout 2
}
}
sorry_server 10.0.0.207 8100
}
-------------------------
Slave Server(10.0.0.207)
-------------------------
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.208/24 brd 10.0.0.255 dev eth0
}
}
virtual_server 10.0.0.208 8100 {
delay_loop 3
lvs_sched wlc
lvs_method NAT
nat_mask 255.255.255.0
protocol TCP
real_server 10.0.0.206 8100 {
weight 1
inhibit_on_failure
notify_up STRING
notify_down STRING
TCP_CHECK {
connect_port 8100
connect_timeout 2
}
}
sorry_server 127.0.0.1 8100
}