Ubuntu集群 配置ntp服务
1、概述
NTP(Network Time Protocol)是用来使计算机时间同步化的一种协议,它可以使计算机对其服务器或时钟源(如石英钟,GPS等等)做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒),且可介由加密确认的方式来防止恶毒的协议攻击。(来自 百度百科)
2、集群状况
现在又4台Ubuntu主机,选择其中一台作为提供ntp服务的主机(server01)。
3、安装ntp服务
在提供ntp服务的主机上安装ntpserver:
apt-get install ntp
4、配置ntp服务参数
# /etc/ntp.conf, configuration for ntpd; see ntp.conf() for help driftfile /var/lib/ntp/ntp.drift # Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/ statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable # Specify one or more NTP servers. # Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on -- (LP: #). See http://www.pool.ntp.org/join.html for
# more information.
#server .ubuntu.pool.ntp.org
#server .ubuntu.pool.ntp.org
#server .ubuntu.pool.ntp.org
#server .ubuntu.pool.ntp.org # Use Ubuntu's ntp server as a fallback.
#server ntp.ubuntu.com
server 127.127.1.0 minpoll maxpoll
fudge 127.127.1.0 stratum # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers. # By default, exchange time with everybody, but don't allow configuration.
restrict - default kod notrap nomodify nopeer noquery
restrict - default kod notrap nomodify nopeer noquery # Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict :: # Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust ...skipping one line # If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255 # If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
5、测试ntp服务
在提供ntp服务的服务器上运行:
ntpdate -q 127.0.0.1
得到结果:
server 127.0.0.1, stratum , offset -0.000018, delay 0.02568
Sep :: ntpdate[]: adjust time server 127.0.0.1 offset -0.000018 sec
说明启动正常。
6、其它主机用它来同步时间
在需要同步时间的主机上执行:
ntpdate server01
见结果如下:
Sep :: ntpdate[]: adjust time server 192.168.1.154 offset 0.497131 sec
server01可以是主机名也可以是ip。
7、设置定时同步时间
使用crontab:
crontab -e
设置一小时校准一次:
* */ * * * /usr/sbin/ntpdate server01
Ubuntu集群 配置ntp服务的更多相关文章
- Linux集群配置ntp时间同步服务
集群中时间不同步有可能会让大数据的应用程序运行混乱,造成不可预知的问题,比如Hbase,当时间差别过大时就会挂掉,所以在大数据集群中,ntp服务,应该作为一种基础的服务,以下在演示在CentOS 7. ...
- Hadoop3集群搭建之——配置ntp服务
上篇: Hadoop3集群搭建之——虚拟机安装 Hadoop3集群搭建之——安装hadoop,配置环境 下篇: Hadoop3集群搭建之——hive安装 Hadoop3集群搭建之——hbase安装及简 ...
- Linux集群配置离线ntp时间同步服务
集群中时间不同步有可能会让大数据的应用程序运行混乱,造成不可预知的问题,比如Hbase.mongodb副本集等,Hbase当时间差别过大时就会挂掉,mongodb如果副本时间过快,会出现时间栈帧溢出提 ...
- 基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库——安装配置NTP服务,保证集群时间保持同步
一.所有节点上使用yum安装配置NTP服务yum install ntp -y 二.选定一台节点作为NTP server, 192.168.58.11修改/etc/ntp.conf vim /etc/ ...
- Ubuntu 14.04中Elasticsearch集群配置
Ubuntu 14.04中Elasticsearch集群配置 前言:本文可用于elasticsearch集群搭建参考.细分为elasticsearch.yml配置和系统配置 达到的目的:各台机器配置成 ...
- SpringCloud学习笔记(四):Eureka服务注册与发现、构建步骤、集群配置、Eureka与Zookeeper的比较
简介 Netflix在设计Eureka时遵守的就是AP原则 拓展: 在分布式数据库中的CAP原理 CAP原则又称CAP定理,指的是在一个分布式系统中,Consistency(一致性). Availab ...
- 配置ntp服务
配置ntp服务(hadoop搭建可参考) 一:修改选定的服务器的本地时间 date -s '2016-10-07 16:29:30' +'%F %T' //需要设置的时间 二:修改后将时间写入到硬件时 ...
- Ubuntu_10.04下Hadoop-0.20.2集群配置手册
Ubuntu_10.04下Hadoop-0.20.2集群配置手册 一.软硬件环境的准备 下面的文章来自hadoopor.com,我先交待一下我自己的环境: 两台机器,每台机器上面两个虚机(vmware ...
- Hadoop集群配置(最全面总结)
Hadoop集群配置(最全面总结) 通常,集群里的一台机器被指定为 NameNode,另一台不同的机器被指定为JobTracker.这些机器是masters.余下的机器即作为DataNode也作为Ta ...
随机推荐
- Spring基础(8) : 延迟加载,Bean的作用域,Bean生命周期
1.延迟加载 <bean id="p" class="com.Person" lazy-init="true"/> @Confi ...
- 使用 SQLServer On Linux 作为开发数据库遇到的编码问题
在维护旧的项目的时候,遇到了使用 varchar 类型存储中文的情况,本地数据库是直接使用来自上古时期的 T-SQL 创建的.为了方便,我就没有安装 Windows 版的 SQLServer,直接用的 ...
- 【Tomcat】tomcat配置文件详解
Tomcat Server的结构图 结构框架,如下 属性表格 元素名 属性 解释 server(它代表整个容器,是Tomcat实例的顶层元素.由org.apache.catalina.Server接口 ...
- 大菲波数(Fibonacci)java大数(hdu1715)
大菲波数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submissio ...
- Textview源码+绘制过程解析
Android控件TextView的实现原理分析 为什么要规定所有与UI相关的操作都必须在主线程中执行呢?我们知道,这些与UI相关的操作都涉及到大量的控件内部状态以及需要访问窗口的绘图表面,也就是说, ...
- 你不知道的JavasScript上篇·第五章·原型·上
1.[[Prototype]] JS中的对象有一个特殊的[[Prototype]]内置属性,其实就是对于其他对象的引用.几乎所有的对象在创建时这个属性都被赋予一个非空的值 (proto) var my ...
- 在Ubuntu 13.10 中安装配置 Hadoop 2.2.0
预备条件: 1. 已安装JDK Add Hadoop Group and User $ sudo addgroup hadoop$ sudo adduser --ingroup hadoop hdus ...
- js-ES6学习笔记-async函数(3)
1.await命令后面的Promise对象,运行结果可能是rejected,所以最好把await命令放在try...catch代码块中. 2.多个await命令后面的异步操作,如果不存在继发关系,最好 ...
- 【读书笔记】iOS-iOS定位
iOS提供3种不同的定位途径: 1,WiFi定位,通过查询一个WiFi路由器的地理位置信息,比较省电:iPhone,iPod touch和iPad都可以采用: 2,蜂窝式移动电话基站定位,通过移动运营 ...
- 大数据时代,银行BI应用的方案探讨
大数据被誉为21世纪发展创造的新动力,BI(商业智能)成为当下最热门的数据应用方案.据资料显示:当前中国大数据IT投资最高的为五个行业中,互联网最高.其次是电信.金融.政府和医疗.而在金融行业中,银行 ...