群集方案-Heartbeat+VS/DR+Ganglia-2
原创
©著作权归作者所有:来自51CTO博客作者markgeng的原创作品,请联系作者获取转载授权,否则将追究法律责任
群集方案-Heartbeat+VS/DR+Ganglia-2
6.8G 3.1G 3.4G
48% /
6.8G 3.1G 3.4G
48% /
2009/08/02 _17:10:04 INFO: IPaddr Resource is stopped
3.Realserver1(web1:192.168.0.30),Realserver2(web2:192.168.0.31)上做下面配置:
[root@gb-jieshi05 ~]# cat
/etc/init.d/lvsDR.sh
#!/bin/bash
ifconfig lo:0 192.168.0.131 broadcast
192.168.0.131 netmask 255.255.255.255 up
route add -host 192.168.0.131 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
[root@gb-jieshi05 ~]# chmod 755
/etc/init.d/lvsDR.sh
[root@gb-jieshi05 ~]# ifconfig
eth0
Link encap:Ethernet HWaddr 00:0C :29:4F :8A :3D
inet addr:192.168.0.30
Bcast:192.168.0.255
Mask:255.255.255.0
inet6 addr: fe80::20c :29ff:fe4f :8a 3d/64
Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500 Metric:1
RX packets:1065 errors:0 dropped:0 overruns:0 frame:0
TX packets:320 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:202881 (198.1 KiB) TX
bytes:36051 (35.2 KiB)
Interrupt:185 Base address:0x2024
lo
Link encap:Local Loopback
inet addr:127.0.0.1
Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING
MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX
bytes:560 (560.0 b)
[root@gb-jieshi05 ~]# vi /etc/rc.d/rc.local
/etc/init.d/lvsDR.sh
[root@gb-jieshi05 ~]# /etc/init.d/lvsDR.sh
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route =
0
kernel.sysrq = 0
kernel.core_uses_pid = 1
[root@gb-jieshi05 ~]# ifconfig
eth0
Link encap:Ethernet HWaddr 00:0C :29:4F :8A :3D
inet addr:192.168.0.30
Bcast:192.168.0.255
Mask:255.255.255.0
inet6 addr: fe80::20c :29ff:fe4f :8a 3d/64
Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500 Metric:1
RX packets:1655 errors:0 dropped:0 overruns:0 frame:0
TX packets:512 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:307958 (300.7 KiB) TX
bytes:57927 (56.5 KiB)
Interrupt:185 Base address:0x2024
lo
Link encap:Local Loopback
inet addr:127.0.0.1
Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING
MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX
bytes:560 (560.0 b)
lo:0
Link encap:Local Loopback
inet addr:192.168.0.131
Mask:255.255.255.255
UP LOOPBACK RUNNING
MTU:16436 Metric:1
[root@gb-jieshi05 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
/dev/sda1 99M 14M 81M
14% /boot
none 97M 0 97M 0% /dev/shm
[root@gb-jieshi05 ~]# clear
[root@gb-jieshi05 ~]# mount -t nfs
192.168.0.19:/share /ha
[root@gb-jieshi05 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
/dev/sda1 99M 14M 81M
14% /boot
none 97M 0 97M 0% /dev/shm
192.168.0.19:/share 7.9G 51M 7.5G 1% /ha
[root@gb-jieshi05 ~]# vi /etc/fstab
192.168.0.19:/share /ha nfs defaults 0 0
[root@gb-jieshi05 ~]# cd /ha
[root@gb-jieshi05
ha ]# mkdir www
[root@gb-jieshi05
ha ]# cd www
[root@gb-jieshi05 www]# ls
index.html
[root@gb-jieshi05 www]# cat index.html
This is ok! yes ! markgeng.192.168.0.131
ServerName 192.168.0.30:80
DocumentRoot "/ha/www/"
[root@gb-jieshi05 www]# vi
/etc/httpd/conf/httpd.conf
[root@gb-jieshi05 ~]# /etc/init.d/httpd
start
Starting httpd:
[ OK ]
[root@gb-jieshi05 ~]# chkconfig --add httpd
[root@gb-jieshi05 ~]# chkconfig --list
httpd
httpd 0:off 1:off
2:off 3:off 4:off
5:off 6:off
[root@gb-jieshi05 ~]# chkconfig --level 35
httpd on
[root@gb-jieshi05 ~]# chkconfig --list
httpd
httpd 0:off 1:off
2:off 3:on 4:off
5:on 6:off
[root@gb-jieshi05 ~]# links
http://192.168.0.30
This is ok! yes ! markgeng.192.168.0.131
OK
This is ok! yes ! markgeng.192.168.0.131
4.在HA【(gb-jieshi02,192.168.0.17),(gb-jieshi03,192.168.0.18) 上的配置
[root@gb-jieshi02 src]# rpm -qa|grep
e2fsprogs-devel
e2fsprogs-devel-1.35-12.17.el4
[root@gb-jieshi02 RPMS]# rpm -aq|grep
pkgconfig
pkgconfig-0.15.0 -3
[root@gb-jieshi02 RPMS]# rpm -aq|grep
glib2-devel
glib2-devel-2.4.7 -1
[root@gb-jieshi02 RPMS]# rpm -ivh gnutls-1.0.20 -4.el4_6.i386.rpm
[root@gb-jieshi02 RPMS]# rpm -ivh
libgpg-error-devel-1.0-1.i386.rpm
[root@gb-jieshi02 RPMS]# rpm -ivh
libgcrypt-devel-1.2.0 -3.i386.rpm
[root@gb-jieshi02 RPMS]# rpm -ivh
gnutls-devel-1.0.20 -4.el4_6.i386.rpm
[root@gb-jieshi02 src]# tar -zxvf
libnet.tar.gz
[root@gb-jieshi02 src]# cd libnet
[root@gb-jieshi02 libnet]# ./configure
[root@gb-jieshi02 libnet]# time make
[root@gb-jieshi02 libnet]# make install
[root@gb-jieshi02 src]# groupadd -g 2000
haclient
[root@gb-jieshi02 src]# useradd -u 2000 -g
haclient hacluster
[root@gb-jieshi02 src]# tar -zxvf heartbeat-2.0.7 .tar.gz
[root@gb-jieshi02 src]# cd heartbeat-2.0.7
[root@gb-jieshi02 heartbeat-2.0.7 ]#
./ConfigureMe configure --enable-mgmt
--with-ccmuser-name=hacluster
[root@gb-jieshi02 heartbeat-2.0.7 ]#
time make
[root@gb-jieshi02 heartbeat-2.0.7 ]#
make install
[root@gb-jieshi02 ~]# vi /etc/ha.d/ha.cf
logfile /var/log/ha-log
bcast eth1
keepalive 2
warntime 10
deadtime 20
udpport 694
auto_failback on
node gb-jieshi02 gb-jieshi03
ping gb-jieshi01
respawn hacluster /usr/lib/heartbeat/ccm
respawn hacluster /usr/lib/heartbeat/ipfail
[root@gb-jieshi02
ha .d]# cat /etc/init.d/vip.sh
#!/bin/sh
ifconfig eth0:0 192.168.0.131 broadcast
192.168.0.131 netmask 255.255.255.255 up
route add -host 192.168.0.131 dev eth0:0
######setup ipvs#########
ipvsadm -C
ipvsadm -A -t 192.168.0.131:80 -s rr
ipvsadm -a -t 192.168.0.131:80 -r
192.168.0.30:80 -g -w 1
ipvsadm -a -t 192.168.0.131:80 -r
192.168.0.31:80 -g -w 1
ipvsadm -L -n
[root@gb-jieshi02
ha .d]# chmod 755 /etc/init.d/vip.sh
[root@gb-jieshi02 ~]# vi
/etc/ha.d/haresources
gb-jieshi02 192.168.0.131 vip.sh
[root@gb-jieshi02 ~]# vi /etc/ha.d/authkeys
auth 1
1 sha1 jieshi.com
[root@gb-jieshi02 ~]# chmod 600
/etc/ha.d/authkeys
[root@gb-jieshi02 ~]# scp
/etc/init.d/vip.sh root@192.168.0.18:/etc/init.d/
root@192.168.0.18's password:
vip.sh
100% 337
0.3KB/s 00:00
[root@gb-jieshi02 ~]# scp /etc/ha.d/ha.cf
root@192.168.0.18:/etc/ha.d/
root@192.168.0.18's password:
ha.cf
100% 233 0.2KB/s
00:00
[root@gb-jieshi02 ~]# scp
/etc/ha.d/haresources root@192.168.0.18:/etc/ha.d/
root@192.168.0.18's password:
haresources 100% 35
0.0KB/s 00:00
[root@gb-jieshi02 ~]# scp
/etc/ha.d/authkeys root@192.168.0.18:/etc/ha.d/
root@192.168.0.18's password:
authkeys
100% 25 0.0KB/s
00:00
[root@gb-jieshi02 ~]# ifconfig
eth0
Link encap:Ethernet HWaddr 00:0C :29:0D:00:C3
inet addr:192.168.0.17
Bcast:192.168.0.255
Mask:255.255.255.0
inet6 addr: fe80::20c :29ff:fe0d:c3/64
Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500 Metric:1
RX packets:14601 errors:0 dropped:0 overruns:0 frame:0
TX packets:7711 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2377460 (2.2 MiB) TX
bytes:893812 (872.8 KiB)
Interrupt:185 Base address:0x2024
eth1
Link encap:Ethernet HWaddr 00:0C :29:0D:00:CD
inet addr:10.10.10 .1 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c :29ff:fe0d:cd/64
Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500 Metric:1
RX packets:3293 errors:0 dropped:0 overruns:0 frame:0
TX packets:2713 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:749311 (731.7 KiB) TX
bytes:677211 (661.3 KiB)
Interrupt:193 Base address:0x20a 4
lo
Link encap:Local Loopback
inet addr:127.0.0.1
Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING
MTU:16436 Metric:1
RX packets:46 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0
overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5457 (5.3 KiB) TX
bytes:5457 (5.3 KiB)
[root@gb-jieshi02 ~]# ipvsadm -L -n
IP Virtual Server version 1.2.0
(size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port
Forward Weight ActiveConn InActConn
[root@gb-jieshi02 ~]# /etc/init.d/heartbeat
start
Starting High-Availability services:
[ OK ]
[root@gb-jieshi02 ~]# ifconfig
eth0
Link encap:Ethernet HWaddr 00:0C :29:0D:00:C3
inet addr:192.168.0.17
Bcast:192.168.0.255
Mask:255.255.255.0
inet6 addr: fe80::20c :29ff:fe0d:c3/64
Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500 Metric:1
RX packets:14837 errors:0 dropped:0 overruns:0 frame:0
TX packets:7896 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2406354 (2.2 MiB) TX
bytes:914720 (893.2 KiB)
Interrupt:185 Base address:0x2024
eth0:0
Link encap:Ethernet HWaddr 00:0C :29:0D:00:C3
inet addr:192.168.0.131
Bcast:192.168.0.131
Mask:255.255.255.255
UP BROADCAST RUNNING MULTICAST
MTU:1500 Metric:1
Interrupt:185 Base address:0x2024
eth1
Link encap:Ethernet HWaddr 00:0C :29:0D:00:CD
inet addr:10.10.10 .1 Bcast:10.10.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c :29ff:fe0d:cd/64
Scope:Link
UP BROADCAST RUNNING MULTICAST
MTU:1500 Metric:1
RX packets:3318 errors:0 dropped:0 overruns:0 frame:0
TX packets:2745 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:751144 (733.5 KiB) TX
bytes:685270 (669.2 KiB)
Interrupt:193 Base address:0x20a 4
lo
Link encap:Local Loopback
inet addr:127.0.0.1
Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:48 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5625 (5.4 KiB) TX
bytes:5625 (5.4 KiB)
[root@gb-jieshi02 ~]# ipvsadm -L -n
IP Virtual Server version 1.2.0
(size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port
Forward Weight ActiveConn InActConn
TCP
192.168.0.131:80 rr
-> 192.168.0.31:80
Route 1 0
0
-> 192.168.0.30:80
Route 1 0
0
[root@gb-jieshi02 ~]# chkconfig --add
heartbeat
[root@gb-jieshi02 ~]# chkconfig --level 24
heartbeat off
[root@gb-jieshi02 ~]# chkconfig --list
heartbeat
heartbeat 0:off 1:off 2:off 3:on 4:off 5:on 6:off
![](https://ucenter.51cto.com/images/noavatar_middle.gif)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
ansible部署lvs集群DR模式
lvs集群DR模式部署
服务器 IP vim -
群集方案-Heartbeat+LVS/DR+Ganglia-4
群集方案-Heartbeat+VS/DR+Ganglia-4
职场 方案 休闲 Heartbeat 群集 -
HA 高可用性群集--(heartbeat,LVA-DR,ldirectord)
当集群中的一个系统发生故障时,集群软件迅速做出反映,将该系统的任务分配到集群中其它正在工作的系统上执行。
heartbeat ldirectord 高可用性群集 LVA-DR -
LVS+Heartbeat+ldirectord构建高可用负载均衡群集(DR模式)
表1.1IP地址参数设置 名称 角色 IP地址
Heartbeat LVS ldirectord 构建高可用负载均衡群集