Linux practice engineer series-Linux cluster HeartBeat practice

Source: Internet
Author: User

Heartbeat Introduction

Heartbeat test

Http://hi.baidu.com/%BB%C6%D0%C4%B2%A8/blog/item/d120a74da0e7fd38afc3ab09.html

Heartbeat Principle

Cluster systems are mainly divided into High Availability clusters (HA clusters. Generally, HA clusters made by two nodes have many unscientific names, such as "dual-machine hot backup", "dual-machine mutual backup", and "dual-machine ". The advantage of this is that when the service is started, the two servers are the primary server (ser1) and the other slave server (ser2 ). The test machine will ping the host every few seconds. If the host does not respond, it will prove that the host is extended. Then the slave machine will immediately start the corresponding service and continue the service. This ensures service interruption.

For example, sev1 has two real NICs, eth0 and eth1, and ser2 also has two real NICs, eth0 and eth1. LVS_IP: 222.90.88.88, which are two real LVS (ser1 and ser2) virtualized.

 

Operation:

Two virtual machines ser1 and ser2 with two NICs (both using bridging)

Install ipvsadm in sev1, and heartbeat

Install heartbeat:

Support Pack: heartbeat-pils-2.1.3-3.el5.centos.i386.rpm

Heartbeat-stonith-2.1.3-3.el5.centos.i386.rpm

Installation Package: heartbeat-2.1.3-3.el5.centos.i386.rpm (first installation may be problematic)

# Rpm-ivh heartbeat-pils-2.1.3-3.el5.centos.i386.rpm

# Rpm-ivh heartbeat-stonith-2.1.3-3.el5.centos.i386.rpm

# Rpm-ivh heartbeat-2.1.3-3.el5.centos.i386.rpm

# Rpm-q heartbeat-d (decompress a series of configuration files)

# Cd/etc/ha. d/(main configuration file location)

# Cp/usr/share/doc/heartbeat-2.1.3/ha. cf/etc/ha. d

# Cp/usr/share/doc/heartbeat-2.1.3/authkeys/etc/ha. d

# Cp/usr/share/doc/heartbeat-2.1.3/haresources/etc/ha. d

# Uname-n

Sev1.example.com

# Vim ha. cf

Logfile/var/log/ha-log (open the log file)

Logfacility local0

Keepalive 2 (every 2 seconds the test machine sends a broadcast)

Deadtime 30 (no response for 30 s, switch service immediately .)

Warntime 10

Initdead 120

Udpport 694 (udp is a port)

Bcast eth1 # Linux (interface number indicating heartbeat connection)

Ucast eth1 192.168.1.20 (IP address of the heartbeat connected PC)

Node sev1.example.com (two hostnames [Use uname-n to View Details ])

Node sev2.example.com

Ping the IP address of the 222.90.88.1 Test Machine (to write an external test IP address)

# Vim/etc/ha. d/authkeys (enable the Authentication mode. This is a security configuration with three authentication methods: crc md5 sha1)

Auth 1

1 crc

# Chmod 600 authkeys (heartbeat service cannot be started without this step)

# Vim/etc/ha. d/haresources (this mainly specifies the source of the resource, which is a remote mount)

In
Add one

Sev1.example.com 222.90.88.88 httpd)

# Vim/etc/hosts

# Service heartbeat start

# Vim/var/www/html/index.html

This is 1 ~~~

Install ipvsadm in sev2, and heartbeat

Install heartbeat:

Support Pack: heartbeat-pils-2.1.3-3.el5.centos.i386.rpm

Heartbeat-stonith-2.1.3-3.el5.centos.i386.rpm

Installation Package: heartbeat-2.1.3-3.el5.centos.i386.rpm (first installation may be problematic)

# Rpm-ivh heartbeat-pils-2.1.3-3.el5.centos.i386.rpm

# Rpm-ivh heartbeat-stonith-2.1.3-3.el5.centos.i386.rpm

# Rpm-ivh heartbeat-2.1.3-3.el5.centos.i386.rpm

# Rpm-q heartbeat-d (decompress a series of configuration files)

# Cd/etc/ha. d/(main configuration file location)

# Cp/usr/share/doc/heartbeat-2.1.3/ha. cf/etc/ha. d

# Cp/usr/share/doc/heartbeat-2.1.3/authkeys/etc/ha. d

# Cp/usr/share/doc/heartbeat-2.1.3/haresources/etc/ha. d

# Uname-n

Sev2.example.com

# Vim ha. cf

Logfile/var/log/ha-log (open the log file)

Logfacility local0

Keepalive 2 (every 2 seconds the test machine sends a broadcast)

Deadtime 30 (no response for 30 s, switch service immediately .)

Warntime 10

Initdead 120

Udpport 694 (udp is a port)

Bcast eth1 # Linux (interface number indicating heartbeat connection)

Ucast eth1 192.168.1.10 (IP address of the heartbeat connected PC)

Node sev1.example.com (two hostnames [Use uname-n to View Details ])

Node sev2.example.com

Ping the IP address of the 222.90.88.1 Test Machine (to write an external test IP address)

# Vim/etc/ha. d/authkeys (enable the Authentication mode. This is a security configuration with three authentication methods: crc md5 sha1)

Auth 1

1 crc

# Chmod 600 authkeys (heartbeat service cannot be started without this step)

# Vim/etc/ha. d/haresources (this mainly specifies the source of the resource, which is a remote mount)

In
Add one

Sev1.example.com 222.90.88.88 httpd)

# Vim/etc/hosts

# Service heartbeat start

# Vim/var/www/html/index.html

This is 2 ~~~

 

Test:

When sev1 (master node) stops heartbeat, sev2 (slave node) immediately virtualizes an IP Address: 222.90.88.88

Access http: // 222.90.88.88 will generate uninterrupted services (the page is This is 2 ~~~)

When sev1 is normal, it takes over all services again and virtualizes the IP address 222.90.88.88.

Author "Love your linux"

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.