The deployment theory of NTP server under Linux

Source: Internet
Author: User
Tags current time time zones local time set time linux

On the basis of the Linux system after installation--based on CentOS (5.8/6.4)--we mentioned how to automatically update the server time at timed intervals. Also mentioned, when the number of intranet machines, if all go to the public network NTP server synchronization time is there will be delay. Of course, this is not just the only meaning of deploying an NTP server.

With the network scale and network application expanding, the number of network devices and servers is increasing. Operators in view of the numerous server logs, often found that the time is different, even if the manual set time, but also due to time zones or daylight savings, and other factors caused by the timing error; for the production environment where the cluster is deployed, they need to work together, so the accurate reliability of time is particularly important.

The configuration and use of NTP services is simple, and the network resources used are very small. NTP time server is widely used in network security, online teaching, database backup and other fields. It is important for organizations to take the time to synchronize network devices and servers, and to ensure that the logs generated by the server provide accurate time positioning and should be paid attention to. This series will guide you through the knowledge of NTP and how to deploy a simple architecture to achieve load balancing and highly available NTP servers in an enterprise production environment. Hope to be able to study and operation of the work of the dimensional help!

This article will lead you to understand the concept of time and some common sense of NTP.

One, time and timezone

The Earth rotates from the west to the east, the east to the west, and the east to the west. The difference between the eastern and Western moments is not only measured in terms of time, but also in minutes and seconds, causing inconvenience to people. Therefore, in order to overcome the time confusion, at an international Longitude conference in Washington in 1884, the world was zoned for 24 time zones (12 time zones East and west), with GMT (GMT) as 0 time zone. But China's capital Beijing is East 8 District, and our country also will this time as the national unification time, namely Beijing time. So, there is the standard of time that we call daily. We can understand that time is based on the definition given by the time zone.

What we often see in computers, however, is (utc+08:00). UTC is the abbreviation for the English Coordinated Universal Time, translated to coordinate the world. and utc+08:00 on behalf of Beijing for the East 8 district. It is therefore conceivable that UTC +00:00 is GMT.

Why are you mentioning this?

First, no matter which channel we use to update the system time, usually the public NTP server gives us the time value of UTC +00:00 Instead of the time value of our current time zone, because it doesn't know we're there, so it's important to choose the time zone when we're installing the system.

Second, China has daylight saving time, perhaps one day will dial 1 hours, let you from East 8 to East 9 area. Of course, the time will be again to dial slowly back. At this point, if we set the right time zone, the system will automatically adjust for us when we need to change the time.

Second, the time zone of Linux

When installing Linux, one step is to let you choose the time zone, remember. So what if we want to change the time zone, or if the setup is wrong? Do not worry! Because under Linux glibc has provided us with a lot of compiled timezone files, and stored them in the/usr/share/zoneinfo directory, which basically covers most of the country and cities.

[ROOT@C64NTP ~]# ls/usr/share/zoneinfo/
Africa      Canada   GB         Indian     Mexico    ROC        Zulu
America     Chile    gb-eire    Iran       Mideast   ROK  iso3166.tab Antarctica Cuba     GMT        Israel     NZ        Singapore  POSIX
Arctic      EET      gmt+0   Jamaica Nz-chat Turkey     Posixrules
Asia        EST      GMT-0      Japan      Navajo    UCT        right
Atlantic    Est5edt  GMT0       Kwajalein  PRC       US         zone.tab
Australia   Egypt    Greenwich      Libya PST8PDT   UTC
Brazil      Eire     HST        MET        Pacific   Universal
CET         ETC      Hongkong   MST        Poland    w-su
cst6cdt     Europe   Iceland  mst7mdt Portugal WET

When we want to view the time of a particular time zone, we can use the Zdump command

[Root@c64-client ~]# zdump Cuba
Sat Nov  2 08:42:13 CDT 2013    #古巴的时间已经出来了

But what happens when we want to change the time zone?

1. Modify/etc/localtime File

The/etc/localtime file defines the local time zone we are in, and we can change the time zone by copying the time zone file we need from/usr/share/zoneinfo/to replace/etc/localtime for example, Here we change the time zone to Cuba's time zone

[Root@c64-client ~]#/bin/cp/usr/share/zoneinfo/cuba/etc/localtime
[root@c64-client ~]# date
Sat Nov  2 08:44:49 CDT 2013           #时区已经更改为了Cuba时区

Of course, we can also use the soft connection method for time zone replacement, this time we replace the Canada time zone

[Root@c64-client ~]# ln-sf/usr/share/zoneinfo/canada/etc/localtime
[root@c64-client ~]# date
Sat Nov  2 12:46:54 UTC 2013    #这样刚才Cuba的时区就又变成了Canada的时区了.

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.