2019独角兽企业重金招聘Python工程师标准>>>

测试集群hosts:

192.168.64.11 master1

192.168.64.12 master2

192.168.64.13 slave1

1。对master1时间服务器进行操作: 
检查时间服务是否安装

# rpm -q ntp

ntp-4.2.4p8-2.el6.x86_64    // 这表示已安装了,如果没有安装,这是空白。

如果没有安装,我们按照下

# yum install ntp

按上面的安装方式在内网每台服务器上都安装好NTP软件包。

完成后,都需要配置NTP服务为自启动

# chkconfig ntpd on

# chkconfig --list ntpd

ntpd           0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

在配置前,先使用ntpdate手动同步下时间,免得本机与外部时间服务器时间差距太大,让ntpd不能正常同步。

# ntpdate -u 202.112.10.36

22 Dec 16:52:38 ntpdate[6400]: adjust time server 202.112.10.36 offset 0.012135 sec

2. 更改相关配置文件 

# For more information about this file, see the man pages

# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not

# permit the source to query or modify the service on this system.

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could

# be tightened as well, but to do so would effect some of

# the administrative functions.

restrict 127.0.0.1

restrict -6 ::1

# Hosts on local network are less restricted.

# 允许内网其他机器同步时间

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

# 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cn

server 210.72.145.44 perfer   # 中国国家受时中心

server 202.112.10.36             # 1.cn.pool.ntp.org

server 59.124.196.83             # 0.asia.pool.ntp.org

#broadcast 192.168.1.255 autokey        # broadcast server

#broadcastclient                        # broadcast client

#broadcast 224.0.1.1 autokey            # multicast server

#multicastclient 224.0.1.1              # multicast client

#manycastserver 239.255.254.254         # manycast server

#manycastclient 239.255.254.254 autokey # manycast client

# allow update time by the upper server

# 允许上层时间服务器主动修改本机时间

restrict 210.72.145.44 nomodify notrap noquery

restrict 202.112.10.36 nomodify notrap noquery

restrict 59.124.196.83 nomodify notrap noquery

# Undisciplined Local Clock. This is a fake driver intended for backup

# and when no outside source of synchronized time is available.

# 外部时间服务器不可用时,以本地时间作为时间服务

server  127.127.1.0     # local clock

fudge   127.127.1.0 stratum 10

# Enable public key cryptography.

#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating

# with symmetric key cryptography.

keys /etc/ntp/keys

# Specify the key identifiers which are trusted.

#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.

#requestkey 8

# Specify the key identifier to use with the ntpq utility.

#controlkey 8

# Enable writing of statistics records.

#statistics clockstats cryptostats loopstats peerstats

配置文件修改完成,保存退出,启动服务。

# service ntpd start

......

启动后,一般需要5-10分钟左右的时候才能与外部时间服务器开始同步时间。可以通过命令查询NTPD服务情况。

查看服务连接和监听

# netstat -tlunp | grep ntp

udp        0      0 192.168.64.11:123           0.0.0.0:*                               23103/ntpd

udp        0      0 127.0.0.1:123               0.0.0.0:*                               23103/ntpd

udp        0      0 0.0.0.0:123                 0.0.0.0:*                               23103/ntpd

udp        0      0 fe80::6cae:8bff:fe3d:f65:123 :::*                                    23103/ntpd

udp        0      0 fe80::6eae:8bff:fe3d:f65:123 :::*                                    23103/ntpd

udp        0      0 ::1:123                     :::*                                    23103/ntpd

udp        0      0 :::123                      :::*                                    23103/ntpd

看加粗的地方,表示连接和监听已正确,采用UDP方式

3。 将其他节点的时间与master1进行同步

在其他每一个节点运行命令

root@slave1:~# ntpdate master1

这时候发现节点间的时间同步了,但ntpdate只在开机运行,我们若要设置为1小时同步一次

安装完以后使用crontab来自动更新时间:

#crontab -e

添加如下行:

* */1 * * * /usr/sbin/ntpdate 192.168.64.11

使用date命令发现所有节点时间已经一致。

转载于:https://my.oschina.net/aibati2008/blog/619153

