Heartbeat deployment

#heartbeat deployment

HB1: eth0: 10.0.0.3eth1:172.16.1.3VIP:10.0.0.103HB2: eth0: 10.0.0.4eth1:172.16.1.4VIP:10.0.0.104

where eth1 is Directly connected. It is the direct heartbeat line of heartbeat

[root@HB1~]# ifconfig|awk'/ inet addr/{print $2}'addr:10.0.0.3addr:172.16.1.3addr:127.0.0.1[root@HB1~]#[root@HB2~]#ifconfig|awk-F'[:]+''/ inet addr/{print $4}'10.0.0.4172.16.1.4127.0.0.1[root@HB2 ~]#

#To configure the host name and hosts file.

The host name should be based on uname -n

[root@HB2~]#uname-nHB2[root@HB2~]#uname-mx86_64[root@HB2~]#================= ===============HB1cp /etc/hosts /etc/hosts.bakcp /etc/sysconfig/network /etc/sysconfig/network.baksed -i'$a 10.0.0.3 HB1' /etc/hostssed -i'$a 10.0.0.4 HB2' /etc/hostssed -i'/HOSTNAME=/d'/etc/sysconfig/networksed -i'/$/aHOSTNAME=HB1'/etc/sysconfig/networkHB2sed -i'$a 10.0.0.3 HB1' /etc/hostssed -i'$a 10.0.0.4 HB2' /etc/hostssed -i'/HOSTNAME=/d'/etc/sysconfig/net work sed -i'/$/aHOSTNAME=HB2' /etc/sysconfig/network###########################start test: [ root@HB1~]#uname-nHB1[root@HB2~]#uname-nHB2[root@HB2~]#uname-mx86_64[root@HB2~]#============== ==================[root@HB2 ~]# ping HB1PING HB1 (10.0.0.3) 56(84) bytes of data.64 bytes from HB1 (10.0.0.3) : Icmp_seq=1 ttl=64 time=0.347 ms64 bytes from HB1 (10.0.0.3): icmp_seq=2 ttl=64 time=0.297 ms^C---HB1 ping statistics---2 packets transmitted, 2 received, 0% packet loss, time 1424msrtt min/avg/max/mdev = 0.297/0.322/0.347/0.025 ms[root@HB2~]# ping HB2PING HB2 (10.0.0.4) 56(84) bytes of data.64 bytes from HB2 (10.0 .0.4): icmp_seq=1 ttl=64 time=0.027 ms64 bytes from HB2 (10.0.0.4): icmp_seq=2 ttl=64 time=0.043 ms^C- HB2 ping statistics---2 packets transmitted, 2 received , 0% packet loss, time 1226msrtt min/avg/max/mdev = 0.027/0.035/0.043/0.008 ms[root@HB2~]#[root@HB1~]# ping HB2PING HB2 (10.0.0.4) 56(84) bytes of data.64 bytes from HB2 (10.0.0.4): icmp_seq=1 ttl=64 time=0.720 ms 64 bytes from HB2 (10.0.0.4): icmp_seq=2 ttl=64 time=0.346 ms64 bytes from HB2 (10.0.0.4): icmp_seq=3 ttl=64 time=0.329 ms^C---HB2 ping statistics--- 3 packets transmitted, 3 received, 0% packet loss, time 2150msrtt min/avg/max/mdev = 0.329/0.465/0.720/0.180 ms[root@HB1~]# ping HB1PING HB1 (10.0.0.3) 56(84) bytes of data.64 bytes from HB1 (10.0.0.3): icmp_seq=1 ttl=64 time=0.022 ms64 bytes from HB1 (10.0.0.3): icmp_seq=2 ttl=64 time=0.131 ms^C- HB1 ping statistics ---2 packets transmitted, 2 received, 0% packet loss, time 1388msrtt min/avg/max/mdev = 0.022/0.076/0.131/0.055 ms[root@HB1~]########### ################end

#Add the following heartbeat route to both servers. It is recommended to add route in the production environment. Not adding it now will not affect the setup.

/sbin/route add-host 172.16.1.4 dev eth1/sbin/route add-host 172.16 .1.3 dev eth1echo'/sbin/route add-host 172.16.1.3 dev eth1' >> /etc/rc.local echo'/sbin/route add-host 172.16.1.4 dev eth1' >>/etc/rc.local# ####################start [root@HB1~]# ping 172.16.1.4 PING 172.16.1.4 (172.16.1.4) 56(84) bytes of data .64 bytes from 172.16.1.4: icmp_seq=1 ttl=64 time=1.56 ms64 bytes from 172.16.1.4: icmp_seq=2 ttl=64 time=0.310 ms^C- 172.16.1.4 ping statistics---2 packets transmitted , 2 received, 0% packet loss, time 1267msrtt min/avg/max/mdev = 0.310/0.935/1.561/0.626 ms[root@HB1~]#[root@HB2~]#/sbin/route add -host 172.16. 1.3 dev eth1[root@HB2~]# [root@HB2~]# ping 172.16.1.3PING 172.16.1.3 (172.16.1.3) 56(84) bytes of data.64 bytes from 172.16.1.3: icmp_seq=1 ttl= 64 time=0.391 ms^C---172.16.1.3 ping statistics---1 packets transmitted, 1 received, 0% packet loss, time 897msrtt min/avg/max/mdev= 0.391/0.391/0.391/0. 000 ms[root@HB2~]#######################end

