CentOS 6 Setup 安装

系统环境:CentOS  6.2  x86_64

今天安装了CentOS-6.2-x86_64-minimal版,这个版本太精简了连setup都没有,用着很不方便,下面我把setup的安装方法贴了出来。

yum provides */bin/setup

 

yum install setuptool

 

ok,setup安装成功,不过别高兴太早

setup

 

此时安装的只是简单的setuptool,我们还需要安装一些组建。

yum install  ntsysv system-config-firewall-tui system-config-network-tui

 

注:组建可根据自己需求自行安装

setup

 

ok,这次才是真正的大功告成。

Win2008 R2 Hyper-V安装CentOS 6.3网络适配器问题

Win2008 R2 Hyper-V安装CentOS 6.3网络适配器问题

1.新建虚拟机,将网络适配器更改为“旧版网络适配器”,文字模式下安装(注意:图形界面安装网卡可能会出问题,原因未知)

2、vi /etc/sysconfig/network-scripts/ifcfg-eth0,修改IP地址信息、子网掩码、默认网关等,并将网卡设置为开机启动

3、vi /etc/resolv.conf,添加DNS服务器

4、service network restart,重新启动网卡

5、yum -y  install wget  make kernel-devel gcc perl

安装组件

6、下载LinuxICv34.iso

http://www.microsoft.com/zh-cn/download/details.aspx?id=34603

7、挂载ISO

mount /dev/cdrom /mnt

8、安装

cd /mnt/RHEL63

./install.sh

9、进入Hyper-V管理器,添加“网络适配器”,重新配置IP、掩码、网关等信息

ps:最新版

Linux Integration Services (LIS) 4.0 更新支持 Linux 虚拟机运行在如下 Hyper-V 系统或云平台当中:

  • Windows Server 2008 R2 (applicable editions)
  • Microsoft Hyper-V Server 2008 R2
  • Windows 8/8.1/10 的专业版及以上版
  • Windows Server 2012 和 2012 R2
  • Microsoft Hyper-V Server 2012 和 2012 R2
  • Windows Server Technical Preview
  • Microsoft Hyper-V Server Technical Preview
  • Microsoft Azure

http://pan.baidu.com/s/1dFNrfqT

CentOS 6.3下部署LVS(NAT)+keepalived实现高性能高可用负载均衡 (转载)

一、简介

VS/NAT原理图:

2012082012002614

二、系统环境

实验拓扑:

2012081717141291

系统平台:CentOS 6.3

Kernel:2.6.32-279.el6.i686

LVS版本:ipvsadm-1.26

keepalived版本:keepalived-1.2.4

三、安装

0、安装LVS前系统需要安装popt-static,kernel-devel,make,gcc,openssl-devel,lftp,libnl*,popt*

1、在两台Director Server上分别配置LVS+Keepalived

LVS install ————-

[root@CentOS-LVS_MASTER ~]# wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.26.tar.gz

[root@CentOS-LVS_MASTER ~]# ln -s /usr/src/kernels/2.6.32-279.el6.i686//usr/src/linux/

[root@CentOS-LVS_MASTER ~]# tar zxvf ipvsadm-1.26.tar.gz

[root@CentOS-LVS_MASTER ~]# cd ipvsadm-1.26

[root@CentOS-LVS_MASTER ipvsadm-1.26]# make && make install

Keepalived install ————-

[root@CentOS-LVS_MASTER ~]# wget http://www.keepalived.org/software/keepalived-1.2.4.tar.gz

[root@CentOS-LVS_MASTER ~]# tar zxvf keepalived-1.2.4.tar.gz

[root@CentOS-LVS_MASTER ~]# cd keepalived-1.2.4

[root@CentOS-LVS_MASTER keepalived-1.2.4]# ./configure && make && make install

######### 将keepalived做成启动服务,方便管理##########

[root@CentOS-LVS_MASTER ~]# cp /usr/local/etc/rc.d/init.d/keepalived /etc/init.d/

[root@CentOS-LVS_MASTER ~]# cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/

