Rhel 5.8 32bit
Heartbeat v2
Ha Web
Node1 Node2
Node name,/etc/hosts
The node name must match the straight line result of the Uname-n command
SSH Trust Communication,
Time synchronization
1 Configure IP columns for two hosts first, such as 192.168.1.11 192.168.1.12 VIP192.168.1.8 Gateway
192.168.1.1
Configure host name for two hosts #hostname node1.mylinux.com
#hostname node2.mylinux.com
For the hostname to be permanently active edit/etc/sysconfig/network
2 Configure double-click Trust (configured on 1.11)
#ssh-keygen-t rsa-f ~/.ssh/id_rsa-p "
#ssh-copy-id-i. ssh/id_rsa.pub [Email protected]
As configured on 1.12
#ssh-keygen-t rsa-f ~/.ssh/id_rsa-p "
#ssh-copy-id-i. ssh/id_rsa.pub [Email protected]
Tested on 1.11 #ssh 192.168.1.12 ' ifconfig '
Tested on 1.12 #ssh 1192.168.1.11 ' ifconfig '
3 Configuring host name resolution configured on 1.11 and 1.12, respectively
# vim/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.11 node1.mylinux.com Node1
192.168.1.12 node2.mylinux.com Node2
You can ping Node2 and node1 to test for normal parsing
#scp/etc/hosts node2:/etc
IPTABLES-L-N Ensure that there is no relevant qualification or open UDP port 694
4 time synchronization (NTP service running on 1.12)
Ntpdata 192.168.1.13
or manually synchronize Ntpdate 192.168.1.13 directly
[email protected] yum.repos.d]# which ntpdate
/usr/sbin/ntpdate
Crontab-e synchronized every five minutes
*/5 * * * */sbin/ntpdate 192.168.1.13 &>/dev/null
Scp/var/spool/cron/root node2:/var/spool/cron/
Kz
Http://www.linux-ha.org/wiki/Heartbeat
http://clusterlabs.org/
Epel
Https://fedoraproject.org/wiki/Special:RecentChanges
HEARTBEAT-2.1.4-11.EL5.I386.RPM Core Pack
HEARTBEAT-DEVEL-2.1.4-11.EL5.I386.RPM Development Kit
HEARTBEAT-GUI-2.1.4-11.EL5.I386.RPM graphical interface for managing Hearbeat clusters
HEARTBEAT-LDIRECTORD-2.1.4-11.EL5.I386.RPM is automatically generated for Ipvs high availability rules, i.e. after
Terminal Realserver Health Check components
HEARTBEAT-PILS-2.1.4-11.EL5.I386.RPM Loading library plug-in
heartbeat-stonith-2.1.4-11.el5.i386.rpm interface for modifying headers
[1.11]
These 2 packages must be installed before installation
Libnet-1.1.6-7.el5.i386
Perl-mailtools-1.77-1.el5.noarch
#yum--nogpgcheck Localinstall Perl-mailtools-1.77-1.el5.noarch
#yum--nogpgcheck Localinstall libnet-1.1.6-7.el5.i386
#yum--nogpgcheck Localinstall heartbeat-2.1.4-11.el5.i386.rpm
#yum--nogpgcheck Localinstall heartbeat-gui-2.1.4-11.el5.i386.rpm
#yum--nogpgcheck Localinstall heartbeat-pils-2.1.4-11.el5.i386.rpm
#yum--nogpgcheck Localinstall heartbeat-stonith-2.1.4-11.el5.i386.rpm
#scp Perl-mailtools-1.77-1.el5.noarch libnet-1.1.6-7.el5.i386 heartbeat-2.1.4
-11.el5.i386.rpm heartbeat-gui-2.1.4-11.el5.i386.rpm heartbeat-pils-2.1.4-
11.el5.i386.rpm heartbeat-stonith-2.1.4-11.el5.i386.rpm node2:/root/
[1.12]
#yum--nogpgcheck Localinstall Perl-mailtools-1.77-1.el5.noarch
#yum--nogpgcheck Localinstall libnet-1.1.6-7.el5.i386
#yum--nogpgcheck Localinstall heartbeat-2.1.4-11.el5.i386.rpm
#yum--nogpgcheck Localinstall heartbeat-gui-2.1.4-11.el5.i386.rpm
#yum--nogpgcheck Localinstall heartbeat-pils-2.1.4-11.el5.i386.rpm
#yum--nogpgcheck Localinstall heartbeat-stonith-2.1.4-11.el5.i386.rpm
The/ETC/HA.D/RESOURCE.D/IPADDR is specifically designed to enable the VIP to be configured on an active node, and the monitoring IP is
No entry into force
#cd/ETC/HA.D
Three configuration files
1. Key file, 600 permissions, Authkeys
Configuration file for 2.heratbeat service HA.CF
3. Resource Management configuration file
Haresources
#ls/usr/share/doc/heartbeat-2.1.4
#cp-P/usr/share/doc/heartbeat-2.1.4/{authkeys,ha.cf,haresources}./
#dd if=/dev/random count=1 bs=612 |md5sum generate random numbers
Defining the master configuration file
#vim Authkeys
Auth 1
1 MD5 "Random number"
#vim HA.CF
#debugfile/var/log/ha-debug Debug Log
Logfile/var/log/heartbeat.log log files
Facilities of #logfacility Local0 log
KeepAlive 2 Two seconds to send a heartbeat message
Deadtime 30 death time, detection of how long after the determination of death
Warntime 10 Warning Duration
Initdead 120 Wait time (at least 2 nodes) to wait for the second node to start after the first node starts
to form a cluster)
Udpport 694 Heartbeat Message Delivery port
Baud 19200 What is the serial line transmit rate?
Bcast eth0 Defining broadcasts
#mcast Multicast
#ucast Unicast
node specifies that the current cluster has several nodes, each with a node to specify
Node node1.mylinux.com
Node node2.mylinux.com
Ping 192.168.1.1 through the gateway to detect whether it is normal
#respawn Hacluster Service How long to restart the service
#compression bz2 whether to compress the log
#compression_threshold 2 greater than 2k compression
Define Resource/etc/ha.d/resource.d/filesystem Resource Agent
[1.11]
Yum Install httpd
echo "
Service httpd Start
Test
Service httpd Stop
Chkconfig httpd off
[1.12]
Yum-y Install httpd
echo "
Service httpd Start
Test
Service httpd Stop
Chkconfig httpd off
[1.11]
#cd/ETC/HA.D
#vim haresources
Node1.mylinux.com Ipaddr::192.168.1.8/24/eth0 httpd
#scp-P Authkeys haresources ha.cf node2:/etc/ha.d/
#service heratbeat Start
#ssh Node2 ' service heartbeat start '
Cd/usr/lib/heartbeat
The./hb_standby converts itself into a standby node for testing
[1.12]
Ifconfig
NETSTAT-TNLP Check if port 80 is enabled at this time
[1.14]
Ifconfig lo:0 Down
Ifconfig eth0 192.168.1.14/24
echo 0 >/proc/sys/net/ipv4/conf/eth0/arp_ignore
echo 0 >/proc/sys/net/ipv4/conf/eth0/arp_announce
echo 0 >/proc/sys/net/ipv4/conf/all/arp_announce
echo 0 >/proc/sys/net/ipv4/conf/all/arp_ignore
#mkdir/WEB/HTDOCS-PV Create a folder and share it
Vim/etc/exports
/web/htdocs 192.168.1.0/255.255.255.0 (RO)
Vim/web/htdocs/index.html
NFS Server
#service NFS Start
Service Portmap Restart
[1.11]
#ssh node2 '/etc/init.d/heratbeat stop '
#service hearbeat Stop
#setenforce 0
#mount 192.168.1.14:/web/htdocs/mnt
#ls/mnt
#umount/mnt
#vim/etc/ha.d/haresources
Node1.mylinux.com Ipaddr::192.168.1.8/24/eth0
Filesystem::192.168.1.14:/web/htdocs::/var/www/html::nfs httpd
#scp haresources node2:/etc/ha.d/
#sercice Heartbeat Start
#ssh Node2 ' service heartbeat start '
#/usr/lib/heartbeat/hb_standby let the master node be the standby node for testing
This article from "Operation and maintenance Growth Road" blog, declined reprint!
Linux Cluster Series--Heartbeat installation configuration of high availability cluster