Heartbeat3.x deployment and Installation

Source: Internet
Author: User
Tags snmp

 

 

 

 

 

 

 

 

 

 

 

 

Using Heartbeat to build a Linux dual-host Hot Standby System

 

 

 

 

 

 

 

 

 

 

 

 

This document version: V1.0

Version history

 

 

 

Version Number

Update Time

Description

Creator

V1.0

Modified Version

Jinqiao

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1. Deployment Environment

OS: Red Hat Enterprise Linux release 6.0 beta (Santiago)

Kernel: 2.6.32-19. el6.x86 _ 64

Software:

Heartbeat ver3.0.5

Libnet ver1.1.6

2 heartbeat Introduction

Heartbeat is an open-source Linux high-availability cluster project of Linux-ha. It supports the following application clusters:

  • Web Servers
  • LVS Director servers
  • Mail servers
  • Database servers
  • Firewils
  • File Servers
  • DNS servers
  • DHCP servers
  • Proxy caching servers
  • Etc.

3. Install heartbeat

3.1 add users and groups

# Groupadd-G 800 haclient

# Useradd-u 800-G haclient hacluster

# Yum install-Y cluster-glue wget net-snmp-devel net-snmp openipmi glib2-devel libxml2-devel bzip2-devel libuuid-devel docbook-utils docbook-dtds libtool-ltdl libxslt Perl-TimeDate OpenSSL-devel docbook-style-XSL e2fsprogs-devel mailx glib2-devel libtool-ltdl-devel net-snmp-devel bzip2-devel ncurses-devel OpenSSL-devel libtool libxml2-devel gettext bison flex zlib-devel mailx which docbook-style-XSL pyxml shadow-utils opensp Autoconf automake libxslt-devel libgcrypt-devel pkgconfig libgpg-error-devel SGML-common opensp openjade XML-common docbook-style *

# Rpm-IVH libtool-ltdl-devel

# Yum install-y intltool

# Yum install-y pacemaker

 

3.2 compile and install the Libnet Library

# Su-Root

# Cp libnet.tar.gz/usr/local

# Cd/usr/local

# Tar xzvf libnet.tar.gz

# Cd Libnet

#./Configure

# Make

# Make install

# Cd libnet-1.1.6/src/. libs/

# Cp Libnet. so.1/usr/lib64/

3.3 compile and install reusable-cluster-components-glue -- glue

 

# Bunzip2 Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2

# Tar xvf Reusable-Cluster-Components-glue--glue-1.0.9.tar

# Cd reusable-cluster-components-glue-1.0.9

#./Autogen. Sh

#./Configure & make install

 

3.4 compile and install clusterlabs-resource-agents.

# Tar xzvf ClusterLabs-resource-agents-v3.9.2-0-ge261943.tar.gz

# Cd ClusterLabs-resource-agents-b735277/

#./Autogen. Sh

#./Configure & make install

 

Metadata-IPv6addr.xml: 1: parser error: Document is empty

Metadata-IPv6addr.xml: 1: parser error: start tag expected, '<' not found

Unable to parse metadata-IPv6addr.xml

Gmake [2]: *** [ocf_heartbeat_rj6addr.xml] Error 6

Gmake [2]: Leaving directory '/home/soft/ClusterLabs-resource-agents-b735277/DOC'

Gmake [1]: *** [All-recursive] Error 1

Gmake [1]: Leaving directory '/home/soft/ClusterLabs-resource-agents-b735277'

Make: *** [all] Error 2

If this error occurs, delete the installation package, decompress the package, and run it again,

 

3.4 compile and install heartbeat ha

# Su-Root

# Bunzip2 Heartbeat-3-0-7e3a82377fa8.tar.bz2

# Tar xvf Heartbeat-3-0-7e3a82377fa8.tar

# Cd Heartbeat-3-0-7e3a82377fa8

#./Bootstrap

# Cp/usr/include/heartbeat/*. h/usr/include/

# Cp/root/reusable-cluster-components-glue-1.0.9/include/clplumbing/*. h/usr/include/

# Cp/root/reusable-cluster-components-glue-1.0.9/include/*. h/usr/include/

#./Configureme configure & make install

Here, configure should specify the installation path, which is installed under/usr/etc by default.

When heartbeat is started, an exception occurs when it is disabled, prompting/etc/init. d/heartbeat: Line 253:/ResourceManager: no such file or directory solution: VI/etc/ha. CF/shellfuncs