[root@CentOS-LVS_MASTER ~]# mkdir /etc/keepalived/

[root@CentOS-LVS_MASTER ~]# cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/

[root@CentOS-LVS_MASTER ~]# cp /usr/local/sbin/keepalived /usr/sbin/

[root@CentOS-LVS_MASTER ~]# service keepalived start | stop

2、开启路由转发

[root@CentOS-LVS_MASTER ~]# vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
[root@CentOS-LVS_MASTER ~]# sysctl -p

3、配置Keepalived

[root@CentOS-LVS_MASTER ~]# less /etc/keepalived/keepalived.conf

! Configuration File for keepalived

global_defs {
   router_id LVS_MASTER            #BACKUP上修改为LVS_BACKUP
}

vrrp_instance VI_1 {
    state MASTER                   #BACKUP上修改为BACKUP
    interface eth0
    virtual_router_id 51
    priority 100                   #BACKUP上修改为80
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.0.0.227
    }
}

vrrp_instance LAN_GATEWAY {
    state MASTER                   #BACKUP上修改为LVS_BACKUP
    interface eth1
    virtual_router_id 52
    priority 100                   #BACKUP上修改为80
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.10.10
    }
}

virtual_server 10.0.0.227 80 {
    delay_loop 6
    lb_algo rr
    lb_kind NAT
#   persistence_timeout 5
    protocol TCP

    real_server 192.168.10.4 80 {
        weight 3
        TCP_CHECK {
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
            connect_port 80
        }
    }

    real_server 192.168.10.5 80 {
        weight 3
        TCP_CHECK {
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
            connect_port 80
        }
    }
}

BACKUP服务器同上配置,先安装lvs再安装keepalived,然后配置/etc/keepalived/keepalived.conf,只需将批注部分改一下即可。

4、分别在2台Real Server上面设置网关

把网关都设置成:192.168.10.10

5、在2台RealServer中分别配置HTTP

[root@WEB1 ~]# yum -y install httpd
[root@WEB1 ~]# cd /var/www/html/
[root@WEB1 html]# cat index.html
< h1>WEB1/192.168.10.4</h1>
[root@WEB1 html]# /etc/init.d/httpd start
另一台机器配置一样,过程略。

6、分别在CentOS-LVS_MASTER、CentOS-LVS_BACKUP上执行service keepalived start启动keepalived就可实现负载均衡及高可用集群了;

[root@CentOS-LVS_MASTER keepalived]# service keepalived start

2012082410252367

2012082410270018

四、测试

####高可用性测试####

模拟故障,将CentOS-LVS_MASTER上的keepalived服务停掉,然后观察CentOS-LVS_BACKUP上的日志,信息如下

2012082410340993

从日志中可知,主机出现故障后,备机立刻检测到,此时备机变为MASTER角色,并且接管了主机的虚拟IP资源,最后将虚拟IP绑定在etho设备上。

将CentOS-LVS_MASTER 上的keepalived服务开启后,CentOS-LVS_BACKUP的日志状态。

2012082410365890

从日志可知,备机在检测到主机重新恢复正常后,释放了虚拟IP资源重新成为BACKUP角色

####故障切换测试####

故障切换是测试当某个节点出现故障后,Keepalived监制模块是否能及时发现然后屏蔽故障节点,同时将服务器转移到正常节点来执行。

将WEB2节点服务停掉,假设这个节点出现故障,然后主、备机日志信息如下

2012082410394133

2012082410401438

从以上可以看出,Keepalived监控模块检测到192.168.10.5这台主机出现故障后,将WEB2从集群系统中剔除掉了。 此时访问http://10.0.0.227只能看到WEB1了)

2012082410420635

重新启动WEB2节点的服务,日志信息如下:

2012082410423552

2012082410430629

Keepalived监控模块检测到192.168.10.5这台主机恢复正常后,又将此节点加入集群系统中,再次访问就可以访问到WEB2页面了)

2012082410433584

RHEL 5.4下部署LVS(DR)+keepalived实现高性能高可用负载均衡(转载)

一、简介

