配置ntpd提供网络授时服务
来源:互联网 发布:养生软件下载 编辑:程序博客网 时间:2024/06/05 23:39
在服务器单机运行的时候,时钟准不准并不是太重要。然而,在服务器间有协作越密切,就越来越显示出时钟的重要性了。举几个简单的例子:
在Linux进行服务器文件备份的时候,备份服务器通过文件修改时间从主服务器上拉取修改的文件列表。这时,两台服务器时间不同步,就会造成列表内容过多,网络带宽浪费。
在做Oracle RAC集群的时候,如果两台服务器时间不同步则会造成主服务器已失效,备份服务器还没到切换的时间。这种时间的断层使得RAC几乎不起作用。
所以,虽然不重要,但是有必要在局域网中设置一台标准的授时服务器。Linux系统中使用ntpd软件包通过ntp协议实现网络授时。
理论描述
ntpdate命令在客户端运行,想服务器段ntpd提交时间校准请求。ntpd通过ntp协议回应客户端的请求。服务器在udp 123端口监听。
操作步骤
安装ntpd并校准服务器时间
[root@localhost ~]#yum install ntpd ntpdate -y[root@localhost ~]#ntpdate 210.72.145.44
配置ntpd
配置服务器文件为/etc/ntp.conf。这里只显示有修改的部分。
[root@localhost ~]#vim /etc/ntpd.confdriftfile /var/lib/ntp/drift# 只允许从时间服务器同步时间,不允许trap,modify等请求restrict default kod nomodify notrap nopeer noqueryrestrict -6 default kod nomodify notrap nopeer noquery##本地允许所有操作restrict 127.0.0.1restrict -6 ::1##本地网络中设置较少限制restrict 10.0.0.0 mask 255.0.0.0 nomodify notraprestrict 192.168.0.0 mask 255.255.0.0 nomodify notraprestrict 172.16.0.0 mask 255.15.0.0 nomodify notrap##上述设置为设置客户端的权限。# Use public servers from the pool.ntp.org project.server 210.72.145.44 perferserver 0.cn.pool.ntp.orgserver 1.cn.pool.ntp.orgserver 2.cn.pool.ntp.orgserver 0.asia.pool.ntp.orgserver 1.asia.pool.ntp.orgserver 2.asia.pool.ntp.orgserver 0.CentOS.pool.ntp.orgserver 1.centos.pool.ntp.orgserver 2.centos.pool.ntp.org##设置本地服务器向那些服务器看齐server 127.127.1.0 # local clock##在时间服务器没网络连接的话,设置本地时钟。fudge 127.127.1.0 stratum 10##设置本地始终的权值
启动ntpd服务
[root@localhost ~]#service ntpd start[root@localhost ~]#chkconfig ntpd on
配置防火墙
添加如下记录到防火墙配置文件,并重启防火墙
[root@localhost ~]#iptables -A INPUT -m state --state NEW -m udp -p udp --dport 123 -j accept'[root@localhost ~]#service iptables restart
查看服务器工作状态
ntpstat用来查看ntp状态,ntpq -p用来输出当前服务器从那些主机同步时间。
客户端配置
客户端使用ntpdate命令从服务器端同步时间。
[root@localhost ~]#ntpdate time.honliv.com
可将上述命令添加到crontab中,记得使用ntpdate的绝对路径。
即可。对于Oracle RAC环境,搭建者往往使用其中一台节点作为ntpd服务器。这点作者不敢苟同。从可靠性上讲,万一有故障的是ntpd这台呢。另一方面,RAC提供数据库服务肯定要和其他服务器联通。既然联通,使用全局ntpd服务器不挺好的。当然,全局没有就不说了。
本文出自 “Elephant” 博客,请务必保留此出处http://zlyang.blog.51cto.com/1196234/1725394
0 0
- 配置ntpd提供网络授时服务
- 配置ntpd时钟同步服务
- 配置NTP服务ntpd/ntp.conf
- Linux(Unix)时钟同步ntpd服务配置方法
- Linux(Unix)时钟同步ntpd服务配置方法
- Linux(Unix)时钟同步ntpd服务配置方法
- Linux(Unix)时钟同步ntpd服务配置方法
- Linux(Unix)时钟同步ntpd服务配置方法
- Linux(Unix)时钟同步ntpd服务配置方法
- Linux(Unix)时钟同步ntpd服务配置方法
- Linux(Unix)时钟同步ntpd服务配置方法
- Linux系统时钟同步服务NTPD配置方法
- SIM800H NTP网络授时
- ntpd时钟同步服务
- NTPD安装与配置
- 网络层提供的服务
- 授时
- 配置NTP服务ntpd/ntp.conf(搭建Hadoop集群可参考)
- 转Centos 使用YUM安装MariaDB
- zabbix_agentd.conf配置文件详解
- Zabbix 插件Grafana-zabbix的安装
- 利用zabbix监控某个目录大小
- word的使用(二)
- 配置ntpd提供网络授时服务
- MySQL移动数据库位置
- Android WebView开发需要注意的地方和优化
- Zabbix邮件报警设置方法
- Android访问网络,使用HttpURLConnection还是HttpClient
- apache mina: IoSession结构剖析
- shell逻辑判断式与表达式
- linux curl模拟登录网页
- Java File.separator 用法