margaretmm / myblog

my tech blog
0 stars 1 forks source link

grafana+influxdb 显示的时间不对,要做一下NTP #5

Open margaretmm opened 6 years ago

margaretmm commented 6 years ago

删除本地时间并设置时区为上海: rm -rf /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

yum install ntpdate -y 2、手工同步网络时间,执行以下命令,将从time.nist.gov同步时间

ntpdate 0.asia.pool.ntp.org

3、使用crontab计划任务定时更新网络时间,修改crontab文件,在末尾增加 /1 * ntpdate 0.asia.pool.ntp.org,每隔1小时同步一次时间。

vi /etc/crontab

5、系统时间同步到硬件,防止系统重启后时间呗还原

hwclock --systohc