Install heartbeat in Yum in CentOS

Source: Internet
Author: User
Tags install perl

Install heartbeat in Yum in CentOS

I. Environment
(It should be around mb. We recommend you wait patiently for installation)
Yum install e2fsprogs-devel libuuid-devel Libnet libtool-ltdl-devel libxslt-devel bzip2-devel glib2-devel perl * glib *
Yum install autoconf automake libtool glib2-devel bzip2-devel glib-devel libxml2 libxml2-devel docbook-style-xsl libtool-ltdl-devel
Yum install libxml2-dev libbz2-dev uuid-dev asciidoc libxslt1-dev
Yum install net-snmp * perl-Compress * perl-HTML * perl-libwww * perl-MailTools * perl-TimeDate * perl-URI *
Yum install perl-IO-Socket * perl-Socket6 * perl-Pod * perl-Test-Pod * libnet *

Ii. Install heartbeat
If yum is directly installed in centos
The system prompts that the package cannot be found. The reason is that the heartbeat for centos6.2 has not been released. The solution can be found in the third-party resource library. Here we use epel

Download and install epel first

Wgethttp: // mirrors.sohu.com/fedora-epel/6/ I #/epel-release-6-6.noarch.rpm
Rpm-ivh epel-release-6-6.noarch.rpm
Or
Http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

Then install heartbeat

Yum-y install heartbeat-stonith heartbeat-pils heartbeat-devel heartbeat-gui libnet

Iii. Test

Network Environment:

Master node: Host Name: 114. localdomain (NodeA) eth0: 192.168.4.114 255.255.255.0 // HA heartbeat address eth1: 192.168.2.114 255.255.255.0 // external IP address backup node: Host Name: 235. localdomain (NodeB) eth0: 192.168.4.235 255.255.255.0 // HA heartbeat address eth1: 192.168.2.235 255.255.255.0 // external IP address vip: 192.168.2.17

The following configuration must be added to the/etc/hosts file of the two machines:

192.168.2.114     114.localdomain        192.168.2.235     235.localdomain

The HOSTNAME of the/etc/sysconfig/network file of the master node is as follows:

HOSTNAME=114.localdomain

The HOSTNAME of the/etc/sysconfig/network file of the slave node is as follows:

HOSTNAME=235.localdomain

Configuration: The main configuration file of Heartbeat is ha. cf, haresources, and authkeys must be stored in/etc/ha. in the d directory, after Heartbeat is installed using yum, the three files are not available by default. After yum is installed, it can be found in/usr/share/doc/heartbeat-2.1.3, copy to/etc/ha. d. edit the file (create or edit the file)

cp /usr/share/doc/heartbeat-2.1.3/ha.cf    /etc/ha.d/cp /usr/share/doc/heartbeat-2.1.3/haresources   /etc/ha.d/cp /usr/share/doc/heartbeat-2.1.3/authkeys    /etc/ha.d/

Master node configuration file: The content of ha. cf is set as follows:

Debugfile/var/log/ha-debug # used to record heartbeat debugging information logfile/var/log/ha-log # used to record heartbeat log information logfacility local0 # System log Level keepalive 2 # Set HEARTBEAT (Monitoring) interval, the default unit is second warntime 10 # warning time, usually half of the deadtime time 30 # the heartbeat of the peer node is not received after 30 seconds, the initdead 120 # network start time is considered dead by the other party, at least twice the deadtime. Udpport 694 # Use udp port 694 for heartbeat monitoring bcast eth0 auto_failback on # on indicates that when the owner of the resource recovers, the resource is migrated to node 114 on the parent. localdomain # Set nodes in the cluster. The node name must match uname-n node 235. localdomain # Node 2

Master node resource file: haresources cat/etc/ha. d/haresources

114.localdomain  IPaddr::192.168.2.17/24 
  • 1

Master node authentication file authkeys cat/etc/ha. d/authkeys

auth 11 crc

Note: You need to change the file property to 600, otherwise heartbeat will fail to start.

chmod 600 authkeys

The configuration of the slave node is consistent with that of the master node.

Start heartbeat master node:/etc/init. d/heartbeat start slave node:/etc/init. d/heartbeat start

View logs: tail-f/var/log/ha-log

Note: after the master node starts heartbeat, after 114 s, a virtual IP address is created to close the master node's heartbeat. After S, the virtual IP address is disabled on the master node, and the virtual IP address is started on the slave node. This is the completion of resource transfer.

Reference: http://blog.csdn.net/libinbin_1014/article/details/50342405

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.