标签:tcp val nec inter 会话 virt digest 16px root
su - root
yum -y install kernel-devel*
yum -y install openssl-*
yum -y install popt-devel
yum -y install lrzsz
yum -y install openssh-clients
1、cd /usr/local
2、rz –y
3、选择keepalived安装文件
tar –zxvf keepalived-1.2.2.tar.gz
mv keepalived-1.2.2 keepalived
1、cd keepalived
2、执行命令
./configure --prefix=/usr/local/keepalived -enable-lvs-syncd --enable-lvs --with-kernel-dir=/lib/modules/2.6.32-431.el6.x86_64/build
3、编译
make
4、安装
make install
cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/
cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
mkdir -p /etc/keepalived
cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
ln -s /usr/local/keepalived/sbin/keepalived /sbin/
global_defs { notification_email {#指定keepalived在发生切换时需要发送email到的对象,一行一个 #acassen@firewall.loc #failover@firewall.loc #sysadmin@firewall.loc } notification_email_from Alexandre.Cassen@firewall.loc#指定发件人 #smtp_server 192.168.200.1#指定smtp服务器地址 #smtp_connect_timeout 30 #指定smtp连接超时时间 router_id LVS_DEVEL#运行keepalived机器的一个标识 }
vrrp_instance VI_1 { state BACKUP#指定那个为master,那个为backup interface eth1#设置实例绑定的网卡 virtual_router_id 51#同一实例下virtual_router_id必须相同 priority 100#定义优先级,数字越大,优先级越高,备机要小于主 advert_int 1#MASTER与BACKUP负载均衡器之间同步检查的时间间隔,单位是秒 nopreempt#设置为不抢占,从启动后主不会自动切换回来, 注:这个配置只能设置在backup主机上,而且这个主机优先级要比另外一台高
authentication {#设置认证 auth_type PASS auth_pass 1111 } virtual_ipaddress {#设置vip 192.168.56.70#虚拟IP } }
virtual_server 192.168.56.70 8080 { delay_loop 6#健康检查时间间隔 lb_algo rr #调度算法rr|wrr|lc|wlc|lblc|sh|dh lb_kind DR #负载均衡转发规则NAT|DR|RUN #nat_mask 255.255.255.0 #需要验证 persistence_timeout 1#会话保持时间 protocol TCP#使用的协议
real_server 192.168.56.201 8080 { weight 10 #默认为1,0为失效 SSL_GET { url { #检查url,可以指定多个 path / digest ff20ad2481f97b1754ef3e12ecd3a9cc #检查后的摘要信息 } url { path /mrtg/ digest 9b3a0c85a887a256d6939da88aabd8cd } connect_timeout 3#连接超时时间 nb_get_retry 3#重连次数 delay_before_retry 3#重连间隔时间 } }
} |
因为keepalive只能监控机器的死活,所以当软件死掉后,keepalived仍然不会切换;
标签:tcp val nec inter 会话 virt digest 16px root
原文地址:https://www.cnblogs.com/starzy/p/9485971.html