云计算day23

如果服务器时间发生换乱,需要同步时间

date

ntpdate cn.ntp.org.cn

连接外网同步需要时间,可以同步
-bash: ntpdate: 未找到命令
root@dns named# yum search ntpdate
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
============================ N/S matched: ntpdate

ntpdate.x86_64 : Utility to set the date and time via NTP
名称和简介匹配 only,使用"search all"试试。
root@dns named# yum -y install ntpdate.x86_64
服务器集群不能总是使用外网服务器同步时间,需要自己搭建ntp服务,服
务器对外同步时间,但是集群其他服务器与ntp服务器同步时间
步骤
1.准备一台ntp服务器主机
初始化过程在原有基础上关闭NetworkM manager
2.安装服务
root@dns named# yum search ntp
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
============================== N/S matched: ntp

nagios-plugins-ntp.x86_64 : Nagios Plugin - check_ntp
nagios-plugins-ntp-perl.x86_64 : Nagios Plugin -
check_ntp.pl
nodejs-sntp.noarch : SNTP v4 client (RFC4330) for Node.js
ntp.x86_64 : The NTP daemon and utilities
ntp-doc.noarch : NTP documen
....
root@dns named# yum -y install ntp
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile...
3.配置文件
root@dns named# find / -name "ntp*conf"
/etc/ntp.conf
root@dns named# vi /etc/ntp.conf
所选区域说明只允许本机联机访问时间,所以我们需要添加新的网段保存退出
4.启动服务,但是在启动服务之前,可以先保证时间准确
root@dns named# ntpdate cn.ntp.org.cn
24 Jul 00:26:11 ntpdate2996: adjust time server
203.107.6.88 offset 0.008444 sec
root@dns named# date
2024年 07月 24日 星期三 00:26:14 CST
root@dns named#
启动服务
root@dns named# systemctl restart ntpd
root@dns named#
修改声生成错误的时间
root@web \~# date -s "2023-6-9 12:23:34"
2023年 06月 09日 星期五 12:23:34 CST
root@web \~# date
2023年 06月 09日 星期五 12:23:38 CST
root@web \~#
root@web \~# ntpdate 192.168.71.147
24 Jul 00:34:40 ntpdate1920: step time server
192.168.71.147 offset 35467552.048297 sec
root@web \~# date
2024年 07月 24日 星期三 00:34:46 CST
root@web \~#
配置计划任务

相关推荐
AOwhisky7 小时前
学习自测与解析:MySQL第五、六、七期核心知识点详解
运维·数据库·笔记·学习·mysql·云计算
上海达策TECHSONIC10 小时前
零售ERP选型解析:SAP Business One 适配成长型零售企业的核心逻辑
大数据·运维·人工智能·云计算·运维开发·零售
阿里-于怀10 小时前
阿里云 Agent Infra 上长出的约束基建
阿里云·云计算·agent·starops
2601_9618752410 小时前
高考真题电子版|2025高考全科真题分类PDF
金融·pdf·云计算·azure·七牛云存储·交友·高考
Full Stack Developme11 小时前
计算机加密与解密的历史
运维·服务器·网络·云计算
阿里云瑶池数据库11 小时前
阿里云RDS Agent Manager正式上线,为规模化AI Agent而生的企业级数据管理平台
人工智能·阿里云·云计算
测试狗科研平台11 小时前
第一性原理CO2还原反应计算流程和软件推荐
科技·算法·云计算
翼龙云_cloud12 小时前
腾讯云代理商:2026如何使用腾讯云CloudBase AI Builder 搭建个人博客?
人工智能·云计算·腾讯云·ai智能体
翼龙云_cloud12 小时前
阿里云代理商:部署 DeepSeek V4-Flash解析 快速部署与性能优化
运维·阿里云·性能优化·云计算·ai智能体
AOwhisky13 小时前
Redis 学习笔记(第二期):核心数据类型与消息队列实战
运维·数据库·redis·笔记·学习·云计算