LVS是Linux Virtual Server的简写,意即Linux虚拟服务器,是一个虚拟的服务器集群系统。本项目在1998年5月由章文嵩博士成立,是中国国内最早出现的自由软件项目之一。

目前有三种IP负载均衡技术(VS/NAT、VS/TUN和VS/DR);十种调度算法(rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq)。

Keepalived在这里主要用作RealServer的健康状态检查以及LoadBalance主机和BackUP主机之间failover的实现。

LVS+Keepalived能实现的功能:利用LVS控制器主备模式避免单点故障以及自动删除故障WEB服务器结点并当它恢复后再自动添加到群集中。

拓扑图:

2012081715214381

二、系统环境

系统平台:RHEL 5.4

LVS版本:ipvsadm-1.24

keepalived版本:keepalived-1.1.15

三、安装

1、在两台LVS Server上安装lvs、keepalived软件(LVS_MASTER & LVS_BACKUP)
lvs install ————-

[root@LVS-MASTER ~]# wget http://www.linuxvirtualserver.org/software/kernel-2.6/ipvsadm-1.24.tar.gz

[root@LVS-MASTER ~]# ln -s /usr/src/kernels/2.6.18-194.el5-i686//usr/src/linux/

[root@LVS-MASTER ~]# tar zxvf ipvsadm-1.24.tar.gz

[root@LVS-MASTER ~]# cd ipvsadm-1.24

[root@LVS-MASTER ipvsadm-1.24]# make && make install

Keepalived install ————-

[root@LVS-MASTER ~]# wget http://www.keepalived.org/software/keepalived-1.1.15.tar.gz

[root@LVS-MASTER ~]# tar zxvf keepalived-1.1.15.tar.gz

[root@LVS-MASTER ~]# cd keepalived-1.1.15

[root@LVS-MASTER keepalived-1.1.15]# ./configure && make && make install

######### 将keepalived做成启动服务,方便管理##########

[root@LVS-MASTER ~]# cp /usr/local/etc/rc.d/init.d/keepalived /etc/init.d/

[root@LVS-MASTER ~]# cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/

[root@LVS-MASTER ~]# mkdir /etc/keepalived/

[root@LVS-MASTER ~]# cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/

[root@LVS-MASTER ~]# cp /usr/local/sbin/keepalived /usr/sbin/

[root@LVS-MASTER ~]# service keepalived start | stop

2、keepalived的配置

################### MASTER ###################

 ! Configuration File for keepalived

global_defs {
   notification_email {
     root@linux.tang.chao               #设置报警邮件地址,可以设置多个,每行一个。
     mchina_tang@qq.com                 #需开启本机的sendmail服务
   }
   notification_email_from keepalived@localhost         #设置邮件的发送地址
   smtp_server 127.0.0.1                                #设置smtp server地址
   smtp_connect_timeout 30                              #设置连接smtp server的超时时间
   router_id LVS_DEVEL                                  #表示运行keepalived服务器的一个标识。发邮件时显示在邮件主题的信息
}

vrrp_instance VI_1 {
    state MASTER              #指定keepalived的角色,MASTER表示此主机是主服务器,BACKUP表示此主机是备用服务器
    interface eth0            #指定HA监测网络的接口
    virtual_router_id 51      #虚拟路由标识,这个标识是一个数字,同一个vrrp实例使用唯一的标识。即同一vrrp_instance下,MASTER和BACKUP必须是一致的
    priority 100              #定义优先级,数字越大,优先级越高,在同一个vrrp_instance下,MASTER的优先级必须大于BACKUP的优先级
    advert_int 1              #设定MASTER与BACKUP负载均衡器之间同步检查的时间间隔,单位是秒
    authentication {          #设置验证类型和密码
        auth_type PASS        #设置验证类型,主要有PASS和AH两种
        auth_pass 1111        #设置验证密码,在同一个vrrp_instance下,MASTER与BACKUP必须使用相同的密码才能正常通信
    }
    virtual_ipaddress {       #设置虚拟IP地址,可以设置多个虚拟IP地址,每行一个
        10.0.0.148
    }
}

