लिनक्स में क्रोन को कैसे स्थापित करें और उपयोग करें


Chrony नेटवर्क टाइम प्रोटोकॉल (NTP) का एक लचीला कार्यान्वयन है। इसका उपयोग विभिन्न एनटीपी सर्वर, संदर्भ घड़ियों या मैनुअल इनपुट के माध्यम से सिस्टम घड़ी को सिंक्रनाइज़ करने के लिए किया जाता है।

यह उसी नेटवर्क में अन्य सर्वरों को समय सेवा प्रदान करने के लिए NTPv4 सर्वर का भी उपयोग किया जा सकता है। यह विभिन्न परिस्थितियों जैसे आंतरायिक नेटवर्क कनेक्शन, भारी लोड वाले नेटवर्क, बदलते तापमान जो सामान्य कंप्यूटर की घड़ी को प्रभावित कर सकता है, के तहत निर्दोष रूप से संचालित करने के लिए है।

Chrony दो कार्यक्रमों के साथ आता है:

  • chronyc – command line interface for chrony
  • chronyd – daemon that can be started at boot time

इस ट्यूटोरियल में हम आपको दिखाने जा रहे हैं कि अपने लिनक्स सिस्टम पर Chrony कैसे इंस्टॉल करें और उपयोग करें।

लिनक्स में Chrony स्थापित करें

कुछ प्रणालियों पर, डिफ़ॉल्ट रूप से chrony स्थापित किया जा सकता है। फिर भी यदि पैकेज गायब है, तो आप इसे आसानी से स्थापित कर सकते हैं। निम्नलिखित कमांड का उपयोग करके अपने संबंधित लिनक्स वितरण पर अपने डिफ़ॉल्ट पैकेज मैनेजर टूल का उपयोग करना।

# yum -y install chrony    [On CentOS/RHEL]
# apt install chrony       [On Debian/Ubuntu]
# dnf -y install chrony    [On Fedora 22+]

वर्णक्रम की स्थिति की जांच करने के लिए निम्नलिखित कमांड का उपयोग करें।

# systemctl status chronyd      [On SystemD]
# /etc/init.d/chronyd status    [On Init]

यदि आप बूट पर क्रॉनिक डेमन को सक्षम करना चाहते हैं, तो आप निम्न कमांड का उपयोग कर सकते हैं।

 
# systemctl enable chrony       [On SystemD]
# chkconfig --add chronyd       [On Init]

लिनक्स में क्रॉनिक सिंक्रोनाइज़ेशन की जाँच करें

यह जांचने के लिए कि क्या क्रॉनिक वास्तव में सिंक्रनाइज़ है, हम इसका उपयोग कमांड लाइन प्रोग्राम क्रोनसाइक करेंगे, जिसमें ट्रैकिंग विकल्प है जो प्रासंगिक जानकारी प्रदान करेगा।

# chronyc tracking

सूचीबद्ध फाइलें निम्नलिखित जानकारी प्रदान करती हैं:

  • Reference ID – the reference ID and name to which the computer is currently synced.
  • Stratum – number of hops to a computer with an attached reference clock.
  • Ref time – this is the UTC time at which the last measurement from the reference source was made.
  • System time – delay of system clock from synchronized server.
  • Last offset – estimated offset of the last clock update.
  • RMS offset – long term average of the offset value.
  • Frequency – this is the rate by which the system’s clock would be wrong if chronyd is not correcting it. It is provided in ppm (parts per million).
  • Residual freq – residual frequency indicated the difference between the measurements from reference source and the frequency currently being used.
  • Skew – estimated error bound of the frequency.
  • Root delay – total of the network path delays to the stratum computer, from which the computer is being synced.
  • Leap status – this is the leap status which can have one of the following values – normal, insert second, delete second or not synchronized.

क्रोनी के स्रोतों के बारे में जानकारी की जांच करने के लिए, आप निम्नलिखित आदेश जारी कर सकते हैं।

# chronyc sources

Linux में Chrony को कॉन्फ़िगर करें

क्रॉनी की कॉन्फ़िगरेशन फ़ाइल /etc/chrony.conf या /etc/chrony/chrony.conf पर स्थित है और नमूना कॉन्फ़िगरेशन फ़ाइल कुछ इस तरह दिख सकती है:

server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst

stratumweight 0
driftfile /var/lib/chrony/drift
makestep 10 3
logdir /var/log/chrony

उपरोक्त कॉन्फ़िगरेशन निम्नलिखित जानकारी प्रदान करता है:

  • server – this directive used to describe a NTP server to sync from.
  • stratumweight – how much distance should be added per stratum to the sync source. The default value is 0.0001.
  • driftfile – location and name of the file containing drift data.
  • Makestep – this directive causes chrony to gradually correct any time offset by speeding or slowing down the clock as required.
  • logdir – path to chrony’s log file.

यदि आप सिस्टम क्लॉक को तुरंत स्थानांतरित करना चाहते हैं और वर्तमान में चल रहे किसी भी समायोजन को अनदेखा कर रहे हैं, तो आप निम्न कमांड का उपयोग कर सकते हैं:

# chronyc makestep

यदि आप chrony को रोकने का निर्णय लेते हैं, तो आप निम्न आदेशों का उपयोग कर सकते हैं।

# systemctl stop chrony          [On SystemD]
# /etc/init.d/chronyd stop       [On Init]

यह क्रोनी उपयोगिता की एक शो प्रस्तुति थी और इसे आपके लिनक्स सिस्टम पर कैसे उपयोग किया जा सकता है। यदि आप chrony के बारे में अधिक जानकारी की जांच करना चाहते हैं, तो chrony प्रलेखन की समीक्षा करें।