Add the following information: $ {ha_noarchbin: =/usr/share/heartbeat}

4. Configure heartbeat Service

4.1 Configure/etc/hosts

Configure on all nodes:

192.168.209.50 kingserver60

192.168.209.60 kingserver50

4.2 Configure/etc/ha. d/ha. cf

Edit the configuration file ha. CF for all nodes as root:

Auto_failback on indicates that the master node will take over the HA again after the error status returns to normal,

Bcast eth0 indicates that the eth0 Nic is an ha working network

Node kingserver60

Node kingserver50 indicates the Host Name of the HA master node and the slave node respectively.

Ping 192.168.209.1. You can set it to Ping An available node.

If the serial port serial/dev/ttys0 does not have a heartbeat line, do not configure it!

Debugfile/var/log/ha-Debug

Logfile/var/log/ha-Log

Logfacility local0

Keepalive 2

Deadtime 30

Warntime 10

Udpport 694

Bcast eth0

Ucast eth0 192.168.209.1

Auto_failback on

Node kingserver60

Node kingserver10

Ping 192.168.209.41

Respawn hacluster/usr/lib64/heartbeat/ipfail

4.3 Configure/etc/ha. d/authkeys (all nodes)

Auth 1

1 CRC

Change authorization file permissions as root

# Chmod 600 authkeys

4.4 Configure/etc/ha. d/haresources

If you configure the services supported by heartbeat, you can directly call the default heartbeat script, as shown in the following figure:

Kingserver60 ipaddr: 192.168.209.100/24/eth0 httpd

 

If you need your own program script, you need to configure all nodes:

Node1 indicates the master node host name, 192.168.0.26 indicates the working IP address of HA, and haserver. Sh indicates the HA switching script.

Single Nic SHQZ-PS-WCITY-SV-MMS01 172.17.60.73/255.255.255.255.128/eth0 harmserver. Sh

Multiple NICs

SHQZ-PS-WCITY-CL02 ipaddr: 192.168.156.10/255.255.255.0 clserver1.sh

SHQZ-PS-WCITY-CL02 ipaddr: 10.11.25.10/255.255.224 clserver2.sh

Node1 192.168.0.26 haserver. Sh

Haserver. Sh is the script that HA runs when switching. In the/etc/rc. d/init. d directory.

For example:/etc/rc. d/init. d/haserver. Sh

Remember to pass parameters here

Date>/tmp/ha.txt

Su-vas-c "vas_server.sh $1"

Exit 0

The user vas script vas_server.sh is as follows:

If [$1 = "start"]; then

Echo "Starting vas ..."

/Home/VAS/bin/billing. Sh &

 

Echo "*****/home/VAS/bin/billing. Sh>/dev/null">/tmp/cron. VAS

Echo "****/home/VAS/watch1.1/watch. Sh>/dev/null">/tmp/cron. VAS

Crontab/tmp/cron. VAS

Fi

 

If [$1 = "stop"]; then

Echo "Stopping vas ..."

Crontab-R

Echo "Sleep 65 seconds ..."

Sleep 65

 

App_name = "billing"

PS-Ef | grep $ {app_name} | awk '{print $2}' | xargs kill-9>/dev/null 2> & 1

App_name = "smsagent"

PS-Ef | grep $ {app_name} | awk '{print $2}' | xargs kill-9>/dev/null 2> & 1

Fi

 

Exit 0

4.5 Start and Stop heartbeat

  • Start heartbeat

#/Etc/init. d/heartbeat start

  • Stop heartbeat

#/Etc/init. d/heartbeat stop

  • Start heartbeat server on all nodes, and add it to/etc/rc. Local:

#/Etc/init. d/heartbeat start

5. Test heartbeat

5.1 test whether the service IP address is successful

You can run the ping command to test whether the service IP address (such as 192.168.0.26) is successful, or use ifconfig on the active machine of HA to check whether the NIC is bound to multiple IP addresses.

5.2 whether the service script runs normally

Check whether the service script haserver. Sh is run on two machines (one active and one standby.

5.3 is Ha switching normal?

Manually simulate network card failure, unplug the network card of the active machine, and then monitor the log/var/log/ha. log, the Service should switch from active to standby machine, and then use the above method to test whether the service IP address and service script are running normally.

Manually simulate the machine as the machine, shut down the active robot, and test whether the HA switchover is normal according to the above method.

 

Heartbeat3.x deployment and Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.