首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > VSTS >

工作总结-三-keepalived_LVS

2013-11-08 
工作总结-3-keepalived_LVS1: keepalived 安装????? 安装 ?????? 采用默认安装目录????? ./configure?? --

工作总结-3-keepalived_LVS

1: keepalived 安装

????? 安装

?????? 采用默认安装目录

????? ./configure?? --mandir=/usr/local/share/man? --with-kernel-dir=/usr/src/kernels/2.6.9-67.EL-smp-i686/
????? make
????? make install

???? 安装 ipvsadm

?

???? confiure 完成后 出现以下 就表示成功 confiure
???? Keepalived configuration

???? ------------------------
???? Keepalived version : 1.1.15
???? Compiler : gcc
???? Compiler flags : -g -O2
???? Extra Lib : -lpopt -lssl -lcrypto
???? Use IPVS Framework : Yes
???? IPVS sync daemon support : Yes
???? Use VRRP Framework : Yes
???? Use LinkWatch : Yes
???? Use Debug flags : No

?

2:? keepalived 配置

?

???? ? ##/opt/keepalived/bin/genhash? -s 192.168.12.x? -p 80 -u /monitor/keep.html
??????? digest fdc8283977e50ff7064f6b2adbec9cf7

?

??????? digest 生成? MD5码。 192.168.12.x是真实IP。

??????? keepalived.cof

?

????? ! Configuration File for keepalived
??????global_defs {??
???? ? router_id LB??
?????}???
?
?
vrrp_instance portal {
??? state MASTER #BACKUP
??? interface eth0
??? virtual_router_id 80
??? priority 80?#BACKUP== 50
??? advert_int 1
??? #nopreempt?
??? authentication {
??????? auth_type PASS
??????? auth_pass 1111
??? }
??? virtual_ipaddress {
??????? 192.168.12.50 dev eth0?
??? }
} #end
?
virtual_server 192.168.12.50 80 {
??? delay_loop 2
??? lb_algo wrr?
??? lb_kind DR
??? #persistence_timeout 5
??? protocol TCP
??? #sorry_server 192.168.200.200 1358
?? #--------------------------------#
??? real_server 192.168.12.53 80 {
???????? weight 10
???????? inhibit_on_failure
???????? HTTP_GET {
??????????? url {?
?????????????? path?? /portal/monitor/monitor.jsp
????????????? ##/opt/keepalived/bin/genhash? -s 192.168.202.50 -p 80 -u /monitor/keep.html
????????????? digest fdc8283977e50ff7064f6b2adbec9cf7
??????????? }
??? ??? #connect_port 18282
??????????? connect_timeout 2
??????????? nb_get_retry 2?
??????????? delay_before_retry 1?
??????? }
??? }
??? #--------------------------------#
?
?
???? real_server 192.168.12.54 80 {
???????? weight 10
???????? inhibit_on_failure
???????? HTTP_GET {
??????????? url {?
????????????? path?? /portal/monitor/monitor.jsp
????????????? ##/opt/keepalived/bin/genhash? -s 192.168.202.50 -p 80 -u /monitor/keep.html
????????????? digest fdc8283977e50ff7064f6b2adbec9cf7
??????????? }
??? ??? #connect_port 18282
??????????? connect_timeout 2
??????????? nb_get_retry 2?
??????????? delay_before_retry 1?
??????? }
??? }
??? #--------------------------------#
?
???? real_server 192.168.12.55 80 {
???????? weight 10
???????? inhibit_on_failure
???????? HTTP_GET {
??????????? url {?
????????????? path?? /portal/monitor/monitor.jsp
????????????? ##/opt/keepalived/bin/genhash? -s 192.168.202.50 -p 80 -u /monitor/keep.html
????????????? digest fdc8283977e50ff7064f6b2adbec9cf7
??????????? }
??? ??? #connect_port 18282
??????????? connect_timeout 2
??????????? nb_get_retry 2?
??????????? delay_before_retry 1?
??????? }
??? }
?#--------------------------------#
?
???? real_server 192.168.12.56 80 {
???????? weight 10
???????? inhibit_on_failure
???????? HTTP_GET {
??????????? url {?
?????????????? path?? /portal/monitor/monitor.jsp
????????????? ##/opt/keepalived/bin/genhash? -s 192.168.202.50 -p 80 -u /monitor/keep.html
????????????? digest fdc8283977e50ff7064f6b2adbec9cf7
??????????? }
??? ??? #connect_port 18282
??????????? connect_timeout 2
??????????? nb_get_retry 2?
??????????? delay_before_retry 1?
??????? }
??? }
?#--------------------------------#
?
???? real_server 192.168.12.57 80 {
???????? weight 10
???????? inhibit_on_failure
???????? HTTP_GET {
??????????? url {?
????????????? path?? /portal/monitor/monitor.jsp
????????????? ##/opt/keepalived/bin/genhash? -s 192.168.202.50 -p 80 -u /monitor/keep.html
????????????? digest fdc8283977e50ff7064f6b2adbec9cf7
??????????? }
??? ??? #connect_port 18282
??????????? connect_timeout 2
??????????? nb_get_retry 2?
??????????? delay_before_retry 1?
??????? }
??? }
?
?? #--------------------------------#
} #END virtual_server

?

3:LVS DR 模式 真实主机 配置脚本

?

#!/bin/bash?
#description : start realserver?
VIP=192.168.12.50
/etc/rc.d/init.d/functions?
case "$1" in?
start)?
echo " start LVS of REALServer"?
echo "1" >/proc/sys/net/ipv4/ip_forward?
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore?
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce?
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore?
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce?
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
;;?
stop)?
/sbin/ifconfig lo:0 down?
echo "close LVS Directorserver"?
echo "0" >/proc/sys/net/ipv4/ip_forward?
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore?
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce?
echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore?
echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce?
;;?
*)?
echo "Usage: $0 {start|stop}"?
exit 1?
esac

5: 启动。

????? VIP 启动?

????? /etc/init.d/keepalived ? ? ? ? ? ? ? ?? start | restart|stop

?

???? Real IP

???? /opt/nginx/keepalivedRealDR.sh?? start|stop

?

?

热点排行