hadoop集群时间同步相关推荐

  1. Hadoop集群时间同步NTP

    一.集群时间同步介绍 当然要是图简单直接有xshell工具        时间同步的方式:找一个机器,作为时间服务器,所有的机器与这台集群时间进行定时的同步,比如,每隔十分钟,同步一次时间. NTP服 ...

  2. hadoop 集群时间同步

    集群时间同步 如果服务器在公网环境(能连接外网),可以不采用集群时间同步,因为服务器会定期和公网时间进行校准: 如果服务器在内网环境,必须要配置集群时间同步,否则时间久了,会产生时间偏差,导致集群执行 ...

  3. Hadoop集群搭建(三台Linux服务器)

    Hadoop集群搭建(三台Linux服务器) 搭建之前注意的几点问题 环境以及版本 基本命令 Linux环境准备 首先安装Hadoop 配置集群分发脚本 克隆配置好的机器 Hadoop集群配置 第一步 ...

  4. 大数据之-Hadoop完全分布式_集群时间同步---大数据之hadoop工作笔记0043

    然后我们需要在集群中的所有机器,保持他们的时间是一样的,为什么,? 比如,我们有3台机器, a机器时间是1点 b机器时间是2点 c机器时间是3点 那么如果我们设置了一个任务是要求他1点执行,那么,会出 ...

  5. Hadoop学习之虚拟机环境配置,防火墙、selinux关闭、集群时间同步(LinuxcentOS7版本)

    目录​​​​​​​ 1. 镜像文件下载 2.Linux-centOS安装 第三步与第三步需在root用户下进行操作 3.虚拟机关闭防火墙 4.设置selinux 5.集群时间同步 1. 镜像文件下载 ...

  6. Hadoop集群搭建(六:HBase的安装配置)

    实验 目的 要求 目的: 1.HBase的高可用完全分布模式的安装和验证 要求: 完成HBase的高可用完全分布模式的安装: HBase的相关服务进程能够正常的启动: HBase控制台能够正常使用: ...

  7. Hadoop集群中运行MapReduce程序错误记录

    Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for ...

  8. Hadoop入门(十二)Intellij IDEA远程向hadoop集群提交mapreduce作业

    Intellij IDEA远程向hadoop集群提交mapreduce作业,需要依赖到hadoop的库,hadoop集群的配置信息,还有本地项目的jar包. 一.软件环境 (1)window本地安装h ...

  9. Hadoop集群安装部署_分布式集群安装_01

    文章目录 1. 分布式集群规划 2. 数据清理 3. 基础环境准备 4. 配置ip映射 5. 时间同步 6. SSH免密码登录完善 7. 免密登录验证 1. 分布式集群规划 伪分布集群搞定了以后我们来 ...

最新文章

  1. Caffe源码中blob文件分析
  2. JavaScript中变量的相互引用
  3. AI在传统制造业的应用落地!
  4. oracle protocol=beq 不可用,Oracle BEQ方式连接配置
  5. C#三层ATM-11.查看交易信息
  6. 阿里云Redis混合存储典型场景:如何轻松搭建视频直播间系统
  7. html怎么拿json数据,如何使用Python从HTML数据中提取JSON数据?
  8. maven打包忽略注解_Maven打包时遇到的一些坑和解决方案
  9. 埋石图根点lisp代码_GPS测量作业流程.doc
  10. 多样化实现Windows Phone 7本地数据库访问1
  11. Linux 如何限制用户的磁盘使用量 -- quota
  12. 啊哈算法2伟大思维闪耀时_五分钟学编程:怎样才能学好笔试面试最爱考察的算法...
  13. 计算大数阶乘--VB Script 版
  14. python opencv 显示图片 灰度图片 合并图片 保存图片 纵向合并
  15. 基于IE的MIME sniffing功能的跨站点脚本攻击
  16. 基于Python实现制作的塔防游戏
  17. K455L安装Ubuntu18.04历程
  18. 充气娃娃?Python告诉你到底有多爽......
  19. 设计模式-适配器模式
  20. toad分析oracle日志,toad for oracle如何分析sql

热门文章

  1. gcc s.lds 使用方法
  2. access数据类型百度百科_Access数据库属于什么数据库。
  3. 算法设计与分析 4 估计递归函数复杂度所提及算法
  4. 数学建模 时间序列模型
  5. 线性代数里的最小二乘法介绍
  6. 机房监控系统解说--发电机篇
  7. openstack M 版 neutron网络组件基础入门
  8. 每个优秀程序员必须具备的技能
  9. linux ping策略打开_Linux禁止ping以及开启ping的方法
  10. 3.5.4 CSMA/CD 协议