2015-06-03ha High-availability clusters

Source: Internet
Author: User

HA (high available) is highly available and is also known as a dual-machine hot standby for critical business. The simple understanding is that there are two machines A and B, the normal is a service, B standby idle, when a down or service outage, will switch to the B machine to continue to provide services. Commonly used high-availability open source software has heartbeat and keepalived, where keepalived has load-balanced functionality.
650) this.width=650; "title=" 8laaql8fnib "style=" border-top:0px; border-right:0px; border-bottom:0px; border-left:0px; Display:inline "border=" 0 "alt=" 8laaql8fnib "src=" http://s3.51cto.com/wyfs02/M00/72/98/ Wkiol1xoojlj6dvraaa-xws0qwq657.jpg "" 244 "height=" 142 "/>
Below we use heartbeat to do the HA cluster, and the Nginx service as the HA corresponding service.
Test Preparation:
Two machines, all centos6.5, Nic Eth0 IP is as follows:
Two eth1 IPs are as follows:
The following operations 1-5 are operated on two machines
1. Hostname set up for aming and aming1, respectively
2. Close the firewall iptables-f;
Close Selinux:setenforce 0
3. Vi/etc/hosts//Add the following: aming aming1
4. Install the Epel extension Source:
Rpm-ivh ' http://www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm '
5. Two machines are installed Heartbeat/libnet
Yum install-y heartbeat* libnet nginx
6. Lord (aming) configuration
CP Authkeys HA.CF haresources/etc/ha.d/
VI Authkeys//Join
3 MD5 hello!
chmod Authkeys
VI haresources//Join
Aming Nginx
VI ha.cf//change to the following:
Logfacility local0
KeepAlive 2
Deadtime 30
Warntime 10
Initdead 60
Udpport 694
Ucast eth1
Auto_failback on
Node aming
Node Aming1
Respawn Hacluster/usr/lib/heartbeat/ipfail
7. Copy the three configurations from the Lord to the top:
SCP Authkeys ha.cf haresources aming1:/etc/ha.d/
8. To the top (aming1) Edit HA.CF
VI/ETC/HA.D/HA.CF//Only need to change one place
Ucast eth1 changed to Ucast eth1
9. Start Heartbeat:
Guthrie, after from
Service Heartbeat Start
10. Inspection Test
Ifconfig See if there is eth0:0
PS aux |grep Nginx See if there is nginx process
11. Test 1
The Lord deliberately forbidden Ping
Iptables-i input-p icmp-j DROP
12. Test 2
Lord Stop Heartbeat Service
Service Heartbeat Stop
13. Test for Brain fissure
Master and slave down eth1 NIC
Ifdown eth1
Extended Learning
Respawn Hacluster/usr/lib64/heartbeat/ipfail
The path should be aware of the differences between 32-bit and 64-bit systems, where errors can cause heartbeat to start unsuccessfully
Do not start it when you are finished loading Nginx

About the Heartbeat profile Reference document: Http://blog.chinaunix.net/uid-20749043-id-1878328.html
Heartbeat and keepalived compare http://blog.csdn.net/yunhua_lee/article/details/9788433 http://zhengdl126.iteye.com/blog/1738012
DRBD working principle and configuration http://502245466.blog.51cto.com/7559397/1298945

2015-06-03ha High-availability clusters

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.