Heartbeat 是一個基於Linux開源的,被廣泛使用的高可用集群系統。主要包括心跳服務和資源接管兩個高可用集群組件。本文簡要描述了在Linux環境下安裝heartbeat 2.1.4,同時描述了heartbeat的3個重要配置文件的配置方法。
有關heartbeat集群組件相關概念可參考: HeartBeat 集群組件概述
###准備安裝文件
###由於heartbeat V2版本已經不再更新,V2版本最終版為2.1.4。
###對於需要在Linux對於需要在Linux 6下安裝的可以從以下鏈接下載:
###對於Linux 5系列的可以在此下載:和https://dl.fedoraproject.org/pub/epel/5/x86_64/repoview/letter_h.group.html
# rpm -Uvh PyXML-0.8.4-19.el6.x86_64.rpm
# rpm -Uvh perl-MailTools-2.04-4.el6.noarch.rpm
# rpm -Uvh perl-TimeDate-1.16-11.1.el6.noarch.rpm
# rpm -Uvh libnet-1.1.6-7.el6.x86_64.rpm
# rpm -Uvh ipvsadm-1.26-2.el6.x86_64.rpm
# rpm -Uvh lm_sensors-libs.x86_64 0:3.1.1-17.el6
# rpm -Uvh net-snmp-libs.x86_64.rpm
# rpm -Uvh heartbeat-pils-2.1.4-12.el6.x86_64.rpm
# rpm -Uvh heartbeat-stonith-2.1.4-12.el6.x86_64.rpm
# rpm -Uvh heartbeat-2.1.4-12.el6.x86_64.rpm
###以下2個rpm包根據需要安裝,一個是Heartbeat development package,一個是針對lvs
# rpm -Uvh heartbeat-devel-2.1.4-12.el6.x86_64.rpm
# rpm -Uvh heartbeat-ldirectord-2.1.4-12.el6.x86_64.rpm
###驗證安裝包
# rpm -qa |grep -i heartbeat
heartbeat-2.1.4-12.el6.x86_64
heartbeat-pils-2.1.4-12.el6.x86_64
heartbeat-stonith-2.1.4-12.el6.x86_64
heartbeat-ldirectord-2.1.4-12.el6.x86_64
heartbeat-devel-2.1.4-12.el6.x86_64
#復制樣本配置文件到/etc/ha.d目錄下並作相應修改
# cp /usr/share/doc/heartbeat-2.1.4/ha.cf /etc/ha.d/
# cp /usr/share/doc/heartbeat-2.1.4/haresources /etc/ha.d/
# cp /usr/share/doc/heartbeat-2.1.4/authkeys /etc/ha.d/
#
二、配置heartbeat
heartbeat配置主要由3個文件組成,一個是ha.cf,一個是authkeys,一個是haresources,下面分別描述。
1、ha.cf
該文件是heartbeat的主要配置文件,大致包括如下信息:
heartbeat日志文件輸出級別,位置;
心跳時長,告警時長,腦裂時長,初始化時長等;
心跳通訊方式,IP,端口號,串口設備,波特率等;
節點名稱,隔離方式等。
示例文件描述
[root@orasrv1 ha.d]# more ha.cf
#
# There are lots of options in this file. All you have to have is a set
# of nodes listed {"node ...} one of {serial, bcast, mcast, or ucast},
# and a value for "auto_failback".
# 必須設置的有節點列表集{node ...},{serial,bcast,mcast,或ucast}中的一個,auto_failback的值
#
# ATTENTION: As the configuration file is read line by line,
# THE ORDER OF DIRECTIVE MATTERS!
# 配置文件是逐行讀取的,並且選項的順序是會影響最終結果的。
#
# In particular, make sure that the udpport, serial baud rate
# etc. are set before the heartbeat media are defined!
# debug and log file directives go into effect when they
# are encountered.
#
# 確保在udpport,serial baud rate在heartbeat檢測前預先定義或預留可用
# 也就是是在定義網卡,串口等心跳檢測接口前先要定義端口號。
#
# All will be fine if you keep them ordered as in this example.
# 如果保持本樣例中的定義順序,本配置將會正常工作。
#
# Note on logging:
# If all of debugfile, logfile and logfacility are not defined,
# logging is the same as use_logd yes. In other case, they are
# respectively effective. if detering the logging to syslog,
# logfacility must be "none".
# 記錄日志方面的注意事項:
# 如果debugfile,logfile和logfacility都沒有定義,日志記錄就相當於use_logd yes。
# 否則,他們將分別生效。如果要阻止記錄日志到syslog,那麼logfacility必須設置為“none”
#
# File to write debug messages to
#寫入debug消息的文件
#debugfile /var/log/ha-debug
#
#
# File to write other messages to
#
#單獨指定日志文件
logfile /var/log/ha-log
#
#
# Facility to use for syslog()/logger
#用於syslog()/logger的設備,通常情況下不建議與logfile同時啟用
#logfacility local0
#
#
# A note on specifying "how long" times below...
#
# The default time unit is seconds
# 10 means ten seconds
#
# You can also specify them in milliseconds
# 1500ms means 1.5 seconds
#
#
# keepalive: how long between heartbeats?
#心跳時長
#keepalive 2
#
# deadtime: how long-to-declare-host-dead?
#
# If you set this too low you will get the problematic
# split-brain (or cluster partition) problem.
# See the FAQ for how to use warntime to tune deadtime.
# 如果這個時間值設置得過長將導致腦裂或集群分區的問題。
#心跳丟失後死亡時長
#deadtime 30
#
# warntime: how long before issuing "late heartbeat" warning?
# See the FAQ for how to use warntime to tune deadtime.
#
#
#心跳丟失後警告時長
#warntime 10
#
#
# Very first dead time (initdead)
#
# On some machines/OSes, etc. the network takes a while to come up
# and start working right after you've been rebooted. As a result
# we have a separate dead time for when things first come up.
# It should be at least twice the normal dead time.
# 在某些機器/操作系統等中,網絡在機器啟動或重啟後需要花一定的時間啟動並正常工作。
# 因此我們必須分開他們初次起來的dead time,這個值應該最少設置為兩倍的正常dead time。
#
#初始死亡時長
#initdead 120
#
#
# What UDP port to use for bcast/ucast communication?
#
#端口號的配置
#udpport 694
#
# Baud rate for serial ports...
#
#波特率的配置
#baud 19200
#
# serial serialportname ...
#串口名稱
#serial /dev/ttyS0 # Linux
#serial /dev/cuaa0 # FreeBSD
#serial /dev/cuad0 # FreeBSD 6.x
#serial /dev/cua/a # Solaris
#
#
# What interfaces to broadcast heartbeats over?
#
#廣播的網絡接口名稱
#bcast eth0 # Linux
#bcast eth1 eth2 # Linux
#bcast le0 # Solaris
#bcast le1 le2 # Solaris
#
# Set up a multicast heartbeat medium
# mcast [dev] [mcast group] [port] [ttl] [loop]
#
# [dev] device to send/rcv heartbeats on
# [mcast group] multicast group to join (class D multicast address
# 224.0.0.0 - 239.255.255.255)
# [port] udp port to sendto/rcvfrom (set this value to the
# same value as "udpport" above)
# [ttl] the ttl value for outbound heartbeats. this effects
# how far the multicast packet will propagate. (0-255)
# Must be greater than zero.
# [loop] toggles loopback for outbound multicast heartbeats.
# if enabled, an outbound packet will be looped back and
# received by the interface it was sent on. (0 or 1)
# Set this value to zero.
#
#有關多播的配置
#mcast eth0 225.0.0.1 694 1 0
#
# Set up a unicast / udp heartbeat medium
# ucast [dev] [peer-ip-addr]
#
# [dev] device to send/rcv heartbeats on
# [peer-ip-addr] IP address of peer to send packets to
#
#
#ucast eth0 192.168.1.2
#
#對於廣播,單播或多播,各有優缺點。
#單播多用於2節點情形,但是2節點上則不能使用相同的配置文件,因為ip地址不一樣
#
#
# About boolean values... 關於boolean值
#
# 下面的任意不區分大小寫敏感值將被當作true
# Any of the following case-insensitive values will work for true:
# true, on, yes, y, 1
# 下面的任意不區分大小寫敏感值將被當作false
# Any of the following case-insensitive values will work for false:
# false, off, no, n, 0
#
#
#
#
# auto_failback: determines whether a resource will
# automatically fail back to its "primary" node, or remain
# on whatever node is serving it until that node fails, or
# an administrator intervenes.
# 決定一個resource是否自動恢復到它的初始primary節點,
# 或者繼續運行在轉移後的節點直到出現故障或管理員進行干預。
#
# The possible values for auto_failback are:
# on - enable automatic failbacks
# off - disable automatic failbacks
# legacy - enable automatic failbacks in systems
# where all nodes do not yet support
# the auto_failback option.
#
# auto_failback "on" and "off" are backwards compatible with the old
# "nice_failback on" setting.
#
# See the FAQ for information on how to convert
# from "legacy" to "on" without a flash cut.
# (i.e., using a "rolling upgrade" process)
#
# The default value for auto_failback is "legacy", which
# will issue a warning at startup. So, make sure you put
# an auto_failback directive in your ha.cf file.
# (note: auto_failback can be any boolean or "legacy")
#
#自動failback配置
auto_failback on
#
#
# Basic STONITH support
# Using this directive assumes that there is one stonith
# device in the cluster. Parameters to this device are
# read from a configuration file. The format of this line is:
#
# stonith
#
# NOTE: it is up to you to maintain this file on each node in the
# cluster!
#
#基本STONITH支持
#stonith baytech /etc/ha.d/conf/stonith.baytech
#
# STONITH support
# You can configure multiple stonith devices using this directive.
# The format of the line is:
# stonith_host
# is the machine the stonith device is attached
# to or * to mean it is accessible from any host.
# is the type of stonith device (a list of
# supported drives is in /usr/lib/stonith.)
# are driver specific parameters. To see the
# format for a particular device, run:
# stonith -l -t
#
#
# Note that if you put your stonith device access information in
# here, and you make this file publically readable, you're asking
# for a denial of service attack ;-)
#
# To get a list of supported stonith devices, run
# stonith -L
# For detailed information on which stonith devices are supported
# and their detailed configuration options, run this command:
# stonith -h
#
#stonith_host * baytech 10.0.0.3 mylogin mysecretpassword
#stonith_host ken3 rps10 /dev/ttyS1 kathy 0
#stonith_host kathy rps10 /dev/ttyS1 ken3 0
#
# Watchdog is the watchdog timer. If our own heart doesn't beat for
# a minute, then our machine will reboot.
# NOTE: If you are using the software watchdog, you very likely
# wish to load the module with the parameter "nowayout=0" or
# compile it without CONFIG_WATCHDOG_NOWAYOUT set. Otherwise even
# an orderly shutdown of heartbeat will trigger a reboot, which is
# very likely NOT what you want.
#
#watchdog計時器的配置
#watchdog /dev/watchdog
#
# Tell what machines are in the cluster
# node nodename ... -- must match uname -n
#
#節點名稱配置,重要,必須與uname -n獲得的名字等同
#node ken3
#node kathy
#
# Less common options...
#
# Treats 10.10.10.254 as a psuedo-cluster-member
# Used together with ipfail below...
# note: don't use a cluster node as ping node
# 將10.10.10.254看成一個偽集群成員,與下面的 ipfail一起使用。
# 注意:不要使用一個集群節點作為ping節點,通常可以設置為Ping 網關。
# 此作用用於覺定集群重構的仲裁票數
#
#ping 10.10.10.254
#
# Treats 10.10.10.254 and 10.10.10.253 as a psuedo-cluster-member
# called group1. If either 10.10.10.254 or 10.10.10.253 are up
# then group1 is up
# Used together with ipfail below...
# 同上,意思是兩個IP當中,任意一個ping通即可
#
#ping_group group1 10.10.10.254 10.10.10.253
#
# HBA ping derective for Fiber Channel
# Treats fc-card-name as psudo-cluster-member
# used with ipfail below ...
#
# You can obtain HBAAPI from http://hbaapi.sourceforge.net. You need
# to get the library specific to your HBA directly from the vender
# To install HBAAPI stuff, all You need to do is to compile the common
# part you obtained from the sourceforge. This will produce libHBAAPI.so
# which you need to copy to /usr/lib. You need also copy hbaapi.h to
# /usr/include.
#
# The fc-card-name is the name obtained from the hbaapitest program
# that is part of the hbaapi package. Running hbaapitest will produce
# a verbose output. One of the first line is similar to:
# Apapter number 0 is named: qlogic-qla2200-0
# Here fc-card-name is qlogic-qla2200-0.
#
#hbaping fc-card-name
#
#
# Processes started and stopped with heartbeat. Restarted unless
# they exit with rc=100
# 指定當一個heartbeat服務或節點宕機時如何處理。
# 開啟ipfail則是重啟對應的節點,該進程被自動監視,遇到故障則重新啟動。
# ipfail進程用於檢測和處理網絡故障,需要配合ping語句指定的ping node來檢測網絡連接。
#
#respawn userid /path/name/to/run
#respawn hacluster /usr/lib/heartbeat/ipfail
#
# Access control for client api
# default is no access
#
#apiauth client-name gid=gidlist uid=uidlist
#apiauth ipfail gid=haclient uid=hacluster
######################################
#
# Unusual options. 不常用選項
#
######################################
#
# hopfudge maximum hop count minus number of nodes in config
#hopfudge 1
#
# deadping - dead time for ping nodes
#deadping 30
#
# hbgenmethod - Heartbeat generation number creation method
# Normally these are stored on disk and incremented as needed.
#hbgenmethod time
#
# realtime - enable/disable realtime execution (high priority, etc.)
# defaults to on
#realtime off
#
# debug - set debug level
# defaults to zero
#debug 1
#
# API Authentication - replaces the fifo-permissions-based system of the past
#
# You can put a uid list and/or a gid list.
# If you put both, then a process is authorized if it qualifies under either
# the uid list, or under the gid list.
#
# The groupname "default" has special meaning. If it is specified, then
# this will be used for authorizing groupless clients, and any client groups
# not otherwise specified.
#
# There is a subtle exception to this. "default" will never be used in the
# following cases (actual default auth directives noted in brackets)
# ipfail (uid=HA_CCMUSER) Author : Leshami
# ccm (uid=HA_CCMUSER) Blog : http://blog.csdn.net/leshami
# ping (gid=HA_APIGROUP)
# cl_status (gid=HA_APIGROUP)
#
# This is done to avoid creating a gaping security hole and matches the most
# likely desired configuration.
# 這避免生成一個安全漏洞缺口,可以實現能很多人最渴望的安全配置。
#
#apiauth ipfail uid=hacluster
#apiauth ccm uid=hacluster
#apiauth cms uid=hacluster
#apiauth ping gid=haclient uid=alanr,root
#apiauth default gid=haclient
# message format in the wire, it can be classic or netstring,
# default: classic
#msgfmt classic/netstring
# Do we use logging daemon?
# If logging daemon is used, logfile/debugfile/logfacility in this file
# are not meaningful any longer. You should check the config file for logging
# daemon (the default is /etc/logd.cf)
# more infomartion can be fould in http://www.linux-ha.org/ha_2ecf_2fUseLogdDirective
# Setting use_logd to "yes" is recommended
#
# use_logd yes/no
#
# the interval we reconnect to logging daemon if the previous connection failed
# default: 60 seconds
#conn_logd_time 60
#
#
# Configure compression module
# It could be zlib or bz2, depending on whether u have the corresponding
# library in the system.
#compression bz2
#
# Confiugre compression threshold
# This value determines the threshold to compress a message,
# e.g. if the threshold is 1, then any message with size greater than 1 KB
# will be compressed, the default is 2 (KB)
#compression_threshold 2
2、authkeys 認證信息配置
該文件主要用於配置heartbeat的認證信息。共有三種可用的方式:crc、md5和sha1。
三種方式安全性依次提高,但同時占用的系統資源也依次擴大。
crc安全性最低,適用於物理上比較安全的網絡,sha1提供最為有效的鑒權方式,占用的系統資源也最多。
該authkeys文件的文件其許可權應該設為600(即-rw-------)。命令為: chmod 600 authkeys
其配置語句格式如下:
auth
[desc]
舉例說明:
auth 1
1 sha1 key-for-sha1
其中鍵值key-for-sha1可以任意指定,number設置必須保證上下一致。
auth 2
2 crc
crc方式不需要指定鍵值。
示例文件描述
[root@orasrv1 ha.d]# more authkeys
#
# Authentication file. Must be mode 600
#
# Must have exactly one auth directive at the front.
# auth send authentication using this method-id
#
# Then, list the method and key that go with that method-id
#
# Available methods: crc sha1, md5. Crc doesn't need/want a key.
#
# You normally only have one authentication method-id listed in this file
#
# Put more than one to make a smooth transition when changing auth
# methods and/or keys.
#
#
# sha1 is believed to be the "best", md5 next best.
#
# crc adds no security, except from packet corruption.
# Use only on physically secure networks.
#
#auth 1
#1 crc
#2 sha1 HI!
#3 md5 Hello!
3、haresources 資源配置
haresources文件用於指定集群系統的節點、集群IP、子網掩碼、廣播地址以及啟動的相關服務等。
其配置語句格式如下:
node-name network-config resouce-group
node-name:指定集群系統的節點名稱,取值必須匹配ha.cf文件中node選項設置的主機名中的相同。
network-config:用於網絡設置,包括指定集群IP、子網掩碼、廣播地址等。
resource-group:用於設置heartbeat管理的相關集群服務,也就是這些服務可以由Heartbeat來啟動和關閉。
對於使用heartbeat接管的相關服務,必須將服務寫成可以通過start/stop來啟動和關閉的腳步,然後放到/etc /init.d/
或者/etc/ha.d/resource.d/目錄下,Heartbeat(TE)會根據腳本的名稱自動去上述目錄下找到相應腳本進行啟動或關閉操作。
示例描述:
node1 IPaddr::192.168.21.10/24/eth0/ Filesystem:: /dev/sdb2::/webdata::ext3 httpd tomcat
node1:
節點名稱
IPaddr::192.168.21.10/24/eth0/
IPaddr為heartbeat提供的一個腳本,位於/etc/ha.d/resource.d目錄
執行/etc/ha.d/resource.d/IPaddr 192.168.21.10/24 start的操作
虛擬出一個子網掩碼為255.255.255.0,IP為192.168.21.10的地址。
此IP為Heartbeat對外提供服務的網絡地址,同時指定此IP使用的網絡接口為eth0
Filesystem:: /dev/sdb2::/webdata::ext3
Filesystem為heartbeat提供的一個腳本,位於/etc/ha.d/resource.d目錄
執行共享磁盤分區的掛載操作,等同於命令行下的mount -t ext3 /dev/sdb2 /webdata
httpd tomcat
依次啟動httpd,以及tomcat服務
注:對於多個網絡接口,不同子網的情行,IP地址,通常會使用別名綁定在跟VIP在同一網段內的網絡接口上。
如: eth0 : 172.16.100.6 eth1 : 192.168.0.6 VIP : 172.16.100.5
則VIP 會綁定在eth0上,因為2個地址在同一網段,由這個命令來完成/usr/lib64/heartbeat/findif
示例文件描述
[root@orasrv1 ha.d]# more haresources
#
# This is a list of resources that move from machine to machine as
# nodes go down and come up in the cluster. Do not include
# "administrative" or fixed IP addresses in this file.
# 集群中的節點停機和啟動時,這裡配置的資源列表會從一個節點轉移到另一個節點,
# 不過資源列表中不要包含管理或已經配置在服務器上的IP地址在這個文件中。
#
# The haresources files MUST BE IDENTICAL on all nodes of the cluster.
# 此haresources文件在所有的集群節點中都必須相同
#
# The node names listed in front of the resource group information
# is the name of the preferred node to run the service. It is
# not necessarily the name of the current machine. If you are running
# auto_failback ON (or legacy), then these services will be started
# up on the preferred nodes - any time they're up.
#
# 列在resource組信息前的節點名稱是主機的hostname,它不需要是當前機器的名稱,如果你配置auto_failback on
# (或者legacy),那麼這些服務將會在首選的節點上啟動,只要主機是運行的。
#
# If you are running with auto_failback OFF, then the node information
# will be used in the case of a simultaneous start-up, or when using
# the hb_standby {foreign,local} command.
# 如果你配置的是auto_failback off,在集群重構或者使用hb_standby {foreign,local}命令,節點信息將被使用
#
# BUT FOR ALL OF THESE CASES, the haresources files MUST BE IDENTICAL.
# If your files are different then almost certainly something
# won't work right.
# 但是對於所有的這些情況,此haresources文件都必須相同。如果你的文件不同那麼肯定有某些功能將不能正常工作。
#
#
#
# We refer to this file when we're coming up, and when a machine is being
# taken over after going down.
# 在節點啟動和一個節點停機後被接管的時候會參考這個文件。
#
# You need to make this right for your installation, then install it in
# /etc/ha.d
# 安裝時把它放到/etc/ha.d目錄
#
# Each logical line in the file constitutes a "resource group".
# A resource group is a list of resources which move together from
# one node to another - in the order listed. It is assumed that there
# is no relationship between different resource groups. These
# resource in a resource group are started left-to-right, and stopped
# right-to-left. Long lists of resources can be continued from line
# to line by ending the lines with backslashes ("\").
#
# 在文件裡面的每個邏輯行組成一個“resource group”,下簡稱資源組
# 一個資源組就是從一個節點切換到另一個節點時的資源順序列表。
# 假定不同的資源組之間是沒有關系的,資源組的啟動時是從左到右的。關閉時是從右到左的。
# 過長的resources列表可以以反斜槓(“\”)結尾來續行。
#
# These resources in this file are either IP addresses, or the name
# of scripts to run to "start" or "stop" the given resource.
# 在這個文件裡面的resources可以是IP地址,也可以是用於“start”或“stop”給定的resource的腳本名稱
#
# The format is like this:
# 樣例
#
#node-name resource1 resource2 ... resourceN
#
#
# If the resource name contains an :: in the middle of it, the
# part after the :: is passed to the resource script as an argument.
# Multiple arguments are separated by the :: delimeter
# 如果資源的名稱包含一個::在它的中間,在::後面的部分會傳遞給資源的腳本中作為一個參數,多個參數會以::分割。
#
# In the case of IP addresses, the resource script name IPaddr is
# implied.
# 在IP地址的情況中,resource腳本名稱IPaddr是隱含的。
#
# For example, the IP address 135.9.8.7 could also be represented
# as IPaddr::135.9.8.7
# 例如:IP地址135.9.8.7也可以被表示為IPaddr::135.9.8.7
#
# THIS IS IMPORTANT!! vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#
# The given IP address is directed to an interface which has a route
# to the given address. This means you have to have a net route
# set up outside of the High-Availability structure. We don't set it
# up here -- we key off of it.
# 給定的IP地址會直接連到有路由到給定的地址的接口上,
# 這也就意味著你必須要在 High-Availability 外部配置一個網絡路由。
#
# The broadcast address for the IP alias that is created to support
# an IP address defaults to the highest address on the subnet.
# IP別名的廣播地址將被缺省創建為支持IP地址的子網裡的最高地址
#
# The netmask for the IP alias that is created defaults to the same
# netmask as the route that it selected in in the step above.
# IP別名的子網掩碼將被缺省創建為與上一步驟選擇的路由相同的子網掩碼
#
# The base interface for the IPalias that is created defaults to the
# same netmask as the route that it selected in in the step above.
# IP別名的基礎接口將被缺省創建為與上面選擇的路由相同的子網掩碼
#
# If you want to specify that this IP address is to be brought up
# on a subnet with a netmask of 255.255.255.0, you would specify
# this as IPaddr::135.9.8.7/24 .
# 上面為子網掩碼指定示例
#
# If you wished to tell it that the broadcast address for this subnet
# was 135.9.8.210, then you would specify that this way:
# IPaddr::135.9.8.7/24/135.9.8.210
# 上面為廣播地址指定示例
#
# If you wished to tell it that the interface to add the address to
# is eth0, then you would need to specify it this way:
# IPaddr::135.9.8.7/24/eth0
# 如果你希望指明要增加地址的接口是eth0,那麼你需要像這樣指定 IPaddr::135.9.8.7/24/eth0
#
# And this way to specify both the broadcast address and the
# interface:
# IPaddr::135.9.8.7/24/eth0/135.9.8.210
# 同時指定廣播地址和接口的方法為: IPaddr::135.9.8.7/24/eth0/135.9.8.210
#
# The IP addresses you list in this file are called "service" addresses,
# since they're they're the publicly advertised addresses that clients
# use to get at highly available services.
# 這個文件中的IP地址列表,叫做服務地址,它們是客戶端用於獲取高可用服務的公共通告地址
#
# For a hot/standby (non load-sharing) 2-node system with only
# a single service address,
# you will probably only put one system name and one IP address in here.
# The name you give the address to is the name of the default "hot"
# system.
# 對於一個雙機熱備(非共享負載)單服務地址的系統,你可能只需要放置一個系統名稱和一個IP地址在這裡。
# 你指定的地址對應的名字就是缺省的"hot"系統的名字。
#
# Where the nodename is the name of the node which "normally" owns the
# resource. If this machine is up, it will always have the resource
# it is shown as owning.
# 節點名稱就是正常情況下擁有resource的節點的名稱。
# 如果此機器是up的,他將一直擁有顯示的resource。
#
# The string you put in for nodename must match the uname -n name
# of your machine. Depending on how you have it administered, it could
# be a short name or a FQDN.
# 節點名應當與uname -n查看的結果一致
#-------------------------------------------------------------------
#
# Simple case: One service address, default subnet and netmask
# No servers that go up and down with the IP address
# 單服務地址,缺省子網和掩碼,沒有服務與IP地址一起啟動和關閉
#
#just.linux-ha.org 135.9.216.110
#
#-------------------------------------------------------------------
#
# Assuming the adminstrative addresses are on the same subnet...
# A little more complex case: One service address, default subnet
# and netmask, and you want to start and stop http when you get
# the IP address...
# 假定管理地址在相同的子網...
# 稍微復雜一些的情況:一個服務地址,缺省子網和子網掩碼,同時你想要獲得IP地址的時候啟動和停止http。
#
#just.linux-ha.org 135.9.216.110 http
#-------------------------------------------------------------------
#
# A little more complex case: Three service addresses, default subnet
# and netmask, and you want to start and stop http when you get
# the IP address...
# 稍微復雜一些的情況:三個服務地址,缺省子網和掩碼,同時你要在獲得IP地址的時候啟動和停止http。
#
#just.linux-ha.org 135.9.216.110 135.9.215.111 135.9.216.112 httpd
#-------------------------------------------------------------------
#
# One service address, with the subnet, interface and bcast addr
# explicitly defined.
# 一個服務地址,顯式指定子網,接口,廣播地址
#
#just.linux-ha.org 135.9.216.3/28/eth0/135.9.216.12 httpd
#
#-------------------------------------------------------------------
#
# An example where a shared filesystem is to be used.
# Note that multiple aguments are passed to this script using
# the delimiter '::' to separate each argument.
# 一個使用共享文件系統的例子
# 需要注意用'::'分隔的多個參數被傳遞到了這個腳本
#
#node1 10.0.0.170 Filesystem::/dev/sda1::/data1::ext2
#
# Regarding the node-names in this file:
#
# They must match the names of the nodes listed in ha.cf, which in turn
# must match the `uname -n` of some node in the cluster. So they aren't
# virtual in any sense of the word.
#
三、使用集群的其他幾個相關配置(具體描述略)
a、配置主機host解析
b、配置等效驗證
c、高可用的相關服務配置(如httpd,myqld等),關閉自啟動
d、如需要用到共享存儲,還應配置相關存儲系統