The conceptual composition and working principle of heartbeat
1, the concept of heartbeat
Heartbeat is a component of the Linux-ha project and the most successful example of the current open source Ha project, Linux-ha's full name is High-availability Linux, the goal of this open source project is to: through the joint efforts of Community developers, Provides a cluster solution that enhances Linux reliability (reliability), availability (availability), and serviceability (serviceability) (RAS).
Heartbeat provides the basic functionality required by all HA software, such as heartbeat detection and resource taking, monitoring system services in a cluster, transferring the owners of shared IP addresses between nodes in a cluster, and so on.
Linux-ha's official website: http://www.linux-ha.org
http://hg.linux-ha.org
2, HA cluster-related terminology
(1) Nodes (node)
A stand-alone host that runs the heartbeat process, called a node, is the core component of HA, where the operating system and heartbeat software services are running on each node, and the nodes have primary and secondary points in the heartbeat cluster, called the Master node and the standby/backup node, respectively. Each node has a unique hostname and has its own set of resources, typically running one or more application services on the master node. And the standby node is generally in the monitoring state.
(2) Resources (Resource)
A resource is an entity that can be controlled by a node, and when a node fails, these resources can be taken over by other nodes, and in heartbeat, the entities that can be used as resources are:
Disk partitions, file systems, IP addresses, application services, NFS file systems
(3) Events (event)
This is what can happen in a cluster, such as node system failure, network connectivity failure, NIC failure, application failure, and so on. These events can result in the transfer of resources from the node, and the HA test is based on these events.
(4) Action (action)
How HA responds when an event occurs, and the action is controlled by the shell's footsteps, for example, when a node fails, the backup node will shut down or start the service with a predefined execution script. And then take over the resources of the failed node.
3, the composition of heartbeat
(1) Structure of Heartbeat
heartbeat1.x and 2.0.x version of the structure is very simple, each module is concentrated in the heartbeat, to the 3.0 version, the entire Heartbeat project was split, divided into different projects to develop separately.
heartbeat2.0.x Previous versions have modules:
Heartbeat: Communication detection module between nodes
HA-LOGD: Cluster Event Log service
CCM (Consensus Cluster Membership): Cluster member consistency management module
LRM (local Resource manager): Native Resource Management module
Stonith Daemon: Causes the problematic node to detach from the cluster environment
CRM (Cluster resource Management): Cluster resource management module
Cluster Policy engine: Cluster policy engine
Cluster transition Engine: Cluster transfer engine
Components after Heartbeat3.0 split:
Heartbeat: The original message communication layer is independent of the Heartbeat project, the new Heartbeat is only responsible for maintaining the information of cluster nodes and their prior communication;
Cluster Glue: The equivalent of an intermediate layer, which is used to correlate heartbeat and pacemaker, consisting mainly of 2 parts, namely LRM and Stonith.
Resource Agent: A collection of scripts used to control service startup, monitor service status, which will be invoked by LRM to implement various resource launches, stops, monitors, and so on.
Pacemaker: That is, cluster Resource Manager (referred to as CRM), which manages the entire HA control center, the client configures the management to monitor the whole cluster through Pacemaker.