virtual_server 10.0.0.148 80 {      #设置虚拟服务器,需要指定虚拟IP地址和服务端口,IP与端口之间用空格隔开
    delay_loop 6                    #设置运行情况检查时间,单位是秒
    lb_algo rr                      #设置负载调度算法,这里设置为rr,即轮询算法
    lb_kind DR                      #设置LVS实现负载均衡的机制,有NAT、TUN、DR三个模式可选
    persistence_timeout 50          #会话保持时间,单位是秒。这个选项对动态网页是非常有用的,为集群系统中的session共享提供了一个很好的解决方案。
                                    #有了这个会话保持功能,用户的请求会被一直分发到某个服务节点,直到超过这个会话的保持时间。
                                    #需要注意的是,这个会话保持时间是最大无响应超时时间,也就是说,用户在操作动态页面时,如果50秒内没有执行任何操作,
                                    #那么接下来的操作会被分发到另外的节点,但是如果用户一直在操作动态页面,则不受50秒的时间限制
    protocol TCP                    #指定转发协议类型,有TCP和UDP两种

    real_server 10.0.0.137 80 {     #配置服务节点1,需要指定real server的真实IP地址和端口,IP与端口之间用空格隔开
        weight 3                    #配置服务节点的权值,权值大小用数字表示,数字越大,权值越高,设置权值大小可以为不同性能的服务器
                                    #分配不同的负载,可以为性能高的服务器设置较高的权值,而为性能较低的服务器设置相对较低的权值,这样才能合理地利用和分配系统资源
        TCP_CHECK {                 #realserver的状态检测设置部分,单位是秒
            connect_timeout 10      #表示3秒无响应超时
            nb_get_retry 3          #表示重试次数
            delay_before_retry 3    #表示重试间隔
            connect_port 80
        }
    }
    real_server 10.0.0.139 80 {
        weight 3
        TCP_CHECK {
            connect_timeout 10
            nb_get_retry 3
            delay_before_retry 3
            connect_port 80
        }
    }
}

#################### BACKUP ###################

! Configuration File for keepalived

global_defs {
   notification_email {
     root@linux.tang.chao
     mchina_tang@qq.com
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 51
    priority 99
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.0.0.148
    }
}

virtual_server 10.0.0.148 80 {
    delay_loop 6
    lb_algo rr
    lb_kind DR
    persistence_timeout 50
    protocol TCP

    real_server 10.0.0.137 80 {
        weight 3
        TCP_CHECK {
            connect_timeout 10
            nb_get_retry 3
            delay_before_retry 3
            connect_port 80
        }
    }
    real_server 10.0.0.139 80 {
        weight 3
        TCP_CHECK {
            connect_timeout 10
            nb_get_retry 3
            delay_before_retry 3
            connect_port 80
        }
    }
}

3、在两台Web Server上执行realserver.sh脚本,为lo:0绑定VIP地址10.0.0.148、抑制ARP广播。

[root@web1 ~]# cat realserver.sh

#!/bin/bash
#description: Config realserver

VIP=10.0.0.148

/etc/rc.d/init.d/functions

case "$1" in
start)
       /sbin/ifconfig lo:0 $VIP netmask 255.255.255.255 broadcast $VIP
       /sbin/route add -host $VIP dev lo:0
       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
       sysctl -p >/dev/null 2>&1
       echo "RealServer Start OK"
       ;;
stop)
       /sbin/ifconfig lo:0 down
       /sbin/route del $VIP >/dev/null 2>&1
       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 "RealServer Stoped"
       ;;
*)
       echo "Usage: $0 {start|stop}"
       exit 1
esac

exit 0

[root@web1 ~]# sh realserver.sh start

4、分别在LVS-MASTER、LVS-BACKUP上执行service keepalived start启动keepalived就可实现负载均衡及高可用集群了;

[root@LVS-MASTER keepalived]# service keepalived start

[root@LVS-MASTER keepalived]# ipvsadm -L
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 10.0.0.148:http rr persistent 50
-> 10.0.0.139:http Route 3 0 0
-> 10.0.0.137:http Route 3 0 0
[root@LVS-MASTER keepalived]#

