Linux time synchronization configuration.
I. Using the Ntpdate command
1.1 When the server can link to the extranet
# CRONTAB-E
Add a line:
*/1 * * * * ntpdate 210.72.145.44
210.72.145.44 is the China National Time Service Center server address, so that the machine every 1 minutes can be synchronized with the National Time Service center.
Note: When using the Ntpdate command, the NTPD service must be turned off, otherwise the NTP socket is used, exiting error will be reported.
The Shutdown NTPD Service command is as follows:
[[email protected] init.d]#/etc/init.d/ntpd stop
Shutting down NTPD: [OK]
1.2. Setting up a local time server
You need to modify several configurations in the/etc/ntp.conf file, such as the local time server IP of 172.21.1.30, configured as follows:
Server 210.72.145.44 prefer (China National Service Center servers address prefer priority Note change the default server to this)
Server 127.127.1.0 (local time)
Restrict 10.85.10.0 mask 255.255.255.0 nomodify (allow 10.. 85.10.* IP using this time server)
Restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust (block other IP over update time)
The rest remains the default.
Enables the NTP service to start automatically when the system boots, executing:
# Chkconfig NTPD on
command to start/close/restart NTP:
#/ETC/INIT.D/NTPD Start
#/ETC/INIT.D/NTPD Stop
#/etc/init.d/ntpd Restart
#service ntpd Restart
Write the synchronized time in the CMOS
Vi/etc/sysconfig/ntpd
Sync_hwclock=yes
Each time you modify the configuration file, you need to restart the service for the configuration to take effect.
You can use the following command to check if the NTP service is started and you should be able to get a process ID number:
# pgrep NTPD
Use the following command to check the status of the time server synchronization:
# ntpq-p
With Ntpstat can also see some synchronization status, with Netstat-ntlup view port usage!
It will take 5-10 minutes for the client to update the time from the server side after installation!
Client settings:
# CRONTAB-E
Add a line:
*/1 * * * * * ntpdate 172.21.1.30.
Related Configuration parameter description
# Restrict permissions control syntax is:
# Restrict IP Mask netmask_ip parameter
# where IP can be a software address or default, default is similar to 0.0.0.0!
# As for the paramter, there are:
# Ignore: Turn off all NTP Online Services
# Nomodify: Indicates that the client side cannot change the Server-side time parameter, however,
# Client side can still be on the Server side to network school.
# Notrust: The client source will be treated as untrusted domain unless authenticated
# Noquery: Does not provide client-side time query
# If paramter is not set at all, it means that the IP (or domain) "has no restrictions! 』
# set the upper-level host is mainly set by the server parameter, the syntax is:
# Server [ip| FQDN] [prefer]
# The server is followed by our upper time server! And if the Server parameter
# After adding perfer, it means that our NTP host is mainly used as the host of the
# The correspondence of the time correction. In addition, in order to resolve the delivery delay action of the update Time packet,
Second, the use of Rdate synchronization time
If you are installing RAC with VMware, the time between the points must be the same, with one node as the standard and the other nodes in time synchronization with that node.
If there are two nodes:
a:172.21.1.30
b:172.21.1.31
With a as the time standard, the B node is synchronized with a node time.
1. Open 37 port on a node
The simplest, but also least secure, approach is to turn off the firewall: iptables-f
2. On the A node start time service
#chkconfig time on #在系统引导的时候自动启动
If the service is not started, an error occurs when the other node synchronizes time with the node: Connect refused
Note: To use the root user
3. Synchronize the time between the B node and the A node
Rdate-s 172.21.1.30
Execution plans can be made in crontab, once per minute, so that time is synchronized.
[Email protected] ~]# crontab-l
*/1 * * * * rdate-s 172.21.1.30
Three Using Network time Protocol (NTP) server
1. If there is a time server in the corporate network: 10.85.10.80, you only need to modify the NTP service configuration file on each node, so that each node and time server can synchronize.
# vi/etc/ntp.conf
Server 10.85.10.80 prefer
Driftfile/var/lib/ntp/drift
Broadcastdelay 0.008
After the modification, restart the NTP service
#/etc/init.d/ntpd restart
2. If there is no time service, you can use one of the RAC 2 nodes as the server. Another synchronization with this server.
Join with Node1 server, its IP is: 172.21.1.30, modify the configuration file
#vi/etc/ntp.conf
Server 127.127.1.0--Local clock
Fudge 127.127.1.0 Stratum 11
Broadcastdelay 0.008
Node2 is synchronized with Node1. Modify the NTP configuration file for Node2
# vi/etc/ntp.conf
Server 172.21.1.30 prefer
Driftfile/var/lib/ntp/drift
Broadcastdelay 0.008
After the modification, restart the NTP service
#/etc/init.d/ntpd restart
ORACLE RAC NTP Time server configuration