Heartbeat High-availability solutions

Source: Internet
Author: User

Heartbeat High Availability

    1. Heartbeat effect:

With heartbeat, resources, such as IP and program services, can be transferred from one failed computer to another on a functioning machine, often called high-availability services.

Heartbeat and keepalived have many similarities, but there are differences.

Official website: http://www.linux-ha.org/wiki/Main_Page

    1. Working principle:

By modifying the heartbeat configuration file, you can designate one heartbeat server as the primary server and the other automatically become a hot standby server. Configure the heartbeat daemon on the hot standby server to listen to the heartbeat information of the autonomic server. If the heartbeat information cannot be heard within the specified time, then start the failover, take ownership of the associated resources on the primary server, and take over the primary server to continue providing services uninterrupted to achieve the purpose of resource and service high availability.

The heartbeat also supports the main master mode, and the two servers are the primary standby. The general failover time is between 5~20s.

In addition: As with keepalived services, heartbeat high Availability is server-level, not service-level.

    1. Server outage
    2. Heartbeat software failure
    3. Heartbeat Connection line failure)

A service failure does not cause a switchover, and the heartbeat service can be stopped by a service outage.

    1. Heartbeat Connection:

      At least two hosts are required for high-availability services.

      Communication between two heartbeat services:

    • Traversing cable, the so-called serial port (first, the disadvantage is not too far away from the distance)
    • One Ethernet cable two net Kazhilian (Common way)
    • Ethernet cable, connected via network devices such as switches. (There may be problems with the switch, etc.)
    1. Heartbeat cleft Brain (Splitbrain)

Two servers in a certain time, can not detect each other's heartbeat and their respective start failover function, access to resources and service ownership, will cause the same IP at both ends simultaneously start the service, there are two of the same VIP, causing serious problems of conflict.

    1. Reasons for splitting the brain:
    • Heartbeat link failure, resulting in inability to communicate properly
    • The firewall's blocking the heartbeat message transmission.
    • The heartbeat adapter address is not configured correctly
    • Heartbeat mode, heartbeat broadcast conflict, software bug
    1. Prevention of Split-brain solutions:
    • Simultaneous use of a serial cable and an Ethernet cable while using two heartbeat lines
    • Forces a node to close when a split brain is detected. (Requires special device support, such as stonish and fence). Equivalent to a standby node on the program that detects a heartbeat failure and sends a shutdown instruction to the master node.
    • Do a good job monitoring warning
    • Enable disk Lock
    • Arbitration mechanism (determine which node to take over the service)
    1. Fence Equipment Introduction
    • Ibm:rsa
    • Hp:ilo
    • Dell:idrac
    • External equipment with APC-produced Powerswitch
    1. Message type:
    • Heartbeat Messages (unicast, broadcast, or multicast): 150-byte packets
    • Cluster conversion message: IP-REQUEST,IP-REQUEST-RSP
    • Retransmission message: rexmit-request
    1. IP address takeover and failover:

      The heartbeat is failed over by IP address takeover and ARP broadcast.

ARP broadcast: In the case of a primary server failure, the standby node immediately forces the update of all client-local ARP tables (that is, a resolution record of the VIP and MAC addresses of the failed server that is aware of the client's local cache), ensuring that the client and the new primary server are in session.

    1. ?

Really IP, also known as the management IP, generally refers to the IP configured on the physical network card. In a load-balanced high-availability environment, the management IP is not providing access to the service externally. Used only as a management server, such as SSH can be managed through this service connection.

VIP is a virtual IP, is actually eth0:x,x for 0~255 any number, you can bind multiple aliases on a network card. VIP when the primary server fails, it can automatically drift to the standby server.

Note the difference between the secondary IP and the alias IP,keepalived and HEARTBEAT3 are all in the form of a secondary IP.

Secondary IP settings: IP addr add 192.168.12.1 dev eth1

???????????? IP addr del 192.168.12.1 dev eth1

Alias IP settings: ifconfig eth0 192.168.12.1

???????????? Ifconfig eth0 Down

    1. Heartbeat configuration file:

      Default profile directory/etc/ha.d/, common configuration file:

configuration name

action

remarks

ha.cf

parameter profile

Configure basic parameters

authkey

certified file

haresource

Resource profile

start IP script configuration file

    1. Actual case:
      1. Modify the host name to HA1 and HA2, respectively, into the host file:

        Close Iptables and SELinux:

        Time synchronization:

        ?

Host Name

IP Address

Ha1

192.168.227.213

Ha2

192.168.227.213

vip=192.168.227.120

To configure add host routes:

    1. Installing HEARTBEAT3 Software

      To install the Epel source:

      Yum installation HEARTBEAT3:

      View the path to the heartbeat installation software: mainly under/ETC/HA.D and

      Copy the three major configuration files into the/ETC/HA.D directory:

    2. Authkeys configuration file

???????? Select the corresponding option to remove the previous #.

???????? File Permissions 600. chmod Authkeys

    1. HA.CF file is more detailed, do not introduce.

      Where ucast are unicast IP addresses, respectively, for each other's IP address

    2. Haresource

      Main node name???? VIP address???????? Service Name

      This file is the same as the primary and standby node configuration.

    3. Install the HTTPD service on two servers and start it separately

    1. Failure test:

Two node servers simultaneously turn on the heartbeat service and the HTTPD service

Because heartbeat high availability is server-level, stopping a server's heartbeat service, discovering that the standby node is enabled, and enabling the associated httpd service, represents a high-availability success.

Heartbeat High-availability solutions

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.