インターネットに接続されている場合、インターネットで提供されている時計サーバーと同期します。
同期コマンド:ntpdate ntp4.aliyun.com(Alibaba Cloudが提供する空き時間サーバー)
オフライン状態でのクロック同期を構成する
1.クロック同期サーバーの時間を設定します(node03 2012-12-12 12:12:12)
node01とnode02の時間をnode03と同期します。
2.最初の構成ファイル/etc/ntp.confを変更します
次のコンテンツを追加
restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap server 127.127.1.0#localclock fudge 127.127.1.0 stratum 10
将来のサーバーに注釈を付ける
#server 0.centos.pool.ntp.org iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.orgイバースト
3. 2番目の構成ファイルvi / etc / sysconfig / ntpdを変更します。
次のコンテンツを追加
SYNC_HWLOCK =はい
4. ntpサービスを再起動します
/etc/init.d/ntpd restart
5.クロック同期
node01 node02で同期
コマンドntpdate node03(時計サーバー)
ntpdate 192.168.100.133(時計サーバー)