heartbeat安装手册

来源:互联网 发布:数据备份的方式有几种 编辑:程序博客网 时间:2024/04/24 20:54

 

HeartBeat安装

作者:李荣权    QQ:623290015   Blog:http://blog.csdn.net/lhfeng

1.   网络规划

内网:1.1.1.1    1.1.1.2

外网:10.1.1.1  10.1.1.2

vip: 10.1.1.253

2.   安装必须的软件

2.1、   挂载光盘

[root@node2 ~]# mount /dev/cdrom /media/

mount: block device /dev/cdrom is write-protected, mounting read-only

[root@node2 ~]# cd /media/Server/

2.2、   安装tix

[root@node2 Server]# rpm -ivh tix-8.4.0-11.fc6.i386.rpm tix-devel-8.4.0-11.fc6.i386.rpm tix-doc-8.4.0-11.fc6.i386.rpm

warning: tix-8.4.0-11.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:tix                    ########################################### [ 33%]

   2:tix-devel              ########################################### [ 67%]

   3:tix-doc                ########################################### [100%]

2.3、   安装sensor

[root@node2 Server]# rpm -ivh lm_sensors-2.10.7-4.el5.i386.rpm lm_sensors-devel-2.10.7-4.el5.i386.rpm

warning: lm_sensors-2.10.7-4.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:lm_sensors             ########################################### [ 50%]

   2:lm_sensors-devel       ########################################### [100%]

2.4、   安装snmp

[root@node2 Server]# rpm -ivh net-snmp-utils-5.3.2.2-7.el5.i386.rpm net-snmp-5.3.2.2-7.el5.i386.rpm net-snmp-perl-5.3.2.2-7.el5.i386.rpm

warning: net-snmp-utils-5.3.2.2-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:net-snmp               ########################################### [ 33%]

   2:net-snmp-utils         ########################################### [ 67%]

   3:net-snmp-perl          ########################################### [100%]

[root@node2 Server]# rpm -ivh tkinter-2.4.3-27.el5.i386.rpm

warning: tkinter-2.4.3-27.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:tkinter                ########################################### [100%]

2.5、   安装OPenIPMI

[root@node2 Server]# rpm -ivh OpenIPMI-devel-2.0.16-5.el5.i386.rpm OpenIPMI-perl-2.0.16-5.el5.i386.rpm OpenIPMI-python-2.0.16-5.el5.i386.rpm OpenIPMI-gui-2.0.16-5.el5.i386.rpm

warning: OpenIPMI-devel-2.0.16-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing...                ########################################### [100%]

   1:OpenIPMI-devel         ########################################### [ 25%]

   2:OpenIPMI-python        ########################################### [ 50%]

   3:OpenIPMI-perl          ########################################### [ 75%]

   4:OpenIPMI-gui           ########################################### [100%]

2.6、   安装libxslt

[root@node2 Server]# rpm -qa|grep libxslt

libxslt-1.1.17-2.el5_2.2

libxslt-devel-1.1.17-2.el5_2.2

2.7、   创建用户和组

[root@node2 Reusable-Cluster-Components-glue-1.0.6]# groupadd -g 65 haclient

[root@node2 Reusable-Cluster-Components-glue-1.0.6]# useradd -u 501 -g haclient hacluster

3.   解压缩软件包

3.1、   解压Glue

[root@node2 ~]# tar -jxvf Reusable-Cluster-Components-glue-1.0.6.tar.bz2

Reusable-Cluster-Components-glue-1.0.6/.hg_archival.txt

Reusable-Cluster-Components-glue-1.0.6/.hgignore

Reusable-Cluster-Components-glue-1.0.6/.hgsigs

………..

Reusable-Cluster-Components-glue-1.0.6/NEWS

Reusable-Cluster-Components-glue-1.0.6/README

3.2、   解压Agent

[root@node2 ~]# tar -jxvf Cluster-Resource-Agents-agents-1.0.3.tar.bz2

Cluster-Resource-Agents-agents-1.0.3/.hg_archival.txt

Cluster-Resource-Agents-agents-1.0.3/.hgignore

…….

Cluster-Resource-Agents-agents-1.0.3/Makefile.am

Cluster-Resource-Agents-agents-1.0.3/NEWS

3.3、   解压HeartBeart

