{"id":187144,"date":"2024-11-11T11:49:19","date_gmt":"2024-11-11T03:49:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/187144\/"},"modified":"2024-11-11T11:49:20","modified_gmt":"2024-11-11T03:49:20","slug":"%e6%95%b8%e6%93%9a%e5%ba%ab%e6%99%82%e9%96%93%e5%90%8c%e6%ad%a5%ef%bc%8c%e8%bc%95%e9%ac%86%e6%8e%8c%e6%8f%a1%ef%bc%9a%e4%bd%bf%e7%94%a8ntp%e5%8d%b3%e5%8f%af-%e6%95%b8%e6%93%9a%e5%ba%ab%e6%99%82","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/187144\/","title":{"rendered":"\u6578\u64da\u5eab\u6642\u9593\u540c\u6b65\uff0c\u8f15\u9b06\u638c\u63e1\uff1a\u4f7f\u7528NTP\u5373\u53ef (\u6578\u64da\u5eab\u6642\u9593\u5982\u4f55\u540c\u6b65ntp)"},"content":{"rendered":"<h1 id=\"%e6%95%b8%e6%93%9a%e5%ba%ab%e6%99%82%e9%96%93%e5%90%8c%e6%ad%a5%ef%bc%8c%e8%bc%95%e9%ac%86%e6%8e%8c%e6%8f%a1%ef%bc%9a%e4%bd%bf%e7%94%a8ntp%e5%8d%b3%e5%8f%af-EKzdtoNUkn\">\u6578\u64da\u5eab\u6642\u9593\u540c\u6b65\uff0c\u8f15\u9b06\u638c\u63e1\uff1a\u4f7f\u7528NTP\u5373\u53ef<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u64da\u9a45\u52d5\u4e16\u754c\u4e2d\uff0c\u6578\u64da\u5eab\u7684\u6642\u9593\u540c\u6b65\u8b8a\u5f97\u8d8a\u4f86\u8d8a\u91cd\u8981\u3002\u7121\u8ad6\u662f\u91d1\u878d\u4ea4\u6613\u3001\u96fb\u5b50\u5546\u52d9\u9084\u662f\u5176\u4ed6\u9700\u8981\u7cbe\u78ba\u6642\u9593\u6233\u7684\u61c9\u7528\uff0c\u6642\u9593\u7684\u6e96\u78ba\u6027\u90fd\u76f4\u63a5\u5f71\u97ff\u5230\u6578\u64da\u7684\u5b8c\u6574\u6027\u548c\u53ef\u9760\u6027\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u5982\u4f55\u4f7f\u7528\u7db2\u7d61\u6642\u9593\u5354\u8b70\uff08NTP\uff09\u4f86\u5be6\u73fe\u6578\u64da\u5eab\u7684\u6642\u9593\u540c\u6b65\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u5be6\u7528\u7684\u793a\u4f8b\u548c\u5efa\u8b70\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afntp%ef%bc%9f-EKzdtoNUkn\">\u4ec0\u9ebc\u662fNTP\uff1f<\/h2>\n<p>\u7db2\u7d61\u6642\u9593\u5354\u8b70\uff08NTP\uff09\u662f\u4e00\u7a2e\u7528\u65bc\u540c\u6b65\u8a08\u7b97\u6a5f\u7cfb\u7d71\u6642\u9593\u7684\u5354\u8b70\u3002\u5b83\u53ef\u4ee5\u901a\u904e\u4e92\u806f\u7db2\u6216\u672c\u5730\u7db2\u7d61\u5c07\u8a08\u7b97\u6a5f\u7684\u6642\u9418\u8207\u539f\u5b50\u9418\u6216\u5176\u4ed6\u7cbe\u78ba\u7684\u6642\u9593\u6e90\u9032\u884c\u540c\u6b65\u3002NTP\u7684\u7cbe\u78ba\u5ea6\u53ef\u4ee5\u9054\u5230\u6beb\u79d2\u7d1a\uff0c\u9019\u4f7f\u5f97\u5b83\u6210\u70ba\u6578\u64da\u5eab\u6642\u9593\u540c\u6b65\u7684\u7406\u60f3\u9078\u64c7\u3002<\/p>\n<h2 id=\"%e7%82%ba%e4%bb%80%e9%ba%bc%e9%9c%80%e8%a6%81%e6%99%82%e9%96%93%e5%90%8c%e6%ad%a5%ef%bc%9f-EKzdtoNUkn\">\u70ba\u4ec0\u9ebc\u9700\u8981\u6642\u9593\u540c\u6b65\uff1f<\/h2>\n<p>\u6642\u9593\u540c\u6b65\u5c0d\u65bc\u6578\u64da\u5eab\u7684\u904b\u884c\u81f3\u95dc\u91cd\u8981\uff0c\u539f\u56e0\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u4e00\u81f4\u6027\uff1a<\/strong>\u5728\u5206\u4f48\u5f0f\u7cfb\u7d71\u4e2d\uff0c\u6578\u64da\u7684\u4e00\u81f4\u6027\u4f9d\u8cf4\u65bc\u6642\u9593\u6233\u7684\u6e96\u78ba\u6027\u3002\u5982\u679c\u4e0d\u540c\u7684\u6578\u64da\u5eab\u4f7f\u7528\u4e0d\u540c\u7684\u6642\u9593\u6e90\uff0c\u53ef\u80fd\u6703\u5c0e\u81f4\u6578\u64da\u4e0d\u4e00\u81f4\u3002<\/li>\n<li><strong>\u6545\u969c\u6392\u9664\uff1a<\/strong>\u6e96\u78ba\u7684\u6642\u9593\u6233\u6709\u52a9\u65bc\u8ffd\u8e64\u4e8b\u4ef6\u7684\u767c\u751f\u9806\u5e8f\uff0c\u5f9e\u800c\u66f4\u5bb9\u6613\u8b58\u5225\u548c\u89e3\u6c7a\u554f\u984c\u3002<\/li>\n<li><strong>\u5408\u898f\u6027\uff1a<\/strong>\u67d0\u4e9b\u884c\u696d\uff08\u5982\u91d1\u878d\u548c\u91ab\u7642\uff09\u8981\u6c42\u5c0d\u4ea4\u6613\u548c\u64cd\u4f5c\u9032\u884c\u7cbe\u78ba\u7684\u6642\u9593\u8a18\u9304\uff0c\u4ee5\u6eff\u8db3\u5408\u898f\u8981\u6c42\u3002<\/li>\n<\/ul>\n<h2 id=\"ntp%e7%9a%84%e5%b7%a5%e4%bd%9c%e5%8e%9f%e7%90%86-EKzdtoNUkn\">NTP\u7684\u5de5\u4f5c\u539f\u7406<\/h2>\n<p>NTP\u4f7f\u7528\u4e00\u500b\u5c64\u6b21\u7d50\u69cb\u7684\u6642\u9593\u6e90\uff0c\u7a31\u70ba\u201c\u6642\u9593\u4f3a\u670d\u5668\u201d\u3002\u9019\u4e9b\u4f3a\u670d\u5668\u5206\u70ba\u4e0d\u540c\u7684\u5c64\u7d1a\uff0c\u5c64\u7d1a\u8d8a\u4f4e\uff0c\u6642\u9593\u6e90\u8d8a\u7cbe\u78ba\u3002NTP\u5ba2\u6236\u7aef\u6703\u5b9a\u671f\u5411NTP\u4f3a\u670d\u5668\u8acb\u6c42\u6642\u9593\uff0c\u4e26\u6839\u64da\u4f3a\u670d\u5668\u8fd4\u56de\u7684\u6642\u9593\u4fe1\u606f\u4f86\u8abf\u6574\u81ea\u5df1\u7684\u6642\u9418\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%9c%a8%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e9%85%8d%e7%bd%aentp-EKzdtoNUkn\">\u5982\u4f55\u5728\u6578\u64da\u5eab\u4e2d\u914d\u7f6eNTP<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4f7f\u7528NTP\u540c\u6b65\u6578\u64da\u5eab\u6642\u9593\u7684\u57fa\u672c\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-%e5%ae%89%e8%a3%9dntp%e6%9c%8d%e5%8b%99-EKzdtoNUkn\">1. \u5b89\u88ddNTP\u670d\u52d9<\/h3>\n<p>\u5728\u5927\u591a\u6578Linux\u7cfb\u7d71\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88ddNTP\u670d\u52d9\uff1a<\/p>\n<pre><code>sudo apt-get install ntp<\/code><\/pre>\n<h3 id=\"2-%e9%85%8d%e7%bd%aentp%e4%bc%ba%e6%9c%8d%e5%99%a8-EKzdtoNUkn\">2. \u914d\u7f6eNTP\u4f3a\u670d\u5668<\/h3>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u9700\u8981\u7de8\u8f2fNTP\u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u65bc \/etc\/ntp.conf\u3002\u60a8\u53ef\u4ee5\u6dfb\u52a0\u60a8\u5e0c\u671b\u4f7f\u7528\u7684NTP\u4f3a\u670d\u5668\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code>server 0.hk.pool.ntp.org\nserver 1.hk.pool.ntp.org\nserver 2.hk.pool.ntp.org\nserver 3.hk.pool.ntp.org<\/code><\/pre>\n<h3 id=\"3-%e5%95%9f%e5%8b%95ntp%e6%9c%8d%e5%8b%99-EKzdtoNUkn\">3. \u555f\u52d5NTP\u670d\u52d9<\/h3>\n<p>\u914d\u7f6e\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5NTP\u670d\u52d9\u4ee5\u958b\u59cb\u540c\u6b65\u6642\u9593\uff1a<\/p>\n<pre><code>sudo systemctl start ntp<\/code><\/pre>\n<h3 id=\"4-%e9%a9%97%e8%ad%89%e6%99%82%e9%96%93%e5%90%8c%e6%ad%a5-EKzdtoNUkn\">4. \u9a57\u8b49\u6642\u9593\u540c\u6b65<\/h3>\n<p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5NTP\u7684\u72c0\u614b\uff1a<\/p>\n<pre><code>ntpq -p<\/code><\/pre>\n<p>\u9019\u5c07\u986f\u793a\u7576\u524d\u7684NTP\u4f3a\u670d\u5668\u53ca\u5176\u72c0\u614b\u3002<\/p>\n<h2 id=\"%e5%9c%a8%e6%95%b8%e6%93%9a%e5%ba%ab%e4%b8%ad%e4%bd%bf%e7%94%a8ntp-EKzdtoNUkn\">\u5728\u6578\u64da\u5eab\u4e2d\u4f7f\u7528NTP<\/h2>\n<p>\u4e00\u65e6NTP\u670d\u52d9\u904b\u884c\u6b63\u5e38\uff0c\u6578\u64da\u5eab\u5c07\u81ea\u52d5\u4f7f\u7528\u7cfb\u7d71\u6642\u9593\u3002\u5c0d\u65bc\u4f7f\u7528MySQL\u7684\u7528\u6236\uff0c\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u7576\u524d\u7684\u7cfb\u7d71\u6642\u9593\uff1a<\/p>\n<pre><code>SELECT NOW();<\/code><\/pre>\n<p>\u9019\u5c07\u8fd4\u56de\u7576\u524d\u7684\u6642\u9593\u6233\uff0c\u60a8\u53ef\u4ee5\u6839\u64da\u9700\u8981\u9032\u884c\u9a57\u8b49\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-EKzdtoNUkn\">\u7d50\u8ad6<\/h2>\n<p>\u6578\u64da\u5eab\u7684\u6642\u9593\u540c\u6b65\u662f\u78ba\u4fdd\u6578\u64da\u4e00\u81f4\u6027\u548c\u53ef\u9760\u6027\u7684\u95dc\u9375\u3002\u901a\u904e\u4f7f\u7528NTP\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u5730\u5be6\u73fe\u6642\u9593\u540c\u6b65\uff0c\u5f9e\u800c\u63d0\u9ad8\u7cfb\u7d71\u7684\u6574\u9ad4\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u3002\u7121\u8ad6\u60a8\u662f\u904b\u884c\u4e00\u500b\u5c0f\u578b\u7db2\u7ad9\u9084\u662f\u5927\u578b\u4f01\u696d\u61c9\u7528\uff0c\u6b63\u78ba\u7684\u6642\u9593\u7ba1\u7406\u90fd\u662f\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\u4f86\u7ba1\u7406\u60a8\u7684\u6578\u64da\u5eab\u548c\u6642\u9593\u540c\u6b65\uff0c\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u670d\u52d9\uff0c\u9019\u5c07\u70ba\u60a8\u7684\u696d\u52d9\u63d0\u4f9b\u7a69\u5b9a\u548c\u53ef\u9760\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u638c\u63e1\u6578\u64da\u5eab\u6642\u9593\u540c\u6b65\uff0c\u8f15\u9b06\u4f7f\u7528NTP\u78ba\u4fdd\u6578\u64da\u4e00\u81f4\u6027\u8207\u6e96\u78ba\u6027\uff0c\u63d0\u5347\u7cfb\u7d71\u6548\u80fd\u8207\u53ef\u9760\u6027\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-187144","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=187144"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187144\/revisions"}],"predecessor-version":[{"id":187145,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/187144\/revisions\/187145"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=187144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=187144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=187144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}