(九)、时间同步-ntp 中小型规模网站集群架构:时间同步-ntp
2017-04-10 22:44
513 查看
前言:
时间服务器部署,这样可以防止网络带来的阻塞和延迟导致服务器的时间不一致,时间的不一致容易导致各种错误。假如监控时间报错了,你老大会怎么想部署:
1.安装ntpyum -y install ntp [root@nfs01 ~]# rpm -qa ntpntp-4.2.6p5-10.el6.centos.2.x86_642.配置文件
[root@m01 ~]# grep -Ev "#|^$" /etc/ntp.conf driftfile /var/lib/ntp/drift restrict default nomodify restrict 127.0.0.1 restrict -6 ::1server ntp1.aliyun.com server time.nist.gov includefile /etc/ntp/crypto/pw keys /etc/ntp/keys步骤,此处略low,可以使用直推推送配置文件的方法
sed -i 's#server 3.centos.pool.ntp.org iburst##g' /etc/ntp.confsed -i 's#server 2.centos.pool.ntp.org iburst##g' /etc/ntp.confsed -i 's#server 1.centos.pool.ntp.org iburst##g' /etc/ntp.confsed -i 's#server 0.centos.pool.ntp.org iburst##g' /etc/ntp.confsed -i 's#restrict default kod nomodify notrap nopeer noquery##g'sed -i 's#restrict -6 default kod nomodify notrap nopeer noquery##g'echo -e "server ntp1.aliyun.com\nserver time.nist.gov\nrestrict default nomodify" >> /etc/ntp.conf3.启动并查看
/etc/init.d/ntpd startntpq -p
剧本
---- hosts: 172.16.1.61 tasks: - name: install ntp yum: name: ntp state: installed - name: update cfg shell: sed -i 's#server 3.centos.pool.ntp.org iburst##g' /etc/ntp.conf;sed -i 's#server 2.centos.pool.ntp.org iburst##g' /etc/ntp.conf;sed -i 's#server 1.centos.pool.ntp.org iburst##g' /etc/ntp.conf;sed -i 's#server 0.centos.pool.ntp.org iburst##g' /etc/ntp.conf;sed -i 's#restrict default kod nomodify notrap nopeer noquery##g' /etc/ntp.conf;sed -i 's#restrict -6 default kod nomodify notrap nopeer noquery##g /etc/ntp.conf';echo -e "server ntp1.aliyun.com\nserver time.nist.gov\nrestrict default nomodify" >> /etc/ntp.conf - name: start ntp service: name: ntpd state: started enabled: yes- hosts: aige tasks: - name: cron ntp cron: name: sync time minute: "*/5" job: '/usr/sbin/ntpdate 172.16.1.61 >/dev/null 2>&1'
相关文章推荐
- 中小型规模网站集群架构:zabbix安装
- 中小型规模网站集群架构:MySQL主从复制
- 中小型规模网站集群架构:Rsync错误集
- 集群中Ntp时间同步
- ntp组件安装(集群时间同步)
- 基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库——安装配置NTP服务,保证集群时间保持同步
- LINUX服务器集群时间同步之NTP配置
- Oracle集群(RAC)时间同步(ntp和CTSS)
- ntp配置内网集群时间同步
- 在笔记本上构建NTP,同步集群服务器时间
- NTP配置内网中集群机器的时间同步
- Linux集群 NTP 时间同步
- NTP配置集群时间同步
- hadoop集群 NTP时间同步
- centos7集群中NTP设置时间同步
- LINUX服务器集群时间同步之NTP配置
- Oracle集群(RAC)时间同步(ntp和CTSS)
- ntp 同步系统时间
- Linux时间设置与同步(NTP)
- 为服务器设置ntp时间同步--ntp.api.bz