keepalived+haproxy

vip 192.168.0.198
master 192.168.0.236
backup 192.168.0.233
ngnix 192.168.0.202
httpd 192.168.0.232

236/etc/keepalived/keepalived.conf
configuration File for keepalived

global_defs {
notification_email {br/>[email protected]
[email protected]
br/>[email protected]
}
notification_email_from [email protected]
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr

vrrp_strict

vrrp_garp_interval 0
vrrp_gna_interval 0
}

vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
}

vrrp_instance VI_1 {
state BACKUP
interface eth1
virtual_router_id 51
priority 90
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
track_script {
chk_haproxy
}
virtual_ipaddress {
192.168.0.198/24 dev eth1
}

                    systemctl status keepalived

233! Configuration File for keepalived

global_defs {
notification_email {br/>[email protected]
[email protected]
br/>[email protected]
}
notification_email_from [email protected]
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
vrrp_skip_check_adv_addr

vrrp_strict

vrrp_garp_interval 0
vrrp_gna_interval 0
}

vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 2
}

vrrp_instance VI_1 {
state MASTER
interface eth1
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
track_script {
chk_haproxy
}
virtual_ipaddress {
192.168.0.198/24 dev eth1
}

}

236 233 haproxy
/usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/conf/haproxy.cfg

global
daemon
maxconn 60000
pidfile /var/run/haproxy.pid
log 127.0.0.1 local0 info
user haproxy
group haproxy
nbproc 1
daemon
defaults
mode http
log global
timeout connect 10s
timeout client 20s
timeout server 30s
timeout check 5s
frontend http-in
bind :80
mode http
option httplog
option forwardfor
option httpclose
log global
default_backend dynamic_servers
backend dynamic_servers
mode http
option redispatch
option abortonclose
balance roundrobin
cookie SERVERID
option httpchk GET /index.html
server webser1 192.168.0.202:80 cookie webser1 maxconn 300 check
server webser2 192.168.0.232:80 cookie webser2 maxconn 300 check
listen stats
bind
:9188
mode http
maxconn 10
stats refresh 30s
stats uri /stats
stats realm welcome login\HAProxy
stats auth admin:admin
stats admin if TRUE

http://192.168.0.233:9188/stats admin/admin

killall haproxy

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章