Configure the NTP server and Heartbeat V1 for httpd High Availability

Source: Internet
Author: User

Configure the NTP server and Heartbeat V1 for httpd High Availability

Establishment and use of NTP servers

In high-availability clusters, the time requirements for each node are strict. Therefore, we need to configure an NTP server to implement the time synchronization of highly available clusters. Point other node time to this ntp and create an NTP server first.

[Root @ localhost ~ ] # Rpm-q ntp
Ntp-4.2.6p5-1.el6.CentOS.x86_64

Since our server already has an ntp server, we can use it directly here.

[Root @ localhost ~ ] # Rpm-ql ntp
/Etc/ntp. conf // configuration file
/Etc/ntp/crypto
/Etc/ntp/crypto/pw
/Etc/rc. d/init. d/ntpd // script program

# Vim/etc/ntp. conf
1 # For more information about this file, see the man pages
2 # ntp. conf (5), ntp_acc (5), ntp_auth (5), ntp_clock (5), ntp_misc (5), ntp_mon (5 ).
3
4 driftfile/var/lib/ntp/drift
5
6 # Permit time synchronization with our time source, but do not
7 # permit the source to query or modify the service on this system.
8 restrict default kod nomodify notrap nopeer noquery
9 restrict-6 default kod nomodify notrap nopeer noquery
10
11 # Permit all access over the loopback interface. This cocould
12 # be tightened as well, but to do so wocould effect some
13 # the administrative functions.
14 restrict 127.0.0.1
15 restrict-6: 1
16
17 # Hosts on local network are less restricted.
18 restrict 192.168.1.0 mask limit 255.0 nomodify notrap // allow synchronization time of other hosts
19
20 # Use public servers from the pool.ntp.org project.
21 # Please consider joining the pool (http://www.pool.ntp.org/join.html ).
22 # server 0.centos.pool.ntp.org iburst (default time server)
23 # server 1.centos.pool.ntp.org iburst (default time server)
24 # server 2.centos.pool.ntp.org iburst (default time server)
25 # server 3.centos.pool.ntp.org iburst (default time server)
26 server 172.16.0.1 (Added by yourself)
27 # broadcast 192.168.1.255 autokey # broadcast server
27 # broadcast 192.168.1.255 autokey # broadcast server
28 # broadcastclient # broadcast client
29 # broadcast 224.0.1.1 autokey # multicast server
30 # multicastclient 224.0.1.1 # multicast client
31 # manycastserver 239.424254.254 # manycast server
32 # manycastclient 239.415254.254 autokey # manycast client
33 restrict172.16.0.1 nomodify notrap noquery // allow the upstream time server to modify the local time
34 server127.127.1.0 # local clock
Fudge 127.127.1.0 stratum 10
# Enable public key cryptography.
35 # crypto
36
37 includefile/etc/ntp/crypto/pw
38
39 # Key file containing the keys and key identifiers used when operating
40 # with encryption Ric key cryptography.
41 keys/etc/ntp/keys
42
43 # Specify the key identifiers which are trusted.
44 # trustedkey 4 8 42
45
46 # Specify the key identifier to use with the ntpdc utility.
47 # requestkey 8
48
49 # Specify the key identifier to use with the ntpq utility.
50 # controlkey 8
51
52 # Enable writing of statistics records.
53 # statistics clockstats cryptostats loopstats peerstats

Similarly, other node servers direct the time to the NTP server:

Restrict 127.0.0.1
Restrict-6: 1
Server 172.16.31.10 // point ntp to the ntp server
Restrict 172.16.31.10 nomodify notrap noquery // allowed correction time
Server 127.127.1.0 # local clock
Fudge 127.127.1.0 stratum 10

# Service ntpd start:

Prepare nodes:

Lab Environment

1. time needs to be synchronized. We recommend that you use the NTP server to synchronize time and create a time synchronization plan.

2. When the root user performs key-based authentication

3. parse the host name corresponding to the IP address in the/etc/hosts file.

Install dependencies and packages:

# Yum-y installnet-snmp-libs libnet PyXML
# Rpm-ivh heartbeat-pils-2.1.4-12.el6.x86_64.rpm
# Rpm-ivhheartbeat-stonith-2.1.4-12.el6.x86_64.rpm
# Rpm-ivhheartbeat-2.1.4-12.el6.x86_64.rpm

After heartbeat is installed, configure the following three files:

1. Configure the master configuration file

# Vim ha. cf
Mcast eth0 229.155.11.24 694 1 0
Auto_failback on
Logfile/var/log/ha-log
# Logfacility local0
Node node2
Node node3
Ping 172.16.0.1

2. Configure the authentication File

Add at last

Au22.
2 sha1 17d1df5da5db

3. Configure the resource file

Add at last

Node2 172.16. 11.13/16/eth0/172.16.255.255 httpd

Copy authkeys, ha. cf, and haresources to another host and place them in the same location.

Ensure that httpd services are not automatically started when started

# Chkconfig httpd off

Start heartbeat and test the result.

NTP servers in Linux

Build an enterprise-level NTP Time Server

Set up an ntp time synchronization server in Linux

Enable NTP time server in CentOS 6.3

Hot Standby for Web Services Based on Heartbeat V1

Heartbeat enables high-availability clusters of Web Services

Heartbeat + LVS + Ldirectord high-availability Load Balancing Solution

DRBD + Heartbeat + NFS High Availability Configuration notes

Heartbeat high availability for MySQL using NFS based on CRM

Heartbeat high-availability httpd simple configuration based on Resources

This article permanently updates the link address:

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.