[root@node2 ~]# tar -jxvf Heartbeat-3-0-STABLE-3.0.3.tar.bz2

Heartbeat-3-0-STABLE-3.0.3/.hg_archival.txt

Heartbeat-3-0-STABLE-3.0.3/.cvsignore

……..

Heartbeat-3-0-STABLE-3.0.3/acinclude.m4

Heartbeat-3-0-STABLE-3.0.3/autogen.sh

 

4.   编译安装Glue

4.1、   修改源代码

[root@node2 ~]# cd Reusable-Cluster-Components-glue-1.0.6/

[root@node2 Reusable-Cluster-Components-glue-1.0.6]# cd lib/stonith/

[root@node2 stonith]# vi main.c

/*

void version();

*/

 

/*

void

version()

{

        printf("stonith: %s (%s)/n", GLUE_VERSION, GLUE_BUILD_VERSION);

        exit(0);

}

*/

 

/*              case 'V':       version();

                                break;

*/

[root@node2 stonith]# cd ../..

4.2、   预编译

[root@node2 Reusable-Cluster-Components-glue-1.0.6]# ./autogen.sh

autoconf:       autoconf (GNU Autoconf) 2.59

automake:       automake (GNU automake) 1.9.6

libtoolize --ltdl --force --copy

You should add the contents of `/usr/share/aclocal/libtool.m4' to `aclocal.m4'.

aclocal

autoheader

automake --add-missing --include-deps --copy

configure.ac: installing `./install-sh'

configure.ac: installing `./missing'

lib/clplumbing/Makefile.am: installing `./depcomp'

lib/lrm/Makefile.am: installing `./compile'

Makefile.am: installing `./INSTALL'

autoconf

Now run ./configure

4.3、   配置源代码

[root@node2 Reusable-Cluster-Components-glue-1.0.6]# ./configure

cluster-glue configuration:

  Version                  = 1.0.6 (Build: 1c87a0c58c59fc384b93ec11476cefdbb6ddc1e1)

  Features                 =

 

  Prefix                   = /usr

  Executables              = /usr/sbin

  Man pages                = /usr/man

  Libraries                = /usr/lib

  Header files             = /usr/include

  Arch-independent files   = /usr/share

  Documentation            = /usr/share/doc

  State information        = /usr/var

  System configuration     = /usr/etc

 

  Use system LTDL          = no

 

  HA group name            = haclient

  HA user name             = hacluster

 

  CFLAGS                   = -g -O2 -ggdb3 -O0  -fgnu89-inline -fstack-protector-all -Wall -Waggregate-return -Wbad-function-cast -Wcast-qual -Wcast-align -Wdeclaration-after-statement -Wendif-labels -Wfloat-equal -Wformat=2 -Wformat-security -Wformat-nonliteral -Winline -Wmissing-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wnested-externs -Wno-long-long -Wno-strict-aliasing -Wpointer-arith -Wstrict-prototypes -Wwrite-strings -ansi -D_GNU_SOURCE -DANSI_ONLY -Werror

  Libraries                = -lbz2 -lxml2 -lc -luuid -lrt -ldl  -L/lib -lglib-2.0 

  Stack Libraries          =

4.4、   编译源代码

[root@node2 Reusable-Cluster-Components-glue-1.0.6]# make

Writing meatclient.8 for refentry(re-meatclient)

gmake[2]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6/doc'

gmake[1]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6/doc'

gmake[1]: Entering directory `/root/Reusable-Cluster-Components-glue-1.0.6'

gmake[1]: Nothing to be done for `all-am'.

gmake[1]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6'

4.5、   安装程序

[root@node2 Reusable-Cluster-Components-glue-1.0.6]# make install

chown hacluster //usr/var/lib/heartbeat/cores/hacluster

gmake[2]: Nothing to be done for `install-data-am'.

gmake[2]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6'

gmake[1]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6'

[root@node2 Reusable-Cluster-Components-glue-1.0.6]# cd ..

5.   编译安装agent

5.1、   预编译源代码

[root@node2 ~]# cd Cluster-Resource-Agents-agents-1.0.3/

[root@node2 Cluster-Resource-Agents-agents-1.0.3]# ./autogen.sh

Autoconf package autoconf found.

Automake package automake found.

aclocal

