Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1348566
  • 博文数量: 112
  • 博客积分: 7112
  • 博客等级: 少将
  • 技术积分: 1299
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-31 16:27
文章分类

全部博文(112)

文章存档

2011年(19)

2010年(20)

2009年(16)

2008年(20)

2007年(37)

分类: LINUX

2007-08-01 15:00:58

 

 

[root@localhost ~/src]# vi /etc/hosts

# that require network functionality will fail.

127.0.0.1               localhost.localdomain localhost localhost.localdomain

221.122.46.212          lvs1

221.122.46.217          lvs2

 

[root@localhost ~/src]# cp ipvsadm-1.21.tar.gz /usr/src

[root@localhost ~/src]# cd /usr/src

[root@localhost /usr/src]# tar -zxvf ipvsadm-1.21.tar.gz

[root@localhost /usr/src]# ln -s linux-2.4.21-4.EL linux

[root@localhost /usr/src]# mv ipvsadm-1.21 ./redhat/SOURCES/

[root@localhost /usr/src]# cd redhat/SOURCES/

[root@localhost /usr/src/redhat/SOURCES]# cd ipvsadm-1.21/

[root@localhost /usr/src/redhat/SOURCES/ipvsadm-1.21]# make

[root@localhost /usr/src/redhat/SOURCES/ipvsadm-1.21]# make install

 

[root@localhost /usr/src/redhat/SOURCES/ipvsadm-1.21]# ipvsadm

IP Virtual Server version 1.0.8 (size=65536)

Prot LocalAddress:Port Scheduler Flags

  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn

 

[root@localhost /usr/src/redhat/SOURCES/ipvsadm-1.21]# cd ~

[root@localhost ~]# cd src

[root@localhost ~/src]# rpm -ivh heartbeat-pils-1.2.3-2.rh.el.3.0.i386.rpm

Preparing...                ########################################### [100%]

   1:heartbeat-pils         ########################################### [100%]

[root@localhost ~/src]# rpm -ivh heartbeat-stonith-1.2.3-2.rh.el.3.0.i386.rpm

Preparing...                ########################################### [100%]

   1:heartbeat-stonith      ########################################### [100%]

[root@localhost ~/src]# rpm -ivh --nodeps heartbeat-ldirectord-1.2.3-2.rh.el.3.0.i386.rpm

Preparing...                ########################################### [100%]

   1:heartbeat-ldirectord   ########################################### [100%]

[root@localhost ~/src]# rpm -ivh --nodeps heartbeat-1.2.3-2.rh.el.3.0.i386.rpm

Preparing...                ########################################### [100%]

   1:heartbeat              ########################################### [100%]

 

[root@localhost ~]# cd /usr/share/doc/heartbeat-ldirectord-1.2.3/

[root@localhost /usr/share/doc/heartbeat-ldirectord-1.2.3]# cp ldirectord.cf /etc/ha.d/

[root@localhost /usr/share/doc/heartbeat-ldirectord-1.2.3]# cd /etc/ha.d

[root@localhost /etc/ha.d]# vi

 

 

 

 

 

#

# Sample ldirectord configuration file to configure various virtual services.

#

# Ldirectord will connect to each real server once per second and request

# /index.html. If the data returned by the server does not contain the

# string "Test Message" then the test fails and the real server will be

# taken out of the available pool. The real server will be added back into

# the pool once the test succeeds. If all real servers are removed from the

# pool then localhost:80 is added to the pool as a fallback measure.

 

# Global Directives

checktimeout=3

checkinterval=1

fallback=127.0.0.1:80

autoreload=yes

logfile="/var/log/ldirectord.log"

#logfile="local0"

quiescent=yes

 

# A sample virual with a fallback that will override the gobal setting

virtual=221.122.46.210:80

        real=221.122.46.219:80 gate

        real=221.122.46.221:80 gate

        real=221.122.46.213:80 gate

        fallback=127.0.0.1:80 gate

        service=http

        request="/manager/lvs_test.html"

        receive="lvs test"

        #virtualhost=some.domain.com.au

        scheduler=rr

        #persistent=600

        #netmask=255.255.255.255

        protocol=tcp

 

[root@localhost /etc/ha.d]# cd /usr/share/doc/heartbeat-1.2.3/

[root@localhost /usr/share/doc/heartbeat-1.2.3]# cp ha.cf /etc/ha.d

[root@localhost /usr/share/doc/heartbeat-1.2.3]# cp haresources /etc/ha.d

[root@localhost /usr/share/doc/heartbeat-1.2.3]# cp authkeys /etc/ha.d

[root@localhost /usr/share/doc/heartbeat-1.2.3]# cd /etc/ha.d

[root@localhost /etc/ha.d]# vi ha.cf

 

 

 

#       File to write debug messages to

debugfile /var/log/ha-debug

#

#

#       File to write other messages to

#

logfile /var/log/ha-log

#

#

#       Facility to use for syslog()/logger

#

logfacility     local0

#

#

#       A note on specifying "how long" times below...

#

#       The default time unit is seconds

#               10 means ten seconds

#

#

#       keepalive: how long between heartbeats?