############################### ##########Start deployment

centos 5.8 directly yum install heartbeat -y twice That’s it (remember)

If it is centos 6.5, you need yum install heartbeat* -y< /p>

The following is installed under centos 6.5

1. First download and install the epel package

wget http ://mirrors.opencas.cn/epel/6/i386/epel-release-6-8.noarch.rpmwget http://mirrors.opencas.cn/epel/6/x86_64/epel-release-6-8. noarch.rpm

mkdir -p /home/lvnian/tools && cd /home/lvnian/tools p>

#Download and install the epel package

 mkdir -p /home/lvnian/tools&& cd /home/lvnian/tools wget http://mirrors.opencas.cn /epel/6/x86_64/epel-release-6-8.noarch.rpmrpm -ivh epel-release-6-8.noarch.rpm

2. Install heartbeat , The following is deployed in the centos version system, all use yum install heartbeat* -y. If it is centos5.8, you need yum twice

yum install heartbeat*-y

3. Copy ha configuration files, resource files and authorization files to /etc/ha.d/.

By default, there is no configuration file in /etc/ha.d/, and the configuration files are all in /usr /share/doc/heartbeat-3.0.4/ directory

ll /usr/share/doc/heartbeat-3.0.4/cd /usr/share/doc/heartbeat-3.0.4/cp ha.cf haresources authkeys /etc/ha.d/4. Start configuration

cd/etc/ha.dmvha.cfha.bakmvauthkeysauthkeys.bakmvharesourcesharesources.bak 

Note: The following three files, ha.cf, authkeys, and haresources, are both active and standby The same

########Configuration ha.cfcat>/etc/ha.d/ha.cf</etc/ha.d/ authkeys< /etc/ha.d/haresources<

< p>

#Start the heartbeat service

/etc/init.d/heartbeat start/etc/init.d/heartbeat stop/etc/init.d /heartbeat Restart

Use ip add to view vip

View cat /var/log/ha-log log file

####################################333333 After installation [root@HB1 home ]#Cd/etc/ha.d/[[email protected]]#[[email protected]]#[[email protected] ]#Lsharc rc.d README.config resource.d shellfuncs[[email protected]]#[[email protected]]#[[email protected]]#[[email protected]]#lltotal 20-rwxr-xr-x. 1 root root 745 Dec 3 2013 harcdrwxr-xr-x. 2 root root 4096 Jul 21 01:55 rc.d-rw-r--r 1 root root 692 Dec 3 2013 README.configdrwxr-xr-x. 2 root root 4096 Jul 21 01:55 resource.d-rw-r--r--. 1 root root 2082 Jul 24 2015 shellfuncs[[email protected]]#ll/usr /share/doc/heartbeat-3.0.4/total 144-rw-r--r--. 1 root root 1873 Dec 3 2013 apphbd.cf-rw-r--r--. 1 root root 645 Dec 3 2013 authkeys-rw-r--r--. 1 root root 3701 Dec 3 2013 AUTHORS-rw-r--r--. 1 root root 58752 Dec 3 2013 ChangeLog-rw-r--r--. 1 root root 17989 Dec 3 2013 COPYING-rw-r--r--. 1 root root 26532 Dec 3 2013 COPYING.LGPL-rw-r--r--. 1 root root 10502 Dec 3 2013 ha.cf-rw-r- -r--. 1 root root 5905 Dec 3 2013 haresources-rw-r--r--. 1 root root 2935 Dec 3 2013 README[[email protected]]#[[email protected]]#cd /usr/share/doc/heartbeat-3.0.4/[root@HB1 heartbeat-3.0.4]# cp ha.cf haresources authkeys /etc/ha.d/#######################/etc/ha.d/haresources Content analysis IPaddr:: 10.0.0.103/24/eth0IPaddr is a script in the /etc/ha.d/resource.d directory, its role is to add an IP. HB1 is the host name, which means that the initial state will bind IP 10.0.0.103 to HB1. IPaddr is a script in the /etc/ha.d/resource.d directory, and the following IP 10.0.0.103 and eth0 are the parameters of the script. Its function is to add an auxiliary IP on the specified network card. 10.0.0.103/24/eth0 is the VIP for external services of the cluster, which is initially started on HB1, #24 is the subnet mask, and eth0 is the actual physical network card bound to ip, which provides the communication interface for external services for heartbaeat

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2547 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.