RHEL6.6
Epel Source
Local source
Primary director Server 192.168.1.3 hostname node1.mingxiao.info Node1
Prepare Director Server 192.168.1.4 host name Node2.mingxiao.info Node2
Real Server1 192.168.1.5
Real Server2 192.168.1.6
VIP 192.168.1.10
Master and Standby DS time synchronization
Master and Standby DS dual-Machine Trust
The primary and standby DS node name is the same as Uname-n
Node1 Edit/etc/hosts file
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain Localhost6 localhost6.localdomain6192.168.1.3 node1.mingxiao.info node1192.168.1.4 node2.mingxiao.info node2
# scp/etc/hosts node2:/etc/
Two-Machine mutual trust
node1# ssh-keygen-t rsa-f ~/.ssh/id_rsa# ssh-copy-id-i. Ssh/id_rsa.pub node1node2 # ssh-keygen-t Rsa-f ~/.ssh/id_rsa # ssh-copy-id-i. Ssh/id_rsa.pub Node2
Time synchronization
# ntpdate time.windows.com# ssh node2 ' ntpdate time.windows.com '
Installing Ldirectord
# RPM-IVH ldirectord-3.9.5-3.1.x86_64.rpm# ssh node2 ' rpm-ivh/root/ldirectord-3.9.5-3.1.x86_64.rpm '
# cp/usr/share/doc/ldirectord-3.9.5/ldirectord.cf/etc/ha.d/
vim /etc/ha.d/ldirectord.cf# global directiveschecktimeout=3checkinterval=1#fallback= 127.0.0.1:80#fallback6=[::1]:80autoreload=no#logfile= "/var/log/ldirectord.log" #logfile = "local0" #emailalert = "[ Email protected] "#emailalertfreq =3600#emailalertstatus=allquiescent=no# sample for an http virtual servicevirtual=192.168.1.10:80 Real=192.168.1.5:80 gate real=192.168.1.6:80 gate fallback=127.0.0.1:80 gate service=http scheduler=rr #persistent =600 #netmask = 255.255.255.255 protocol=tcp checktype=negotiate checkport=80 request= ". Test.html " receive=" OK " # Be sure to have the same content as the. test.html, or else be wrong virtualhost=www.x.y.z
# SCP/ETC/HA.D/LDIRECTORD.CF Node2:/etc/ha.d/
RS1
# yum -y install httpd# echo rs1 > /var/www/html/index.html# echo OK > /var/www/html/.test.html # service httpd start# ifconfig lo:0 192.168.1.10 broadcast 192.168.1.10 netmask 255.255.255.255 up# route add –host 192.168.1.10 dev lo : 0# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore# echo 1 > / proc/sys/net/ipv4/conf/all/arp_ignore# echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce# echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce
RS2
With RS1
Node1
# yum Install Corosync pacemaker Red Hat 6 removed CRMSH, therefore requires additional installation # Yum Localinstall crmsh-2.1-1.6.x86_64.rpm
# vim /etc/corosync.confcompatibility: whitetanktotem { version: 2 secauth: off threads: 0 interface { ringnumber: 0 bindnetaddr: 192.168.1.0 mcastaddr: 239.255.1.1 mcastport: 5405 ttl: 1 }} Logging { fileline: off to_stderr: no to_logfile: yes logfile: /var/log/cluster/corosync.log to_ syslog: yes debug: off timestamp: on logger_subsys { subsys: amf debug: off }}service { ver: 0 name: pacemaker}aisexec { &Nbsp;user: root group: root}
# service Corosync Start
Node2 with Node1
# CRM Statuslast Updated:mon May 4 18:25:16 2015Last Change:mon could 4 18:25:14 2015stack:classic Openais (with plugin ) Current dc:node2.mingxiao.info-partition with Quorumversion:1.1.11-97629de2 Nodes configured, 2 expected Votes2 Resou RCEs configuredonline: [Node1.mingxiao.info Node2.mingxiao.info]
Configure Resources
CRM (Live) configure# property No-quorum-policy=ignorecrm (Live) configure# property Stonith-enabled=falsecrm (Live) configure# Porperty Resource-stickiness=100crm (live) configure# primitive webip ipaddr params ip=192.168.1.10 nic=eth0 Cidr_netmask=24crm (live) configure# primitive Ldirectord lsb:ldirectord op start timeout=15s interval=0 op stop timeout= 15s Interval=0crm (Live) configure# colocation webip_with_ldirectord Inf:webip Ldirectordcrm (live) configure# order Ldirectord_after_webip Inf:webip Ldirectordcrm (Live) configure# Verifycrm (live) configure# commit
Profile Paste-Out
CRM (Live) configure# shownode node1.mingxiao.info attributes standby=offnode node2.mingxiao.info attributes standby=onprimitive ldirectord lsb:ldirectord op start timeout=15s interval=0 op stop timeout=15s interval=0primitive webip IPaddr params ip=192.168.1.10 nic=eth0 cidr_netmask= 24colocation webip_with_ldirectord inf: webip ldirectordorder ldirectord_after_webip inf: webip ldirectordproperty cib-bootstrap-options: dc-version=1.1.11-97629de Cluster-infrastructure= "Classic openais&nbSP; (with plugin) " expected-quorum-votes=2 stonith-enabled=false no-quorum-policy=ignorersc_defaults rsc-options: resource-stickiness=100#vim:set syntax=pcmk
View Status:
# CRM Statuslast Updated:mon May 4 18:33:31 2015Last Change:mon could 4 18:25:14 2015stack:classic Openais (with plugin ) Current dc:node2.mingxiao.info-partition with Quorumversion:1.1.11-97629de2 Nodes configured, 2 expected Votes2 Resou RCEs configuredonline: [Node1.mingxiao.info node2.mingxiao.info] Webip (ocf::heartbeat:ipaddr): Started Node1.mingxiao.info Ldirectord (Lsb:ldirectord): Started node1.mingxiao.info
You can see that the VIP has been configured successfully
# ip addr show1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid _lft forever preferred_lft forever2: eth0: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:55:0d:82 brd ff:ff:ff:ff:ff:ff inet 192.168.1.3 /24 brd 192.168.1.255 scope global eth0 inet 192.168.1.10 /24 brd 192.168.1.255 scope global secondary eth0 inet6 fe80::20c:29ff:fe55:d82/64 scope link valid_lft forever Preferred_lft forever
View LVS routing table information to see two RS online
# Ipvsadm-lnip Virtual Server version 1.2.1 (size=4096) Prot localaddress:port Scheduler Flags-Remoteaddress:port Forward Weight activeconn inactconntcp 192.168.1.10:80 rr--192.168.1.5:80 Route 1 0 0-192.168.1.6:80 Route 1 0 0
It is now running on the Master Director server, can see the primary node failure, automatically jump to the standby node
# CRM Node standby# CRM node online# CRM Statuslast Updated:mon 4 18:38:53 2015Last Change:mon May 4 18:38:48 2015 Stack:classic Openais (with plugin) current dc:node2.mingxiao.info-partition with Quorumversion:1.1.11-97629de2 Nodes Configured, 2 expected Votes2 Resources configuredonline: [Node1.mingxiao.info node2.mingxiao.info] Webip (OCF:: HEARTBEAT:IPADDR): Started node2.mingxiao.info Ldirectord (lsb:ldirectord): Started node2.mingxiao.info
192.168.1.5 analog RS1 Fault in RS1
# service httpd stop into Node2, can see RS1 has been rejected # Ipvsadm-lnip Virtual Server version 1.2.1 (size=4096) Prot Localaddress:port schedu Ler Flags, Remoteaddress:port Forward Weight activeconn inactconntcp 192.168.1.10:80 RR, 192.168.1. 6:80 Route 1 0 0
Input RS1 192.168.1.5 analog fail back
# service httpd start into Node2, you can see RS1 is back online # ipvsadm -LnIP Virtual Server version 1.2.1 (size=4096) prot localaddress:port scheduler flags -> remoteaddress:port forward weight activeconn inactconntcp 192.168.1.10:80 rr -> 192.168.1.5:80 Route 1 0 0 -> 192.168.1.6:80 route 1 0 0
This article is from the "on the Road" blog, please be sure to keep this source http://mingxiao.blog.51cto.com/8124243/1641836
High Availability Director (LINBIT+COROSYNC+LVS) on RHEL6.6