Linux-ha Open source software heartbeat configuration

Source: Internet
Author: User
Tags resource time interval port number backup

First, configure the heartbeat of the master node

Heartbeat's main configuration files are ha.cf, Haresources, Authkeys, after the installation of the heartbeat, the default does not have these three files, can be downloaded from the official web site, can also be directly from the source directory extracted from the extraction, in the above installation process, We have put these three files in the/ETC/HA.D directory, detailed below.

1. Master configuration file (/ETC/HA.D/HA.CF)

Each of the options for the ha.cf file is described in detail below, where the "#" is followed by a comment description of the option.

#debugfile/var/log/ha-debug

Logfile/var/log/ha-log #指名heartbeat的日志存放位置.

#crm Yes #是否开启Cluster Resource Manager (cluster resource management) feature.

The Bcast eth1 #指明心跳使用以太网广播方式 and is broadcast on the Eth1 interface.

KeepAlive 2 #指定心跳间隔时间为2秒 (that is, send a broadcast on eth1 every two seconds).

Deadtime #指定备用节点在30秒内没有收到主节点的心跳信号后, the service resources of the primary node are taken over immediately.

Warntime #指定心跳延迟的时间为十秒. When the backup node cannot receive the heartbeat signal of the primary node within 10 seconds, a warning log is written to the logs, but the service is not switched at this time.

Initdead #在某些系统上, when the system starts or restarts, it takes a while for the network to work properly, which is used to resolve the time interval that occurs. The value is at least twice times deadtime.

Udpport 694 #设置广播通信使用的端口, 694 is the port number that is used by default.

Baud 19200 #设置串行通信的波特率.

#serial/dev/ttys0 #选择串行通信设备, used in the case of dual-machine using serial line connection. If your dual computer uses an Ethernet connection, you should turn off this option.

#ucast eth0 192.168.1.2 #采用网卡eth0的udp单播来组织心跳, followed by the IP address should be dual-computer IP address.

#mcast eth0 225.0.0.1 694 1 0 #采用网卡eth0的Udp多播来组织心跳, typically used in more than one standby node. Bcast, Ucast and Mcast respectively represent broadcast, unicast and multicast, which is the three ways to organize the heartbeat, either one can be selected.

Auto_failback on #用来定义当主节点恢复后, whether the service is automatically cut back, the heartbeat two hosts are the primary node and the backup node respectively. The master node normally consumes resources and runs all services, handing over resources to the backup node and running the service by the backup node in the event of a failure. When this option is set to ON, once the primary node resumes operation, the resource is automatically fetched and the backup node is replaced, and if this option is set to OFF, then when the primary node is restored, it becomes a backup node, and the original backup node becomes the primary node.

The main role of the #stonith Baytech/etc/ha.d/conf/stonith.baytech # Stonith is to detach the problematic node from the cluster environment, thereby releasing the cluster resources and avoiding two nodes competing for one resource. Ensure the security and integrity of shared data.

#watchdog/dev/watchdog #该选项是可选配置, it is through heartbeat to monitor the running state of the system. Using this feature, you need to load the "Softdog" kernel module in the kernel to generate the actual device files, and if the system does not have this kernel module, you need to specify this module to recompile the kernel. The compilation completes the input "Insmod Softdog" to load the module. Then enter "grep misc/proc/devices" (should be 10) and enter "Cat/proc/misc |grep watchdog" (130). Finally, generate the device file: "Mknod/dev/watchdog C 10 130". You can use this feature.

Node Node1 #主节点主机名 and can be viewed by the command "Uanme–n".

Node Node2 #备用节点主机名.

Ping 192.168.60.1 #选择ping的节点, the better the ping node chooses, the stronger the HA cluster and the choice of a fixed router as the ping node, but it is best not to select a member of the cluster as the ping node, and the ping node will only be used to test the network connection.

Respawn Hacluster/usr/lib/heartbeat/ipfail #该选项是可选配置, lists the processes that are started and closed with heartbeat, which are typically integrated with heartbeat plug-ins. These processes are experiencing failures that can be restarted automatically. The most common process is ipfail, a process used to detect and handle network failures and to detect network connectivity with ping node specified by the ping statement. Where Hacluster represents the identity of the initiating ipfail process.

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.