autoheader

aclocal

automake --add-missing --include-deps --copy

configure.in: installing `./install-sh'

configure.in: installing `./missing'

heartbeat/Makefile.am: installing `./depcomp'

tools/Makefile.am: installing `./compile'

configure.in:28: installing `./config.guess'

configure.in:28: installing `./config.sub'

Makefile.am: installing `./INSTALL'

autoconf

Now run ./configure

 

5.2、   配置源代码

[root@node2 Cluster-Resource-Agents-agents-1.0.3]# ./configure

config.status: executing depfiles commands

 

resource-agents configuration:

  Version                  = 1.0.3 (Build: 5ae70412eec8099b25e352110596dd279d267a8a)

  Features                 =

 

  Prefix                   = /usr

  Executables              = /usr/sbin

  Man pages                = /usr/man

  Libraries                = /usr/lib

  Header files             = /usr/include

  Arch-independent files   = /usr/share

  Documentation            = /usr/share/doc

  State information        = /usr/var

  System configuration     = /usr/etc

  AIS Plugins              =

 

  CFLAGS                   = -g -O2 -ggdb3 -O0  -fgnu89-inline -fstack-protector-all -Wall -Wbad-function-cast -Wcast-qual -Wcast-align -Wdeclaration-after-statement -Wendif-labels -Wfloat-equal -Wformat=2 -Wformat-security -Wformat-nonliteral -Winline -Wmissing-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wnested-externs -Wno-long-long -Wno-strict-aliasing -Wpointer-arith -Wstrict-prototypes -Wwrite-strings -ansi -D_GNU_SOURCE -DANSI_ONLY -Werror

  Libraries                =  -L/lib -lglib-2.0 

  Stack Libraries          =

5.3、   编译源代码

[root@node2 Cluster-Resource-Agents-agents-1.0.3]# make

gmake[1]: Leaving directory `/root/Cluster-Resource-Agents-agents-1.0.3/doc'

gmake[1]: Entering directory `/root/Cluster-Resource-Agents-agents-1.0.3'

gmake[1]: Nothing to be done for `all-am'.

gmake[1]: Leaving directory `/root/Cluster-Resource-Agents-agents-1.0.3'

5.4、   安装程序

[root@node2 Cluster-Resource-Agents-agents-1.0.3]# make install

gmake[2]: Leaving directory `/root/Cluster-Resource-Agents-agents-1.0.3/doc'

gmake[1]: Leaving directory `/root/Cluster-Resource-Agents-agents-1.0.3/doc'

gmake[1]: Entering directory `/root/Cluster-Resource-Agents-agents-1.0.3'

gmake[2]: Entering directory `/root/Cluster-Resource-Agents-agents-1.0.3'

gmake[2]: Nothing to be done for `install-exec-am'.

gmake[2]: Nothing to be done for `install-data-am'.

gmake[2]: Leaving directory `/root/Cluster-Resource-Agents-agents-1.0.3'

gmake[1]: Leaving directory `/root/Cluster-Resource-Agents-agents-1.0.3'

[root@node2 Cluster-Resource-Agents-agents-1.0.3]# cd ..

6.   编译安装HeartBeat

6.1、   预编译源代码

[root@node2 ~]# cd Heartbeat-3-0-STABLE-3.0.3/

[root@node2 Heartbeat-3-0-STABLE-3.0.3]# ./bootstrap

Autoconf package autoconf found.

Automake package automake-1.9 found.

Libtool package libtool found.

aclocal-1.9

autoheader

libtoolize --ltdl --force --copy

aclocal-1.9

automake-1.9 --add-missing --include-deps --copy

configure.in: installing `./install-sh'

configure.in: installing `./missing'

buildtools/Makefile.am: installing `./depcomp'

cts/Makefile.am:24: installing `./py-compile'

heartbeat/Makefile.am: installing `./compile'

autoconf

Now run ./configure.

at    libltdl.tar            Makefile.in  README.in

 

6.2、   配置源代码

[root@node2 Heartbeat-3-0-STABLE-3.0.3]# ./ConfigureMe configure

