VIP1:10.90.11.196linux
VIP2:10.90.11.195redis
DIP1:10.90.11.96vim
DIP2:10.90.11.95tcp
keepalived部署spa
Director一、Director2:debug
yum install keepalived -yrest
vim /etc/keepalived/keepalived.confrouter
10.90.11.96
|
10.90.11.95
|
---|---|
global_defs {
vrrp_instance VI_2 { |
global_defs {
virtual_ipaddress { vrrp_instance VI_2 { |
啓動keepalived
/etc/init.d/keepalived start
部署haproxy
director一、director2:
安裝haproxy:
wget http://pkgs.fedoraproject.org/repo/pkgs/haproxy/haproxy-1.6.9.tar.gz/c52eee40eb66f290d6f089c339b9d2b3/haproxy-1.6.9.tar.gz
tar zxf haproxy-1.6.9.tar.gz -C /usr/local/
cd /usr/local/haproxy-1.6.9
make TARGET=linux2628 ARCH=x86_64 PREFIX=/usr/local/haproxy
make install PREFIX=/usr/local/haproxy
修改配置文件:
vim /usr/local/haproxy/haproxy.cfg
global listen tcptest |
---|
啓動
/usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/haproxy.cfg
重啓
/usr/local/haproxy/sbin/haproxy -f /usr/local/haproxy/haproxy.cfg -st `cat /usr/local/haproxy/haproxy.pid`
中止
killall haproxy
將haproxy加入到系統服務中。腳本內容以下
vim /etc/init.d/haproxy
腳本內容以下:
|
---|
#! /bin/sh #PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/haproxy/sbin # Gracefully exit if the package has been removed. start() stop() restart() case "$1" in exit 0 |