查看日志/var/log/messages

[root@LVS-MASTER keepalived]# tail -n 30/var/log/messages
Apr 19 03:59:58 LVS-MASTER avahi-daemon[2845]: Withdrawing address record for10.0.0.148 on eth0.
Apr 19 04:00:19 LVS-MASTER Keepalived: Starting Keepalived v1.2.1 (04/17,2012)
Apr 19 04:00:19 LVS-MASTER Keepalived: Starting Healthcheck child process,pid=5960
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Netlink reflector reportsIP 10.0.0.136 added
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Netlink reflector reportsIP 10.0.0.159 added
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Registering Kernelnetlink reflector
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Registering Kernelnetlink command channel
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Opening file ‘/etc/keepalived/keepalived.conf’.
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Configuration is using :12257 Bytes
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Using LinkWatch kernelnetlink reflector…
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Activating healtcheckerfor service [10.0.0.137:80]
Apr 19 04:00:19 LVS-MASTER Keepalived_healthcheckers: Activating healtcheckerfor service [10.0.0.139:80]
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: Netlink reflector reports IP10.0.0.136 added
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: Netlink reflector reports IP10.0.0.159 added
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: Registering Kernel netlinkreflector
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: Registering Kernel netlink commandchannel
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: Registering gratutious ARP sharedchannel
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: Opening file’/etc/keepalived/keepalived.conf’.
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: Configuration is using : 36698Bytes
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: Using LinkWatch kernel netlinkreflector…
Apr 19 04:00:19 LVS-MASTER Keepalived_vrrp: VRRP sockpool: [ifindex(2),proto(112), fd(11,12)]
Apr 19 04:00:19 LVS-MASTER Keepalived: Starting VRRP child process, pid=5961
Apr 19 04:00:20 LVS-MASTER Keepalived_vrrp: VRRP_Instance(VI_1) Transition toMASTER STATE
Apr 19 04:00:21 LVS-MASTER Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTERSTATE
Apr 19 04:00:21 LVS-MASTER Keepalived_vrrp: VRRP_Instance(VI_1) settingprotocol VIPs.
Apr 19 04:00:21 LVS-MASTER Keepalived_vrrp: VRRP_Instance(VI_1) Sendinggratuitous ARPs on eth0 for 10.0.0.148
Apr 19 04:00:21 LVS-MASTER Keepalived_healthcheckers: Netlink reflector reportsIP 10.0.0.136 added
Apr 19 04:00:21 LVS-MASTER avahi-daemon[2845]: Registering new address recordfor 10.0.0.148 on eth0.
Apr 19 04:00:21 LVS-MASTER Keepalived_vrrp: Netlink reflector reports IP10.0.0.136 added
Apr 19 04:00:26 LVS-MASTER Keepalived_vrrp: VRRP_Instance(VI_1) Sendinggratuitous ARPs on eth0 for 10.0.0.148
[root@LVS-MASTER keepalived]#

四、测试

接下来做高可用性测试&故障切换测试……

####高可用性测试####

模拟故障,将LVS-MASTER上的keepalived服务停掉,然后观察LVS-BACKUP上的日志,信息如下

[root@LVS-BACKUP keepalived]# tail -f /var/log/messages
Apr 19 03:33:04 LVS-BACKUP Keepalived_vrrp: VRRP_Instance(VI_1)Transition to MASTER STATE
Apr 19 03:33:05 LVS-BACKUP Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTERSTATE
Apr 19 03:33:05 LVS-BACKUP Keepalived_vrrp: VRRP_Instance(VI_1) settingprotocol VIPs.
Apr 19 03:33:05 LVS-BACKUP Keepalived_vrrp: VRRP_Instance(VI_1) Sendinggratuitous ARPs on eth0 for 10.0.0.148
Apr 19 03:33:05 LVS-BACKUP Keepalived_vrrp: Netlink reflector reports IP10.0.0.157 added
Apr 19 03:33:05 LVS-BACKUP Keepalived_healthcheckers: Netlink reflector reportsIP 10.0.0.157 added
Apr 19 03:33:05 LVS-BACKUP avahi-daemon[2825]: Registering new address recordfor 10.0.0.148 on eth0.
Apr 19 03:33:10 LVS-BACKUP Keepalived_vrrp: VRRP_Instance(VI_1) Sendinggratuitous ARPs on eth0 for 10.0.0.148

