tencent cloud

Cloud Virtual Machine

Release Notes and Announcements
Release Notes
Public Image Release Notes
Official End of Support Plan for the Operating System
Announcements
Product Introduction
CVM Overview
Strengths
Basic Concepts
Regions and Zones
Tutorial
Service Regions and Service Providers
Billing
Billing Overview
Billing Modes
Billing Items
Billing Mode Conversion Overview
Purchasing Instances
Configuration Adjustment Billing Guide
Overdue Payments
Getting Started
Purchasing a Customized Linux Instance
Purchasing a Customized Windows Instance
User Guide
Operation Guide Overview
Use Limits
Instances
Spot Instances
Reserved Instances
Images
Storage
Backup and Restoration
Network
Security
Passwords/Keys
Monitoring and Alarms
Ops Management
Convenience Features
Migrating a Server
Online Migration
Migration Consultation
Troubleshooting
CVM Login Failures
Windows Instance Login Failures
Linux Instance Login Failures
Other Login Failures
Instance Running Failures
Linux Instance Memory Failures
Network Failures
Use Cases
Suggestions on CVM Model Selection
Environment Building
Website Building
Application Building
Visual GUI Building
Uploading Local Files to CVM
Network Performance Test
Other Practical Tutorials
API Documentation
History
Introduction
API Category
Making API Requests
Region APIs
Instance APIs
Cloud Hosting Cluster APIs
Image APIs
Instance Launch Template APIs
Placement Group APIs
Key APIs
Security Group APIs
Network APIs
Data Types
Error Codes
Security and Compliance
CAM
Network
FAQs
Regions and Zones
Billing
Instances
Storage
Images
Server Migration
Network
Security
Operating Systems
Ops and Monitoring
CAM
NTP Service
Scenarios
Agreements
CVM Service Level Agreements
Red Hat Enterprise Linux Image Service Agreement
Public IP Service Level Agreement
Glossary
DocumentationCloud Virtual MachineUse CasesApplication BuildingNTP ServiceTransitioning from ntpdate to ntpd on a Linux Instance

Transitioning from ntpdate to ntpd on a Linux Instance

PDF
Focus Mode
Font Size
Last updated: 2024-01-06 17:43:10

Overview

The ntpdate is a breakpoint update for the time synchronization of your new instances. The ntpd is a stepwise daemon for the time synchronization of your running instances. This document uses the CentOS 7.5 operating system as an example to introduce how to transition from ntpdate to ntpd on CVMs.

Prerequisites

The NTP service communicates on the port UDP 123. Please make sure that you have opened the port to the Internet before transitioning to the NTP service. If the port has not been opened, please refer to Adding Security Group Rules to open it to the Internet.

Directions

You can choose to transition from ntpdate to ntpd manually or automatically.

Transitioning from ntpdate to ntpd manually

Shutting down ntpdate

1. Run the following command to export the crontab configuration and filter ntpdate.
crontab -l |grep -v ntpupdate > /tmp/cronfile
2. Run the following command to update the ntpdate configuration.
crontab /tmp/cronfile
3. Run the following command to modify the rc.local file.
vim /etc/rc.local
4. Press i to switch to the edit mode and delete the ntpupdate configuration line.
5. Press Esc and enter :wq to save and close the file.

Configuring ntpd

1. Run the following command to open the configuration file of the NTP service.
vi /etc/ntp.conf
2. Press i to switch to the edit mode and locate the server configurations. Change the value of server to the NTP clock source server you want to use (such as time1.tencentyun.com) and delete unwanted values, as shown below:
Server configuration


3. Press Esc and enter :wq to save and close the file.

Transitioning from ntpdate to ntpd automatically

1. Download the ntpd_enable.sh script.
wget https://image-10023284.cos.ap-shanghai.myqcloud.com/ntpd_enable.sh
2. Run the following command to transition from ntpdate to ntpd using the ntpd_enable.sh script.
sh ntpd_enable.sh

Relevant Operations

Checking the status of ntpd

Run the following commands to check the status of ntpd as needed.
Run the following command to check whether the NTP is listening normally on the service port UDP 123.
netstat -nupl
If the following result is returned, the listening is normal.
netstat -nupl


Run the following command to check whether the ntpd status is normal.
service ntpd status
If the following result is returned, the ntpd status is normal.
ntpd status


Run the following command to get more detailed NTP service information.
ntpq -p
The following result will be returned:


*: the NTP server in use currently.
remote: the name of the NTP server that responds to this request.
refid: the NTP server one stratum above to which the NTP server on this stratum is synchronized.
st: the stratum of the remote server. The stratum of a server can be set to 1 through 16 from high to low. In order to relieve the load and network congestion, you should avoid connecting directly to a stratum 1 server.
when: the number of seconds that have elapsed since the last successful request.
poll: the synchronization interval (in seconds) between the local and remote servers. At the beginning, the poll value will be smaller, which indicates a higher synchronization frequency, so that the time can be adjusted to the correct time range as soon as possible. Later, the poll value will gradually increase, and the synchronization frequency will decrease accordingly.
reach: an octal value used to test whether the server can be connected. Its value increases every time the server is successfully connected.
delay: the round trip time of sending the synchronization request from the local machine to the NTP server.
offset: the time difference in milliseconds (ms) between the host and the time source through NTP. The closer the offset is to 0, the closer the times of the host and the NTP server are.
jitter: a value used for statistics that records the distribution of offsets over a particular number of consecutive connections. The smaller its absolute value is, the more accurate the host time is.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback