Heartbeat the implementation of a highly available Web cluster for the V1 version of CRM

Source: Internet
Author: User
Tags rsyslog

Experimental environment Planning:


Lab Environment:

CentOS Release 6.6 (Final) Three

IP address:

Node1 :   eth0 : 172.16.31.10/16

172.16.31.11/16

Client :   eth0 : 172.16.31.12/16



650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/58/02/wKioL1SnoFuwzogyAAD7WnoeO7w392.jpg "title=" 8.jpg " alt= "Wkiol1snofuwzogyaad7wnoeo7w392.jpg" style= "padding:0px;margin:0px;vertical-align:top;border:none;"/>

Cluster architecture diagram:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/04/wKiom1Snn9GhnoO0AAGpQF3Pnns029.jpg "title=" Heartbeatv1.jpg "alt=" wkiom1snn9ghnoo0aagpqf3pnns029.jpg "width=" 650 "style=" padding:0px;margin:0px; Vertical-align:top;border:none; "/>



I. Heartbeat feature Description:

1. Implement the underlying heartbeat delivery

2. Start shutting down the Cluster service

3. Working node up to 16 nodes, consisting of a master node and other spare nodes

Symmetric and Asymmetric nodes

4. Heartbeat information is sent by the primary node at startup

UDP-based unicast (Unicast), UDP broadcast (broadcast), UDP multicast (multicast), Serial line communication propagation (serial cable)

Two. Prerequisites for configuring HA Clusters:

1, the time between nodes must be synchronized;

It is recommended to use the NTP protocol;

2, the nodes must communicate with each other through the host name;

It is recommended to use the Hosts file;

The name used in the communication must be consistent with the name shown in the "uname-n" command on the node;

3, if it is 2 nodes, the need for arbitration equipment;

4, the nodes between each other root user can be based on SSH key mode of communication;

Note: Any resource defined as a Cluster service cannot boot automatically because they will be started by CRM;

Three. Resource Preparation:

1, selected VIP;

2, httpd:

Install the program;

HTTPD configuration, local testing completed;

Turn off the service and make sure the boot does not start automatically;

3. Shared Storage:nfs

Four. Pre-condition configuration of HA for node system

1. Time synchronization

Refer to my blog: http://sohudrgon.blog.51cto.com/3088108/1598314

2. Host name synchronization

[Email protected] ~]# cat/etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6

172.16.0.1 server.magelinux.com Server

172.16.31.10 node1.stu31.com Node1

172.16.31.11 node2.stu31.com Node2

3. Arbitration device for Gateway 172.16.0.1

4.SSH No key communication

Node1

[Email protected] ~]# ssh-keygen-t rsa-p ""

[Email protected] ~]# ssh-copy-id-i.ssh/id_rsa.pub [email protected]

The test copies the Node1 hosts file to Node2:

[Email protected] ~]# scp/etc/hosts [email protected]:/etc/hosts

Hosts 100% 268 0.3kb/s 00:00

Node2

[Email protected] ~]# ssh-keygen-t rsa-p ""

[Email protected] ~]# ssh-copy-id-i ssh/id_rsa.pub [email protected]

Test for non-key communication results:

[[Email protected] ~]# date; SSH node2 ' Date '

Thu Jan 1 20:44:09 CST 2015

Thu Jan 1 20:44:09 CST 2015

Guarantee the same time!

Five. Installing the Heartbeat Program

1. Install the Heartbeat package group

Get package Group:

[[email protected] heartbeat2]# ls

heartbeat-2.1.4-12.el6.x86_64.rpm

heartbeat-gui-2.1.4-12.el6.x86_64.rpm

heartbeat-ldirectord-2.1.4-12.el6.x86_64.rpm

heartbeat-pils-2.1.4-12.el6.x86_64.rpm

heartbeat-stonith-2.1.4-12.el6.x86_64.rpm

Install package Group:

Both Node1 and Node2 need to be installed;

Prerequisites require installation of the following dependent packages:

[email protected] heartbeat2]# Yum install-y net-snmp-libs libnet PyXML


To install the Heartbeat Suite program:

[Email protected] heartbeat2]# RPM-IVH heartbeat-2.1.4-12.el6.x86_64.rpm heartbeat-stonith-2.1.4-12.el6.x86_64.rpm heartbeat-pils-2.1.4-12.el6.x86_64.rpm heartbeat-gui-2.1.4-12.el6.x86_64.rpm

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

1:heartbeat-pils ########################################### [25%]

2:heartbeat-stonith ########################################### [50%]

3:heartbeat ########################################### [75%]

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

2. Copy the configuration file to the/ETC/HA.D directory:

[Email protected] heartbeat2]# cd/usr/share/doc/heartbeat-2.1.4/

[email protected] heartbeat-2.1.4]# CP ha.cf Authkeys haresources/etc/ha.d/

3. Configure the log for Rsyslog record heartbeat

[Email protected] ~]# vim/etc/rsyslog.conf

local0.*/var/log/heartbeat.log

Copies of a copy to Node2:

[Email protected] ~]# scp/etc/rsyslog.conf [email protected]:/etc/rsyslog.conf

rsyslog.conf 100%3203 3.1kb/s 00:00

4. Configure the HA.CF master configuration file:

[Email protected] ~]# cat/etc/ha.d/ha.cf |grep-v ^#

#日志记录

Logfacility local0

#组播配置

Mcast eth0 225.131.31.23 694 1 0

Auto_failback on

#集群节点

Node node1.stu31.com

Node node2.stu31.com

#仲裁设备

Ping 172.16.0.1

#是否开启heartbeat v2 version of CRM, we use the V1 version of CRM to test and comment out.

#crm on

5. Define the domain share key, the authentication file permission must be 600 or 400

[email protected] ~]# OpenSSL Rand-hex 6

72907725aaf0

[Email protected] ~]# Vim/etc/ha.d/authkeys

Auth 2

2 SHA1 72907725aaf0

6. Configuring cluster resources

[Email protected] ~]# vim/etc/ha.d/haresources

Node1.stu31.com 172.16.31.180/24/eth0/172.16.31.255 httpd

Copy a copy of the three configuration files to Node2:

[Email protected] ha.d]# scp-p authkeys ha.cf haresources node2:/etc/ha.d/

Authkeys 100% 684 0.7kb/s 00:00

HA.CF 100% 10KB 10.4kb/s 00:00

Haresources 100%5964 5.8kb/s 00:00

7. Determine that the httpd service is normal

[Email protected] ~]# echo "node2.stu31.com" >/var/www/html/index.html

[Email protected] ~]# echo "node1.stu31.com" >/var/www/html/index.html


Start the HTTPD service for testing

[[Email protected] ha.d]# service httpd start

Starting httpd: [OK]

[[Email protected] ~]# service httpd start

Starting httpd: [OK]

Access test:

[Email protected] ha.d]# Curl http://172.16.31.10

Node1.stu31.com

[Email protected] ha.d]# Curl http://172.16.31.11

Node2.stu31.com

After completion, turn off the service from startup and stop the HTTPD service:

Node1:

[[Email protected] ha.d]# service httpd stop

stopping httpd: [OK]

[Email protected] ha.d]# chkconfig httpd off

Node2:

[[Email protected] ~]# service httpd stop

stopping httpd: [OK]

[Email protected] ~]# chkconfig httpd off

Six. Start the heartbeat cluster

1. Start the Heartbeat service:

[[Email protected] ha.d]# service heartbeat start; SSH node2 ' service heartbeat start '

LOGD is already running

Starting High-availability Services:

2015/01/01_21:10:33 Info:resource is stopped

Done.

LOGD is already running

Starting High-availability Services:

2015/01/01_21:10:33 Info:resource is stopped

Done.

2. Access test:

[Email protected] ~]# Curl http://172.16.31.180

Node1.stu31.com

We closed the Node1 and tested it:

[[Email protected] ha.d]# service heartbeat stop

Stopping High-availability services:

Done.


IP address switched to Node2:

[[Email protected] ~]# IP addr Show

1:lo: <LOOPBACK,UP,LOWER_UP> mtu65536 qdisc noqueue State UNKNOWN

Link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00

inet 127.0.0.1/8 Scope host Lo

INET6:: 1/128 Scope Host

Valid_lft Forever Preferred_lft Forever

2:eth0: <broadcast,multicast,up,lower_up>mtu qdisc pfifo_fast State up Qlen 1000

Link/ether 08:00:27:58:d3:3e BRD FF:FF:FF:FF:FF:FF

inet 172.16.31.11/16 BRD 172.16.255.255 Scope Global eth0

inet 172.16.31.180/24 BRD 172.16.31.255 Scope Global eth0:0

Inet6 FE80::A00:27FF:FE58:D33E/64 Scope link

Valid_lft Forever Preferred_lft Forever

Access test:

[Email protected] ~]# Curl http://172.16.31.180

Node2.stu31.com

Test success!



This article is from the "eyes engraved with your Smile" blog, please be sure to keep this source http://dengaosky.blog.51cto.com/9215128/1964550

Heartbeat the implementation of a highly available Web cluster for the V1 version of CRM

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.