Old Wangxue linux-heartbeat-2.1.4-12.el6.x86_64

Source: Internet
Author: User

Experimental Purpose: to implement a Linux system cluster concurrently processing a service ( here , for example , Web Services).

experimental Material:8g Memory, Core i5-3230m, nvidia 720m win10 host. Centos6.4 Full version of the image, installed vmware11, three installed pure centos6.4 virtual machine.

Experimental principle:

Lvs does not need to be installed, because the linux2.6 kernel is covered, the name is Ipvsadm

Experimental steps:

The first step installs the support package:

Yum-y Install PyXML net-snmp-libs libnetrpm

however , CentOS does not provide libnet packages that need to be downloaded to epel libnet package after download installation:RPM-IVH libnet-1.1.6-7.el6.x86_64.rpm

The second step is to install the support package:

Yum-y Install Ipvsadm perl-mailtools perl-timedate

Step three: Install heartbeat sequentially :

RPM-IVH heartbeat-pils-2.1.4-12.el6.x86_64.rpmrpm-ivhheartbeat-stonith-2.1.4-12.el6.x86_64.rpm RPM-IVH Heartbea t-2.1.4-12.el6.x86_64.rpmrpm-ivhheartbeat-ldirectord-2.1.4-12.el6.x86_64.rpm

Change host name permanently:Vim/etc/sysconfig/network

Node1.lw.com

Node2.lw.com

Node3.lw.com

Change host name temporarily:hostname xxxxxxx

Change host name permanently:Vim/etc/sysconfig/network

node1.lw.com

Node2.lw.com

Change host name temporarily:hostname xxxxxxx

Change /etc/hosts

Add to

192.168.6.104 node1.lw.com

192.168.6.105 node2.lw.com

The next step is to establish a two-machine trust communication: Here take Bode2 as an example

1. generate a pair of keys

[[email protected] ~]# ssh-keygen -t rsa -p  '  -f .ssh/id_ Rsagenerating public/private rsa key pair. Your identification has been saved in.ssh/id_rsa. Your public key has been saved in.ssh/id_rsa.pub.the key fingerprint  is:a6:cc:09:67:e3:45:81:59:aa:3b:7d:61:93:38:4b:[email protected]the key ' S randomart  IMAGE IS:+--[ RSA 2048]----+|      +o         | |      o. .       | |      . .        | |     . o .       | |    e b s        | |     & X o       | |    o o .        | |     . .         | |                  |+------ -----------+

( If you have not ssh to another host,the root directory is not . SSH directory, method ... )

2. upload the public key to another host:

[Email protected] ~]# ssh-copy-id-i ssh/[email protected]the authenticity of host ' node1.lw.com (192.168.6.104) ' Can ' t b E established. RSA key fingerprint isc9:17:0b:0f:a3:0e:d8:8d:a8:06:ad:2b:ba:d7:7c:1a. Is you sure want to continueconnecting (yes/no)? yeswarning:permanently added ' node1.lw.com ' (RSA) to the list of known hosts. [email protected] ' s Password:now try logging into the machine, with "ssh" [email protected] ' ", and check in:. Ssh/authoriz Ed_keys to make sure we haven ' t added extra keysthat you weren ' t expecting.

Test it:

[[email protected] ~]# ssh 192.168.6.104 ' Ifconfig ' Eth1     link  encap:Ethernet  HWaddr00:0C:29:12:62:A0           inet addr:192.168.6.104 Bcast:192.168.6.255  Mask:255.255.255.0          inet6 addr: fe80::20c:29ff:fe12:62a0/64 Scope:Link          up broadcast running multicast mtu:1500   metric:1         rx packets:1977 errors:0  dropped:0 overruns:0 frame:0         TX  packets:1371 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000         rx  bytes:195441  (190.8&NBSp KiB)   TXbytes:169856  (165.8 kib)  lo       link  encap:local loopback          inet addr : 127.0.0.1 mask:255.0.0.0         inet6 addr: ::1/ 128 scope:host         up loopback running  mtu:16436  metric:1         rx packets:184  Errors:0 dropped:0 overruns:0 frame:0         tx  packets:184 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:0         rx  bytes:25686  (25.0 kib)   TXbytes:25686  (25.0 kib)