从日志中可知,主机出现故障后,备机立刻检测到,此时备机变为MASTER角色,并且接管了主机的虚拟IP资源,最后将虚拟IP绑定在etho设备上。

将LVS-MASTER 上的keepalived服务开启后,LVS-BACKUP的日志状态。

Apr 19 03:34:02 LVS-BACKUP Keepalived_vrrp: VRRP_Instance(VI_1) Received higher prio advert
Apr 19 03:34:02 LVS-BACKUP Keepalived_vrrp: VRRP_Instance(VI_1)Entering BACKUP STATE
Apr 19 03:34:02 LVS-BACKUP Keepalived_vrrp: VRRP_Instance(VI_1) removing protocol VIPs.
Apr 19 03:34:02 LVS-BACKUP Keepalived_vrrp: Netlink reflector reports IP 10.0.0.157 removed
Apr 19 03:34:02 LVS-BACKUP Keepalived_healthcheckers: Netlink reflector reports IP 10.0.0.157 removed
Apr 19 03:34:02 LVS-BACKUP avahi-daemon[2825]: Withdrawing address record for 10.0.0.148 on eth0.

从日志可知,备机在检测到主机重新恢复正常后,释放了虚拟IP资源重新成为BACKUP角色

####故障切换测试####

故障切换是测试当某个节点出现故障后,Keepalived监制模块是否能及时发现然后屏蔽故障节点,同时将服务器转移到正常节点来执行。

将web2节点服务停掉,假设这个节点出现故障,然后主、备机日志信息如下

Apr 19 03:35:04 LVS-MASTER Keepalived_healthcheckers:TCP connection to [10.0.0.139:80] failed!!!
Apr 19 03:35:04 LVS-MASTER Keepalived_healthcheckers:Removing service [10.0.0.139:80] from VS [10.0.0.148:80]
Apr 19 03:35:04 LVS-MASTER Keepalived_healthcheckers: Remote SMTP server [127.0.0.1:25] connected.

[root@LVS-MASTER keepalived]# ipvsadm -L
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 10.0.0.148:http rr persistent 50
-> 10.0.0.137:http Route 3 0 0
[root@LVS-MASTER keepalived]#

从以上可以看出,Keepalived监控模块检测到10.0.0.139这台主机出现故障后,将些web2从集群系统中剔除掉了。 此时访问http://10.0.0.148只能看到web1了)

2012052321372461

重新启动web2节点的服务,日志信息如下:

Apr 19 03:38:22 LVS-MASTER Keepalived_healthcheckers:TCP connection to [10.0.0.139:80] success.
Apr 19 03:38:22 LVS-MASTER Keepalived_healthcheckers:Adding service [10.0.0.139:80] to VS [10.0.0.148:80]
Apr 19 03:38:22 LVS-MASTER Keepalived_healthcheckers: Remote SMTP server [127.0.0.1:25] connected.

[root@LVS-MASTERkeepalived]# ipvsadm -L
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 10.0.0.148:http rr persistent 50
-> 10.0.0.139:http Route 3 0 0
-> 10.0.0.137:http Route 3 0 0
[root@LVS-MASTER keepalived]#

Keepalived监控模块检测到10.0.0.139这台主机恢复正常后,又将此节点加入集群系统中,再次访问就可以访问到web2页面了)

2012052321375192

PHP在64位Windows2003和IIS下运行

PHP在64位Windows2003和IIS下运行

首先将IIS由64位模式修改为32位模式,只要一个命令即可:

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1 

恢复为64位模式的命令:

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0

PHP的安装与32位模式下是一样的。

IIS的ASP.NET需要重新注册一下才能用

32位:

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

64位:

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0