HA installation and configuration environment: www.2cto.com server1: eth0: 192.168.100.8 eth1 10.10.10.2 server2: eth0: 192.168.100.7 eth1 10.10.10.1 cluster ip192.168.100.9 specific configuration steps are as follows: 1. partition the shared disk. download the software and install the required software. First download the heartbeat software: download the latest heartbeatsoftware at http://linux-ha.org/download. Install heartbeat on www.2cto.com in addition to the necessary compilers, you need the following software development kit support: pkgconfig glib2-devel, e2fsprogs and libnet e2fsprogs can be installed from the system installation CD using rpm; e2fspros-dev el package libnet can only download the source code for installation,: http://www.packetfactory.net/libnet/ (1 ). install libnet tar-zxvf libnet.tar.gz cd libnet. /configure make & make install if you need to use the graphical Configuration tool, you need to add a user to log on to the cluster. # Install libtool groupadd-g 2000 haclient useradd-u 2000 haclient hacluster (2) install heartbeat tar-zxvf heartbeat-2.0.7.tar.gz cd heartbeat-2.0.7.tar.gz /. /ConfigureMe configure -- enable-mgmt -- with-ccmuser-name = hacluster # -- enable-mgmt: enable the graphic management tool -- with-ccmuser-name = hacluster: make install ############################### # software ###################################### ################ installation ########### ######################################## ################# Perform the same operations on the two machines. 3. configure the main heartbeat file/etc/ha. d/ha. cf requires three configuration files: ha. cf, haresources, authkeys. these three configuration files need to be copied to/etc/ha. d directory, but these three files are not found by default. Cp heartbeat-2.0.7/doc/ha. cf/etc/ha. d/cp heartbeat-2.0.7/doc/haresources/etc/ha. d/cp heartbeat-2.0.7/doc/authkeys/etc/ha. d/then modify these configuration files. (1) The main configuration file of heartbeat is:/etc/ha. d/ha. cf. configure the file logfile/var/log/ha. log # specifies the location where heartbeat logs are stored. # Crm yes # support for ClusterResourceManager (cluster resource management function) bcast eth1 # specify that the heartbeat mode is Ethernet broadcast, keepalive 2 is broadcast on the eth1 interface # specifies the heartbeat time to 2 seconds (that is, a broadcast is sent every two seconds on eth1 ). Warntime 10 # specifies the heartbeat delay time as 10 seconds. When the backup machine fails to reach the host within 10 seconds (the active server, that is, no heartbeat signal ), A warning log is written to the log, but the service is not switched. Deadtime 30 # if there is no heartbeat signal within 30 seconds, the service will be switched immediately. Initdead 120 # In some configurations, it takes some time for the Network to work after restart. This separate "deadtime" option can handle this situation udpport 694 # specifies the communication port of the cluster node. Auto_failback on # Whether to switch back automatically after the master node recovers. Node node1.clusting.com # Host Name of the machine in the cluster, which is the same as the output of "uname-n. Node node2.clusting.com # Host Name of the machine in the cluster, which is the same as the output of "uname-n. Respawn hacluster/usr/lib/hearbeat/ccm # list the command respawn hacluster/usr/lib/heartbeat/ipfail ping ping1.clusting.com ping2.clusting.com # list the ping nodes, these nodes are not cluster nodes. They are used to check network connections for modules such as ipfail. (2) Configure HA resources/etc/ha. d/clusters 192.168.100.9/28/192 .168.100.15 Filesystem:/dev/sdb1:/data1: ext3 httpd # Set node1.clusting.com as the master node, and the ip address of the Cluster Server: 192.168.100.9netmask is 255.255. 255.240, broadcast is 192.168.100.15, the Cluster Server has httpd, and shared Disk/dev/sdb1 # this file has only one line, which means that when the primary node node1.clusting.com is down, the slave node node2.clusting.com is automatically enabled to provide services. When you switch to node2.clusting.com, the httpd service is automatically started and/dev/sdb1 is mounted to/data1 (3) to configure Authkeys, You need to configure the third file authkeys to determine your authentication key. There are three authentication methods: crc, md5, and shal. If your heartbeat runs on the security network, you can use the cross-line crc. This is the lowest cost method from the resource point of view. If the network is not secure, but you also want to reduce the cpu usage by using md5, shal is the best way to authenticate cpu usage, which is the most difficult to crack. /Etc/ha. the content of the d/authkeys file is as follows: auth 1 1 shal key-for-shal-any-text-you-want # auth 1 indicates that the index is used, no matter what index value is specified by the keyword auth, it must be followed by a key value, if auth 4 is specified, a line of content 4 <signaturetype> <authstring> chmod 600/etc/ha is required. d/authkeys (4) Configure scp/etc/ha for another host. d/ha. cf 192.168.100.7:/etc/ha. d/scp/etc/ha. d/haresources 192.168.100.7:/etc/ha. d/scp/etc/ha. d/authkeys 192.168.100, 7:/etc/ha. d/chmod 600/etc/ha. d/authkeys (5) configure the shared disk to set the apache directory to the shared disk to ensure that the two machines httpd start the heartbeat service/etc/init for the unified website (6. d/heartbeat start