To repeat the steps on another host:

send the public key to node2.lw.com

view: where is the installed heartbeat file?

[Email protected] ~]# RPM-QL Heartbeat |less

copy three important files

Cp/usr/share/heartbeat2.1.4/{ha.cf,authkeys,haresource}/etc/ha.d/[[email protected] ha.d]# vim haresources

Add a row to the last face,

Node3.lw.com ipaddr::192.168.6.108/24/eth1httpd

where node3.lw.com is the default master node that is set.

[Email protected] ha.d]# vim HA.CF

These lines are removed #

Debugfile/var/log/ha-debug

Logfacility local0

KeepAlive 2

Bcast eth1

Auto_failback on

Ping 192.168.6.103

The other uses the default is good

Next note is to define which hosts are ha nodes:

#node Ken3

#node Kathy

Node node2.lw.com

Node node3.lw.com

[Email protected] ha.d]# vim Authkeys

Add two lines

Auth 1

1 MD5 051322a335b4106681e9b78079a288f6

where MD5 is followed by MD5- doped impurities.

Methods for generating random impurities

[[email protected] ha.d]# DD if=/dev/randomcount=1 bs=512 |md5sum

recorded 0+1 read- in

recorded the writing of 0+1.

bytes (+ B) copied,6.974e-05 sec,1.8 mb/ s

E13B8264A0810373E5DD3BDC3E6A4E7A-

[Email protected] ha.d]#

The first node is configured and then replicated to the second node:

[[email protected] ha.d]# scp authkeys haresourcesha.cf node2.lw.com:/etc/ha.d/ authkeys                                                         100%  693     0.7kb/s  00:00   haresources                                                      100% 5948      5.8KB/s   00:00   ha.cf                                                             100%   10KB  10.3kb/s   00:00   [[email protected] ha.d]# service  heartbeatrestartstopping high-availability services:done. waiting to allow  Resource takeover tocomplete:^[[a^[[b^[[bdone. starting high-availability services : 2015/11/12_19:09:07 info:  resource is stoppeddone. [[email protected]  ha.d]# ssh node2.lw.com ' Service heartbeat restart ' stopping high-availability  services:Done. Waiting to allow resource takeover tocomplete:Done.  Starting high-availability sErvices:2015/11/12_19:09:33 info:  resource is stoppeddone. [[email protected] ~]# ifconfigeth1     link encap:ethernet   hwaddr00:0c:29:7a:7c:a8          inet addr :192.168.6.105 bcast:192.168.6.255 mask:255.255.255.0          inet6 addr: fe80::20c:29ff:fe7a:7ca8/64 Scope:Link          UP BROADCAST RUNNING MULTICAST MTU:1500  Metric:1          RX packets:8667 errors:0 dropped:0  Overruns:0 frame:0         tx packets:6828 errors :0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000         rx bytes:2398319  (2.2 MIB)   TX bytes:933830  (911.9  KiB)  eth1:0   Link encap:Ethernet  HWaddr00:0C:29:7A:7C:A8           inet addr:192.168.6.108 Bcast:192.168.6.255  mask:255.255.255.0         up broadcast running  Multicast mtu:1500  metric:1 lo       link encap: local loopback          inet addr:127.0.0.1  Mask:255.0.0.0         inet6 addr: ::1/128 scope: host         up loopback running mtu:16436   Metric:1         RX packets:4 errors:0  dropped:0 overruns:0  frame:0         tx packets:4 errors:0 dropped:0  overruns:0 carrier:0         collisions:0  txqueuelen:0         rx bytes:358  (358.0 b)    TXbytes:358  (358.0 B)

look , eth1 has an alias. With the instructions already successful, to the browser

Visit 192.168.6.108


This article is from "Lao Wang Linux Journey" blog, please be sure to keep this source http://oldking.blog.51cto.com/10402759/1741350

Old Wangxue linux-heartbeat-2.1.4-12.el6.x86_64

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.