乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Chronyd同步時(shí)間(Server/Client)配置

       行者花雕 2022-06-24 發(fā)布于北京

      chronyd時(shí)間服務(wù)器,和之前NTP的功能一樣,提供時(shí)間的。

      基礎(chǔ)概念我就不說(shuō)了,不擅長(zhǎng)。chronyd是NTP之后誕生的。

      最近下載了最新的Centos Linux 8.1,發(fā)現(xiàn)里面沒(méi)有ntp服務(wù)了,百度一搜發(fā)現(xiàn)改為了Chronyd,這篇文章就是部署一個(gè)服務(wù)器+客戶(hù)端測(cè)試。

      1、服務(wù)器端

      Centos Linux 8.1 默認(rèn)安裝了chronyd服務(wù)。我們只需要配置即可。

      配置文件配置

      紅色部分是需要服務(wù)器配置的,這是基本配置,主要在于實(shí)現(xiàn)基本功能。

      vim /etc/chrony.conf

      # Use public servers from the pool. project.
      # Please consider joining the pool (http://www.pool./join.html).
      # pool 2.centos.pool. iburst
      # 同步哪臺(tái)服務(wù)器上的時(shí)間
      server 192.168.94.133 iburst
      # Record the rate at which the system clock gains/losses time.
      driftfile /var/lib/chrony/drift
      
      # Allow the system clock to be stepped in the first three updates
      # if its offset is larger than 1 second.
      makestep 1.0 3
      
      # Enable kernel synchronization of the real-time clock (RTC).
      rtcsync
      
      # Allow NTP client access from local network.
      # allow 192.168.0.0/16
      # 允許哪個(gè)網(wǎng)段的客戶(hù)端同步時(shí)間,133這臺(tái)是服務(wù)器。
      allow 192.168.94.0/24
      
      # Serve time even if not synchronized to a time source.
      # 字面翻譯,提供時(shí)間即使沒(méi)有同步一個(gè)時(shí)間源。
      local stratum 10
      # Specify file containing keys for NTP authentication.
      keyfile /etc/chrony.keys
      
      # Get TAI-UTC offset and leap seconds from the system tz database.
      leapsectz right/UTC

      啟動(dòng)chronyd,并設(shè)置開(kāi)機(jī)自啟

      [root@filesystem ~]# systemctl start chronyd
      [root@filesystem ~]# systemctl enable chronyd

      查看時(shí)間同步情況,本地能夠同步才能夠讓其他節(jié)點(diǎn)進(jìn)行同步

      timedatectl是一個(gè)時(shí)間配置工具,用于設(shè)定時(shí)間、與時(shí)間相關(guān)的配置等。

      [root@filesystem ~]# timedatectl
                     Local time: 五 2020-05-29 11:17:46 EDT
                 Universal time: 五 2020-05-29 15:17:46 UTC
                       RTC time: 五 2020-05-29 15:17:46
                      Time zone: America/New_York (EDT, -0400)
      # 當(dāng)此值為yes代表同步成功,如果為no就代表未同步,或同步失敗。
      System clock synchronized: yes
                    NTP service: active
                RTC in local TZ: no
      [root@filesystem ~]#

      查看當(dāng)前時(shí)間是從哪里同步過(guò)來(lái)的,這里顯示的是主機(jī)名。不影響。

      [root@filesystem ~]# chronyc sources
      210 Number of sources = 1
      MS Name/IP address         Stratum Poll Reach LastRx Last sample
      ===============================================================================
      ^* filesystem                   10   7   377   537    +11us[  +25us] +/-   30us
      [root@filesystem ~]#
      

      防火墻配置

      防火墻要能放行此服務(wù),關(guān)閉防火墻或是放行相應(yīng)的端口及服務(wù)。

      關(guān)閉防火墻,并設(shè)置開(kāi)機(jī)不啟動(dòng)

      [root@filesystem ~]# systemctl stop firewalld
      [root@filesystem ~]# systemctl disable firewalld
      Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
      Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
      [root@filesystem ~]#
      

      設(shè)置防火墻放行規(guī)則

      [root@filesystem ~]# netstat -antup | grep chrony
      udp        0      0 127.0.0.1:323           0.0.0.0:*                           35191/chronyd
      udp        0      0 0.0.0.0:123             0.0.0.0:*                           35191/chronyd
      udp6       0      0 ::1:323                 :::*                                35191/chronyd
      [root@filesystem ~]#
      # 只有upd 123端口
      [root@filesystem ~]# firewall-cmd --permanent --add-port=123/udp
      success
      [root@filesystem ~]# firewall-cmd --reload
      success
      [root@filesystem ~]#

      2、客戶(hù)端配置

      配置文件配置

      vim /etc/chrony.conf

      # Use public servers from the pool. project.
      # Please consider joining the pool (http://www.pool./join.html).
      # pool 2.centos.pool. iburst
      server 192.168.94.133 iburst
      

      配置開(kāi)機(jī)自啟

      [root@node1 ~]# systemctl restart chronyd
      [root@node1 ~]# systemctl enable chronyd
      [root@node1 ~]#
      

      查看同步狀態(tài)及信息

      [root@node1 ~]# timedatectl
                     Local time: 五 2020-05-29 11:28:12 EDT
                 Universal time: 五 2020-05-29 15:28:12 UTC
                       RTC time: 五 2020-05-29 15:28:12
                      Time zone: America/New_York (EDT, -0400)
      System clock synchronized: yes
                    NTP service: active
                RTC in local TZ: no
      [root@node1 ~]# chronyc sources
      210 Number of sources = 1
      MS Name/IP address         Stratum Poll Reach LastRx Last sample
      ===============================================================================
      ^* filesystem                   11   6    17    34   -520ns[+7955ns] +/-   15ms
      [root@node1 ~]#

      我們看到是yes,但是如何判斷它是原來(lái)的時(shí)間還是同步好了。畢竟很多系統(tǒng)不同步時(shí)間也是近似的。

      3、設(shè)置時(shí)間

      我們對(duì)chronyd服務(wù)器端進(jìn)行時(shí)間修改。

      這里說(shuō)明一點(diǎn),時(shí)間的修改只能在時(shí)間不進(jìn)行同步的狀態(tài)下進(jìn)行,也就是說(shuō),如果時(shí)間是同步中的,是不允許修改時(shí)間的。對(duì)時(shí)間進(jìn)行保護(hù)。

      [root@filesystem ~]# timedatectl
                     Local time: 五 2020-05-29 11:30:40 EDT
                 Universal time: 五 2020-05-29 15:30:40 UTC
                       RTC time: 五 2020-05-29 15:30:40
                      Time zone: America/New_York (EDT, -0400)
      System clock synchronized: yes
                    NTP service: active
                RTC in local TZ: no
      [root@filesystem ~]#

      我們測(cè)試效果,關(guān)掉ntp,修改時(shí)間

      timedatectl set-ntp 0

      [root@filesystem ~]# timedatectl set-ntp 0
      [root@filesystem ~]# timedatectl set-time "2020-06-01 01:01:01"
      [root@filesystem ~]# timedatectl set-ntp 1
      [root@filesystem ~]# systemctl restart chronyd
      [root@filesystem ~]# timedatectl
                     Local time: 一 2020-06-01 01:01:20 EDT
                 Universal time: 一 2020-06-01 05:01:20 UTC
                       RTC time: 一 2020-06-01 05:01:20
                      Time zone: America/New_York (EDT, -0400)
      System clock synchronized: yes
                    NTP service: active
                RTC in local TZ: no
      [root@filesystem ~]#

      客戶(hù)端查看時(shí)間

      [root@node1 ~]# systemctl restart chronyd
      [root@node1 ~]#
      [root@node1 ~]# timedatectl
                     Local time: 一 2020-06-01 01:01:55 EDT
                 Universal time: 一 2020-06-01 05:01:55 UTC
                       RTC time: 五 2020-05-29 15:46:52
                      Time zone: America/New_York (EDT, -0400)
      System clock synchronized: yes
                    NTP service: active
                RTC in local TZ: no
      [root@node1 ~]#
      

      客戶(hù)端不重啟服務(wù)也是能同步的,如果你下去做實(shí)驗(yàn)的話(huà),可以測(cè)試下。


      讀書(shū)和健身總有一個(gè)在路上

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀(guān)點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶(hù) 評(píng)論公約

        類(lèi)似文章 更多