In the VM, LINUX + Heartbeat achieves dual-host high availability through Heartbeat

Source: Internet
Author: User
This experiment uses Heartbeat2.0, that is, the old version. The old version of HA is a whole project, and the new version (after 3.0) has changed a lot. It is to split the HA project into several relatively scattered projects, it is developed and maintained by different project teams. Heartbeat2.0 integrated modules: 1. heartbeat

This experiment uses Heartbeat2.0, that is, the old version. The old version of HA is a whole project, and the new version (after 3.0) has changed a lot. It is to split the HA project into several relatively scattered projects, it is developed and maintained by different project teams.

Modules integrated by Heartbeat2.0:

1. heartbeat: communication detection module between nodes

2. ha-logd:ClusterEvent Log Service

3. CCM (consenSuS Cluster Membership): Cluster member consistency Management Module

4. LRM (Local Resource Manager): Local Resource management module

5. Stomith Daemon: the faulty node is detached from the cluster.

6. CRM (Cluster resource management): Cluster resource management Module

7. Cluster policy engine: Cluster policy Module

8. ClusterTrAnsition engine: Cluster Transfer engine

Heartbeat3.0 is followed by multiple components:

1. Heartbeat: the original message communication layer is independent of the heartbeat project, and the new heartbeat is only responsible for maintaining the communication between each node.

2. Cluster Glue: equivalent to an intermediate layer. It is used to associate heartbeat and pacemaker. It consists of two parts: LRM and STONITH.

3. Resource Agent: a collection of scripts used to control service start/stop and monitor service status. These scripts are called by LRM to start, stop, and monitor resources.

4. Pacemaker: Cluster Resource Manager (CRM) is used to manage the entire HA control center. The client uses pacemaker to configure and manage the entire Cluster.

Pacemaker provides multiple user management interfaces

(1), cRmShell, character-based Management

(2) a web kensole Window Using Ajax web configuration.

(3) hb_gui, that is, heartbeat gui Configuration tool, which is also the original 2.1.x default GUI Configuration tool.

(4) DRBD-MC a java-based configuration management tool.

Experimental Platform: Two CentOS5.5 linux servers (both dual NICS) under the VM, install and configure apache and clear firewall rules (iptables-F), in fact, it can not be closed, configure iptabkes rules. This experiment is not focused on this, so I wrote a little bit.

IP address planning:

MASTER: eth0: 192.168.1.195 eth1: 10.0.0.3 (for heartbeat eth1)

BACKUP: eth0: 192.168.1.196 eth1: 10.0.0.2 (for heartbeat eth1)

VIP: 192.168.1.200

1. installation and configuration on the master node

1. Modify the Host Name

[Root @ localhost ~] # Vi/etc/sysconfig/network

NETWORKING = yes

NETWORKING_IPV6 = no

HOSTNAME = master

[Root @ localhost ~] # Vi/etc/hosts

127.0.0.1 localhost. localdomain localhost

: 1 localhost6.localdomain6 localhost

192.168.1.195 master

192.168.1.196 backup

[Root @ localhost ~] # Reboot

[Root @ master ~] #Uname-N

Master

2. download and install the software package:

[Root @ master ~] # Wget http: // zId-Luxinst. uibk. ac. at/linux/rpm2html/centos/5/ExTras/i386/RPMS/heartbeat-2.1.3-3.el5.centos.i386.rpm

[Root @ master ~] # Wget http://zid-luxinst.uibk.ac.at/linux/rpm2html/centos/5/extras/i386/RPMS/ heartbeat-piLs-2.1.3-3. el5.centos. i386.rpm

[Root @ master ~] # Wget http://zid-luxinst.uibk.ac.at/linux/rpm2html/centos/5/extras/i386/RPMS/ heartbeat-stonith-2.1.3-3.el5.centos.i386.rpm

Note that the installation sequence cannot be reversed (or the installation fails)

[Root @ master ~] # Rpm-ivh heartbeat-pils-2.1.3-3.el5.centos.i386.rpm

[Root @ master ~] # Rpm-ivh heartbeat-stonith-2.1.3-3.el5.centos.i386.rpm

[Root @ master ~] # Rpm-ivh heartbeat-2.1.3-3.el5.centos.i386.rpm

3. Configuration

[Root @ master ~] #Cp/Usr/share/doc/heartbeat-2.1.3/ha. cf/etc/ha. d // master configuration file

[Root @ master ~] # Cp/usr/share/doc/heartbeat-2.1.3/authkeys/etc/ha. d // authentication File

[Root @ master ~] # Cp/usr/share/doc/heartbeat-2.1.3/haresources/etc/ha. d // configure Resource Management

[Root @ master ~] #Chmod600/etc/ha. d/authkeys

[Root @ master ~] # Vi/etc/ha. d/ha. cf // modify the following items (optimization is not considered here, but simple function implementation)

LogFile/Var/log/ha-log

Keepalive 2

DeadTime30

Warntime 10

Initdead 120

Udpport 694

Bcast eth1 # Linux // heartbeat Nic

Ucast eth1 10.0.0.2 // heartbeat network card connection peer heartbeat address

Auto_failback on

Node master

Node backup

Ping192.168.1.1 // check whether the entire network is connected

[Root @ master ~] # Vi/etc/ha. d/authkeys // use crc authentication (minimum requirement on system resources)

Auth 1

1 crc

[Root @ master ~] # Vi/etc/ha. d/haresources //

Related Article

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.