Linux NTP service configuration for Oracle RAC tutorial, ntprac
When installing Oracle 11g RAC, We need to configure the ntp service. There are many ways to configure the clock synchronization mode when using virtual machines. You can use the clock synchronization feature provided by vmware or directly use a local node as the time server. This article describes how to directly configure the ntp clock server.
1. view the hosts configuration of two nodes
[Root @ node1 ~] # Cat/etc/hosts
# Do not remove the following line, or various programs
# That require network functionality will fail.
#127.0.0.1 localhost. localdomain localhost
#: 1 localhost6.localdomain6 localhost6
127.0.0.1 localhost.szdb.com localhost
# Public eth0
192.168.7.71 node1.szdb.com node1
192.168.7.72 node2.szdb.com node2
# Private eth1
10.10.7.71 node1-priv.szdb.com node1-priv
10.10.7.72 node2-priv.szdb.com node2-priv
# Virtual
192.168.7.81 node1-vip.szdb.com node1-vip
192.168.7.82 node2-vip.szdb.com node2-vip
2. confirm that the ntp package of each node has been installed.
[Oracle @ node1 ~] $ Rpm-qa | grep ntp
Ntp-4.2.2p1-9.el5_4.1
Chkfontpath-1.10.1-1.1 # This is related to the font, not the ntp package
[Oracle @ node1 ~] $ Ssh node 2 rpm-qa | grep ntp
Ntp-4.2.2p1-9.el5_4.1
Chkfontpath-1.10.1-1.1 # This is related to the font, not the ntp package
3. Edit the ntp. conf file of the two nodes.
[Oracle @ node1 ~] $ Su-root
Password:
[Root @ node1 ~] # Vi/etc/ntp. conf
# New ntp server added by Robinson
Server 127.127.1.0 prefer # Add the preferred clock server
Restrict 192.168.7.0 mask bandwidth 255.255.255.255 nomodify notrap # Only allow clients in the 192.168.7. * network segment to synchronize time
Broadcastdelay 0.008
[Root @ node2 ~] # Vi/etc/ntp. conf
# New ntp server added by Robinson
Server 192.168.7.71 prefer
Broadcastdelay 0.008
4. Edit the ntpd parameters of two nodes
[Root @ node1 ~] # Vi/etc/sysconfig/ntpd
# The following item added by Robinson
# Set to 'yes' to sycn hw clock after successful ntpdate
SYNC_HWCLOCK = yes # This option is used to automatically calibrate the system clock and hardware clock.
OPTIONS = "-x-u ntp: ntp-p/var/run/ntpd. pid"
# Understand the clock types in Linux. Linux systems include system clock and hardware clock.
# System clock refers to the clock in the current Linux kernel, while the hardware clock refers to the BIOS clock, which is powered by the motherboard battery.
# When Linux is started, the hardware clock reads the system clock settings, and then the system clock runs independently of the hardware clock.
[Root @ node2 ~] # Vi/etc/sysconfig/ntpd
The following item added by Robinson
SYNC_HWCLOCK = yes
OPTIONS = "-x-u ntp: ntp-p/var/run/ntpd. pid"
5. Configure ntp auto-Start Service
[Root @ node1 ~] # Chkconfig ntpd on
[Root @ node2 ~] # Chkconfig ntpd on
6. Start the ntp service at two nodes
[Root @ node1 ~] # Service ntpd stop
Shutting down ntpd: [FAILED]
[Root @ node1 ~] # Service ntpd start
Ntpd: Synchronizing with time server: [FAILED]
Starting ntpd: [OK]
[Root @ node2 ~] # Service ntpd restart
Shutting down ntpd: [OK]
Ntpd: Synchronizing with time server: [OK]
Syncing hardware clock to system time [OK]
Starting ntpd: [OK]
7. View ntp status
[Root @ node1 ~] # Ntpq-p
Remote refid st t when poll reach delay offset jitter
========================================================== ==============================================
LOCAL (0). LOCL. 10 l 40 64 1 0.000 0.000
[Root @ node2 ~] # Ntpq-p
Remote refid st t when poll reach delay offset jitter
========================================================== ==============================================
Node1.szdb.com. INIT. 16 u 60 64 0 0.000 0.000
LOCAL (0). LOCL. 10 l 59 64 1 0.000 0.000 0.001
# Author: Robinson
# Blog: https://blog.csdn.net/robinson_0612
You can also use watch ntpq-p to view the real-time status.
8. ntp logs
[Root @ bigboy tmp] # cat/var/log/messages | grep ntpd