Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Heartbeat installation

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Here I will provide several major software packages, others installed or installed ahead of time according to the error prompt.

Http://pan.baidu.com/share/link?shareid=2762183074&uk=1210957557

Http://pan.baidu.com/share/link?shareid=2768037872&uk=1210957557

Http://pan.baidu.com/share/link?shareid=2769389056&uk=1210957557

Node1 (master server): eth0:192.168.1.168 (node1) eth2:192.168.1.183 (priv1)

Node2 (slave server): eth0:192.168.1.181 (node2) eth2:192.168.1.182 (priv2)

VIP address: 192.168.1.185 (just write it in the heartbeat configuration file)

All operations of node1 and node2 are the same

[root@node1~] # vi / etc/hosts

192.168.1.168 node1

192.168.1.181 node2

192.168.1.183 priv1

192.168.1.182 priv2

[root@node1~] # groupadd-g 65 haclient

[root@node1~] # useradd-u 501-g haclienthacluster

[root@node1~] # tar jxf / samba/Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2-C / usr/local/src/

[root@node1~] # cd / usr/local/src/Reusable-Cluster-Components-glue--glue-1.0.9/

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9] #. / autogen.sh

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9] #. / configure-prefix=/usr/local/ha/

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9] # make

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9] # make install

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9] # tar jxf / samba/Cluster-Resource-Agents-5ae70412eec8.tar.bz2-C. /

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9] # cd / usr/local/src/Cluster-Resource-Agents-5ae70412eec8/

[root@node1Cluster-Resource-Agents-5ae70412eec8] #. / autogen.sh

[root@node1Cluster-Resource-Agents-5ae70412eec8] #. / configure-prefix=/usr/local/ha/

[root@node1Cluster-Resource-Agents-5ae70412eec8] # make

[root@node1Cluster-Resource-Agents-5ae70412eec8] # make install

[root@node1Cluster-Resource-Agents-5ae70412eec8] # cd..

[root@node1src] # tar jxf / samba/Heartbeat-3-0-STABLE-3.0.4.tar.bz2-C. /

[root@node1src] # cd Heartbeat-3-0-STABLE-3.0.4/

[root@node1Heartbeat-3-0-STABLE-3.0.4] #. / bootstrap

[root@node1Heartbeat-3-0-STABLE-3.0.4] #. / configure-- prefix=/usr/local/ha/

[root@node1Heartbeat-3-0-STABLE-3.0.4] # gmake

[root@node1Heartbeat-3-0-STABLE-3.0.4] # make install

[root@node1Heartbeat-3-0-STABLE-3.0.4] # chkconfig-- add heartbeat

[root@node1Heartbeat-3-0-STABLE-3.0.4] # cp / usr/local/ha/share/doc/heartbeat/haresources / usr/local/ha/etc/ha.d/

[root@node1Heartbeat-3-0-STABLE-3.0.4] # cp / usr/local/ha/share/doc/heartbeat/authkeys / usr/local/ha/etc/ha.d/

[root@node1Heartbeat-3-0-STABLE-3.0.4] # cp / usr/local/ha/share/doc/heartbeat/ha.cf / usr/local/ha/etc/ha.d/

[root@node1Heartbeat-3-0-STABLE-3.0.4] # chmod 600 / usr/local/ha/etc/ha.d/authkeys

[root@node1Heartbeat-3-0-STABLE-3.0.4] # cd / usr/local/ha/etc/ha.d/

[root@node1ha.d] # vi authkeys / / I chose the first authentication mode

[root@node1ha.d] # vi ha.cf

# get rid of it and explain it with *

Debugfile / var/log/ha-debug / / debug message storage path

Logfile / var/log/ha-log / / heartbeat log storage path

Keepalive 2 / / specifies that the heartbeat interval is 2 seconds

Deadtime 30 / / designated Endeavour borrower will take over the service resources of the master node immediately after it does not receive the heartbeat signal of the master node within 30 seconds.

Warntime 10 / / specifies a heartbeat delay time of 10 seconds. When the backup node cannot receive the heartbeat signal of the primary node within 10 seconds, a warning message will be written to the log, but the service will not be switched at this time.

Initdead 120 / / on some configurations, it takes some time for the network to work properly after the system is started or rebooted. This option is used to solve the time interval caused by this situation, which is at least twice the value of deadtime.

Udp port 694 / / sets the port used for broadcast communication. Default is 694.

Baud 19200 / / set the baud rate for serial communication

Bcast eth2 / / indicates the use of Ethernet broadcasting on the eth2 interface

Auto_failback on / / is used to define whether the service will be automatically switched back when the primary node is restored. The two hosts of heartbeat are the primary node and the backup node respectively. Under normal circumstances, the primary node occupies resources and runs all the services. in case of failure, the resources are handed over to the backup node and the service is run by the backup node. If this option is set to on, once the primary node resumes operation, it automatically acquires resources and replaces the backup node. If this option is set to off, then when the primary node is restored, it will become the backup node, and the original backup node will become the primary node.

Node node1 / / Host node hostname

Node node2 / / standby node hostname

Ping 192.168.1.1 / choose the node of ping. The better the ping node is selected, the stronger the HA cluster will be.

Ping_group group1 192.168.1.100 192.168.1.150 / / similar to ping

Apiauthpingdgid=haclientuid=hacluster

[root@node1ha.d] # vi haresources

Node1 IPaddr::192.168.1.185 httpd / / node1 host name of the host node. IPaddr is an execution script that comes with heartbeat. 192.168.1.185 is the address of VIP. Httpd means to start the httpd service.

After node1 has finished, continue to do node2. The configuration is the same, so I will not repeat it. After installation and configuration, ifconfig on node1 to see if there is a VIP address.

Both node1 and node2 have been configured with apache services. Now you can access the apache website on node1 by using the VIP address. If node1 goes down, node2 will replace it at the specified time. At that time, you will visit the apache website on node2.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report