#

keepalive 2

#

#       deadtime: how long-to-declare-host-dead?

#

#               If you set this too low you will get the problematic

#               split-brain (or cluster partition) problem.

#               See the FAQ for how to use warntime to tune deadtime.

#

deadtime 30

#

#       warntime: how long before issuing "late heartbeat" warning?

#       See the FAQ for how to use warntime to tune deadtime.

#

warntime 10

#

#

#       Very first dead time (initdead)

#

#       On some machines/OSes, etc. the network takes a while to come up

#       and start working right after you've been rebooted.  As a result

#       we have a separate dead time for when things first come up.

#       It should be at least twice the normal dead time.

#

initdead 120

#

#

#       What UDP port to use for bcast/ucast communication?

#

udpport 694    

#

#       Baud rate for serial ports...

#

#baud   19200

#

#       serial  serialportname ...

#serial /dev/ttyS0      # Linux

#serial /dev/cuaa0      # FreeBSD

#serial /dev/cua/a      # Solaris

#

#

#       What interfaces to broadcast heartbeats over?

#

#ucast eth0 192.168.1.2

ucast eth1      10.0.0.5

 

[root@localhost /etc/ha.d]# lsmod

Module                  Size  Used by    Not tainted

ip_vs                  68192   0  (autoclean) (unused)

autofs                 13780   0  (autoclean) (unused)

e1000                  71424   1  (autoclean)

microcode               5248   0  (autoclean)

ide-cd                 35776   0  (autoclean)

cdrom                  34144   0  (autoclean) [ide-cd]

keybdev                 2976   0  (unused)

mousedev                5688   0  (unused)

hid                    22404   0  (unused)

input                   6208   0  [keybdev mousedev hid]

ehci-hcd               20904   0  (unused)

usb-uhci               27532   0  (unused)

usbcore                83168   1  [hid ehci-hcd usb-uhci]

ext3                   95784   4

jbd                    56856   4  [ext3]

megaraid2              38952   8

sd_mod                 13744  16

scsi_mod              116904   2  [megaraid2 sd_mod]

[root@localhost /etc/ha.d]# insmod softdog

Using /lib/modules/2.4.21-4.ELsmp/kernel/drivers/char/softdog.o

[root@localhost /etc/ha.d]# lsmod

Module                  Size  Used by    Not tainted

softdog                 3004   0  (unused)

ip_vs                  68192   0  (autoclean) (unused)

autofs                 13780   0  (autoclean) (unused)

e1000                  71424   1  (autoclean)

microcode               5248   0  (autoclean)

ide-cd                 35776   0  (autoclean)

cdrom                  34144   0  (autoclean) [ide-cd]

keybdev                 2976   0  (unused)

mousedev                5688   0  (unused)

hid                    22404   0  (unused)

input                   6208   0  [keybdev mousedev hid]

ehci-hcd               20904   0  (unused)

usb-uhci               27532   0  (unused)

usbcore                83168   1  [hid ehci-hcd usb-uhci]

ext3                   95784   4

jbd                    56856   4  [ext3]

megaraid2              38952   8

sd_mod                 13744  16

scsi_mod              116904   2  [megaraid2 sd_mod]

[root@localhost /etc/ha.d]# grep misc /proc/devices

 10 misc

[root@localhost /etc/ha.d]# cat /proc/misc |grep watchdog

130 watchdog

[root@localhost /etc/ha.d]#  mknod /dev/watchdog c 10 130

[root@localhost /etc/ha.d]# ls -l /dev/watchdog

crw-r--r--    1 root     root      10, 130 Apr 11 17:43 /dev/watchdog

[root@localhost /etc/ha.d]# vi ha.cf

#

watchdog /dev/watchdog

#

#       Tell what machines are in the cluster

#       node    nodename ...    -- must match uname -n

node    lvs1

node    lvs2

#

#       Less common options...

#

#       Treats 10.10.10.254 as a psuedo-cluster-member

#       Used together with ipfail below...

#

#ping 10.10.10.254

ping ns2.u-happy.com

#

#respawn userid /path/name/to/run

respawn hacluster /usr/lib/heartbeat/ipfail

 

[root@localhost /etc/ha.d]# vi haresources

#       Regarding the node-names in this file:

#

#       They must match the names of the nodes listed in ha.cf, which in turn

#       must match the `uname -n` of some node in the cluster.  So they aren't

#       virtual in any sense of the word.

#

lvs1 IPaddr::221.122.46.210/24/221.122.46.255 ipvsadm ldirectord::

 

[root@localhost /etc/ha.d]# vi authkeys

#       crc adds no security, except from packet corruption.

#               Use only on physically secure networks.

#

auth 1

1 crc

#2 sha1 HI!

#3 md5 Hello!

 

[root@localhost /etc/ha.d]# chmod 600 authkeys

[root@localhost /etc/ha.d]# cd /etc/rc.d

[root@localhost /etc/rc.d]# vi rc.sysinit

/sbin/insmod  softdog

[root@localhost /etc/rc.d]# sync

[root@localhost /etc/rc.d]# sync;reboot

阅读(1848) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~