heartbeat configuration:

  Version                  = "3.0.2"

  Executables              = "/usr/sbin"

  Man pages                = "/usr/share/man"

  Libraries                = "/usr/lib"

  Header files             = "/usr/include"

  Arch-independent files   = "/usr/share"

  Documentation files      = "/usr/share/doc/"

  State information        = "/var"

  System configuration     = "/etc"

  Init (rc) scripts        = "/etc/init.d"

  Init (rc) defaults       = "/etc/sysconfig"

  Use system LTDL          = "no"

  HA group name            = "haclient"

  HA group id              = "65"

  HA user name             = "hacluster"

  HA user user id          = "501"

  SNMP libraries           = ""

  Build IPMILan Plugin     = "yes"

  Build dopd plugin        = "yes"

  Enable times kludge      = "yes"

  CC_WARNINGS              = " -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-arith -Wwrite-strings -Wcast-qual -Wcast-align -Wbad-function-cast -Winline -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -Werror "

  Mangled CFLAGS           = "-g -O2 -I/usr/include/heartbeat  -Wall -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wdeclaration-after-statement -Wpointer-arith -Wwrite-strings -Wcast-qual -Wcast-align -Wbad-function-cast -Winline -Wmissing-format-attribute -Wformat=2 -Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -Werror  -ggdb3 -funsigned-char"

  Libraries                = "-lbz2 -lz -lxml2 -lc -luuid -lpam -lrt -ldl "

  RPATH enabled            = "no"

  Distro-style RPMs        = "no"

 

Note: If you use the 'make install' method for installation you

also need to adjust '/etc/passwd' and '/etc/group' manually.

6.3、   编译源代码

[root@node2 Heartbeat-3-0-STABLE-3.0.3]# make

gmake[2]: Leaving directory `/root/Heartbeat-3-0-STABLE-3.0.3/contrib/drbd-outdate-peer'

gmake[2]: Entering directory `/root/Heartbeat-3-0-STABLE-3.0.3/contrib'

gmake[2]: Nothing to be done for `all-am'.

gmake[2]: Leaving directory `/root/Heartbeat-3-0-STABLE-3.0.3/contrib'

gmake[1]: Leaving directory `/root/Heartbeat-3-0-STABLE-3.0.3/contrib'

gmake[1]: Entering directory `/root/Heartbeat-3-0-STABLE-3.0.3'

GNUmakefile:44: warning: overriding commands for target `rpm'

Makefile:829: warning: ignoring old commands for target `rpm'

gmake[1]: Nothing to be done for `all-am'.

gmake[1]: Leaving directory `/root/Heartbeat-3-0-STABLE-3.0.3'

 

6.4、   安装程序

[root@node2 Heartbeat-3-0-STABLE-3.0.3]# make install

GNUmakefile:44: warning: overriding commands for target `rpm'

Makefile:829: warning: ignoring old commands for target `rpm'

gmake[2]: Nothing to be done for `install-exec-am'.

gmake[2]: Nothing to be done for `install-data-am'.

gmake[2]: Leaving directory `/root/Heartbeat-3-0-STABLE-3.0.3'

gmake[1]: Leaving directory `/root/Heartbeat-3-0-STABLE-3.0.3'

 

7.   配置群集

7.1、   同步配置文件

root@node2 ~]# cp –r /etc/ha.d   /usr/etc/ha.d/

[root@node2 etc]# rm –fr /etc/ha.d

[root@node2 etc]# ln -s /usr/etc/ha.d /etc/ha.d

7.2、   补齐配置文件

[root@node1 ~]# cp /usr/share/doc/ha.cf /usr/etc/ha.d

[root@node1 ~]# cp /usr/share/doc/authkeys /usr/etc/ha.d

[root@node1 ~]# chmod 600 /usr/etc/ha.d/authkeys

[root@node1 ~]# cp /root/Reusable-Cluster-Components-glue-1.0.6/logd/logd.cf /usr/etc

 

7.3、   修改配置文件

[root@node1 ~]# vi /usr/etc/ha.d/ha.c

[root@node1 etc]# cat /usr/etc/ha.d/ha.cf

#       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".

#

#       File to write debug messages to

#debugfile /var/log/ha-debug

#

#       File to write other messages to

logfile /var/log/ha-log

#

#       Facility to use for syslog()/logger

#

#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.

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

#mcast eth0 1.1.1.255 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

#

#       About boolean values...

#       Any of the following case-insensitive values will work for true:

#               true, on, yes, y, 1

#       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.

#

#       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")

#

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 <stonith_type> <configfile>

#

#       NOTE: it is up to you to maintain this file on each node in the

#       cluster!

#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 <hostfrom> <stonith_type> <params...>

#         <hostfrom> is the machine the stonith device is attached

#              to or * to mean it is accessible from any host.

#         <stonith_type> is the type of stonith device (a list of

#              supported drives is in /usr/lib/stonith.)

#         <params...> are driver specific parameters.  To see the

#              format for a particular device, run:

#           stonith -l -t <stonith_type>

#

#

#       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 /dev/watchdog

#      

#       Tell what machines are in the cluster

#       node    nodename ...    -- must match uname -n

#node   ken3

#node   kathy

node node1

node node2

#

#       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

#

#ping 10.10.10.254

ping 10.1.1.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...

#

#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

#

#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)

#                 ccm           (uid=HA_CCMUSER)

#                 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 the man page.

#       Setting use_logd to "yes" is recommended

#

use_logd yes

#

#       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

 

7.4、   配置群集资源

[root@node2 ha.d]# vi  /usr/etc/ha.d/haresources

#       You need to make this right for your installation, then install it in

#       /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 ("/").

#

#       These resources in this file are either IP addresses, or the name

#       of scripts to run to "start" or "stop" the given resource.

#

#       The format is like this:

#

#node-name resource1 resource2 ... resourceN

#node1 10.1.1.253 httpd

node2 10.1.1.253 httpd

#

#

#       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.

#

#       For example, the IP address 135.9.8.7 could also be represented

#       as 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.

#

#       The broadcast address for the IP alias that is created to support

#       an IP address defaults to the highest address on the subnet.

#

#       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.

#

#       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.

#

#       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

#

#       And this way to specify both the broadcast address and the

#       interface:

#               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.

#

#       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.

#

#       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.

#

#       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.

#

#-------------------------------------------------------------------

#

#       Simple case: One service address, default subnet and netmask

#               No servers that go up and down with the IP address

#

#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...

#

#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...

#

#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.

#

 

7.5、   配置日志文件

[root@node2 ha.d]# vi  /usr/etc/logd.cf

#       File to write debug messages to

#       Default: /var/log/ha-debug

debugfile /var/log/ha-debug

 

#

#

#       File to write other messages to

#       Default: /var/log/ha-log

logfile /var/log/ha-log

 

#       Facility to use for syslog()/logger

#       Default: daemon

#logfacility    daemon

 

#       Entity to be shown at beginning of a message

#       for logging daemon

#       Default: "logd"

entity logd

 

#       Do we register to apphbd

#       Default: no

#useapphbd no

 

#       There are two processes running for logging daemon

#               1. parent process which reads messages from all client channels

#               and writes them to the child process

# 

#               2. the child process which reads messages from the parent process through IPC

#               and writes them to syslog/disk

 

#       set the send queue length from the parent process to the child process

#

sendqlen 256

 

#       set the recv queue length in child process

#

recvqlen 256

 

7.6、   启动群集

[root@node1 etc]# service heartbeat start

7.7、   检查群集是否启动

 

[root@node1 ~]# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:01:AE:7F 

          inet addr:1.1.1.1  Bcast:1.1.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:775 errors:0 dropped:0 overruns:0 frame:0

          TX packets:453 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:110910 (108.3 KiB)  TX bytes:96886 (94.6 KiB)

          Interrupt:59 Base address:0x2000

 

eth1      Link encap:Ethernet  HWaddr 00:0C:29:01:AE:89 

          inet addr:10.1.1.1  Bcast:10.1.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:3088 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2363 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:290298 (283.4 KiB)  TX bytes:359786 (351.3 KiB)

          Interrupt:67 Base address:0x2080

 

eth1:0    Link encap:Ethernet  HWaddr 00:0C:29:01:AE:89 

          inet addr:10.1.1.253  Bcast:10.1.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          Interrupt:67 Base address:0x2080

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:8 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:560 (560.0 b)  TX bytes:560 (560.0 b)

 

7.8、   配置ha自动启动

[root@node1 etc]# chkconfig --add heartbeat

[root@node1 etc]# chkconfig --level 2345 heartbeat on

 

 

原创粉丝点击