Three common methods for Oracle RAC Time synchronization are Network Time Protocol (NTP), rdate, and ntpdate. Let's take a look.
1. Use the ntpdate command
1. When the server can be connected to the Internet
# Crontab-e
Add a row:
*/1 ***** ntpdate 210.72.145.44
210.72.145.44 is the address of the Chinese National Time Service Center server, so that the server can be synchronized with the National Time Service Center at every 1 minute.
Note: when using the ntpdate command, the ntpd service must be disabled. Otherwise, the NTP socket is in use and the exiting error will be reported.
The command to disable the ntpd service is as follows:
[Root @ node2 init. d] #/etc/init. d/ntpd stop
Shutting down ntpd: [OK]
2. Set up a local time server
You need to modify several configurations in the/etc/ntp. conf file. For example, if the IP address of the local server is 10.85.10.119, the configuration is as follows:
Server 210.72.145.44 prefer)
Server 127.127.1.0 (local time)
Restrict 10.85.10.0 mask limit 255.0 nomodify (allow 10 .. 85. 10. * IP addresses to use this time server)
Restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust (shields other IP addresses from updating the time)
Others remain unchanged by default.
Enable the NTP service to automatically start during system boot and run:
# Chkconfig ntpd on
Run the following command to start/disable/restart NTP:
#/Etc/init. d/ntpd start
#/Etc/init. d/ntpd stop
#/Etc/init. d/ntpd restart
# Service ntpd restart
Write the synchronized time to CMOS.
Vi/etc/sysconfig/ntpd
SYNC_HWCLOCK = yes
After you modify the configuration file, restart the service to make the configuration take effect.
You can run the following command to check whether the NTP service is started. You should be able to get a process ID:
# Pgrep ntpd
Run the following command to check the synchronization status of the Time Server:
# Ntpq-p
You can also use ntpstat to view some synchronization statuses. Use netstat-ntlup to view port usage!
It takes 5 to 10 minutes to update the client from the server after the client is installed!
Client settings:
# Crontab-e
Add a row:
*/1 ***** ntpdate 10.85.10.119.
Related configuration parameters
# Restrict permission control Syntax:
# Restrict IP mask netmask_IP parameter
# The IP address can be the software address or the default address, which is similar to 0.0.0.0!
# Paramter:
# Ignore: Disable all NTP online services
# Nomodify: indicates that the Client cannot change the time parameter of the Server. However,
# The Client can still perform network calibration through the Server.
# Notrust: unless the Client passes authentication, the Client source will be considered as a untrusted domain.
# Noquery: does not provide Client-side time query
# If paramter is not set at all, it indicates that the IP address (or domain) "has no restrictions !』
# Set the upper-layer host to the server parameter. Syntax:
# Server [IP | FQDN] [prefer]
# What follows the Server is our upper-layer Time Server ?? 《? Parameter Server
# If perfer is added later, it means that our NTP host mainly uses this host
# Time correction. In addition, to solve the transmission delay action of the update time packet,
Ii. Use rdate for synchronization
If you want to use vmware to install RAC, the time for each node must be the same. You can use one node as the standard and synchronize the time between other nodes and the node.
Assume there are two nodes:
A: 10.85.10.119
B: 10.85.10.121
With node A as the time standard, Node B Synchronizes time with node.
1. Open Port 37 on node
The simplest but safest way is to disable the firewall: iptables-F
2. Start the time service on node
# Chkconfig time on # automatically start during system boot
If the service is not started, an error is returned when the synchronization time between other nodes and the node is: Connect Refused
Note: Use the root user
3. Synchronize time between node B and node
Rdate-s 10.85.10.119
You can execute an execution plan in crontab every minute to ensure time synchronization.
[Root @ node2 ~] # Crontab-l
*/1 ***** rdate-s 10.85.10.119
3. Use the Network Time Protocol (NTP) Server
1. If there is a time server in the company's 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 be synchronized.
# Vi/etc/ntp. conf
Server 10.85.10.80 prefer
Driftfile/var/lib/ntp/drift
Broadcastdelay 0.008
Restart the ntp service after modification.
#/Etc/init. d/ntpd restart
2. If there is no time service, you can use one of the two RAC nodes as the server. The other one can be synchronized with this server.
Add node1 as the server. The IP address is 10.85.10.119. 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
Synchronize Node2 with node1.
Modify the ntp configuration file of node2
# Vi/etc/ntp. conf
Server 10.85.10.119 prefer
Driftfile/var/lib/ntp/drift
Broadcastdelay 0.008
Restart the ntp service after modification.
#/Etc/init. d/ntpd restart
Or in node2, the crontab is used to synchronize time with the server.
*/15 * ntpdate 10.85.10.119
For more information about the Network Time Protocol (NTP) server, rdate synchronization Time, And ntpdate command synchronization Time, we recommend that you use the ntpdate command.