Hadoop.2.x_时间服务器搭建(CentOs6.6)
一、检查linux系统NTP是否被安装
[liuwl@hadoop09-linux-01 ~]$
[liuwl@hadoop09-linux-01 ~]$ rpm -qa | grep ntp
ntpdate-4.2.6p5-10.el6.centos.1.x86_64
ntp-4.2.6p5-10.el6.centos.1.x86_64
☹ 如果没有安装
#方案一:
[liuwl@hadoop09-linux-01 ~]$ which ntpd
/usr/sbin/ntpd
[liuwl@hadoop09-linux-01 ~]$ rpm -qf /usr/sbin/ntpd
ntp-4.2.6p5-10.el6.centos.1.x86_64
[liuwl@hadoop09-linux-01 ~]$ which ntpdate
/usr/sbin/ntpdate
[liuwl@hadoop09-linux-01 ~]$ rpm -qf /usr/sbin/ntpdate
ntpdate-4.2.6p5-10.el6.centos.1.x86_64
#找到相应安装包版本rpm 安装即可
rpm -ivh ntp-4.2.6p5-10.el6.centos.1.x86_64.rpm
rpm -ivh ntpdate-4.2.6p5-10.el6.centos.1.x86_64.rpm
#实在不行就使用反查命令,要确保联网
yum whatprovides */ntp
#或直接使用yum安装
yum -y install ntp
yum -y install ntpdate
关于rpm或yum安装:http://www.cnblogs.com/eRrsr/p/5851411.html
二、使用命令安装ntp后,/etc/下会有ntp.conf文件
1. 同步当前系统时间和写入BOIS:
# 同步外网时间服务器到系统时间
ntpdate -u 202.112.10.36
# 同步系统时间到硬件
hwclock -w
# 需要注意的是
1. 输入命令后显示no server...
原因可能是->网络问题(ping时间服务器),加-u测试
2. 提示正常,但时间设置未变,一般linux不会出这种问题,这个问题原因(我这的原因): 时区不正确,一般设置就是Asia/Shanghai,而我的是美国时区,使用命令:
cp /usr/zoneinfo/Asia/Shanghai /etc/localtime # ln -sf ... 或创建软连接
然后修改一下clock文件
vi /etc/sysconfig/clock
ZONE="Asia/Shanghai"
再次ntpdate设置时间
2. 修改/etc/ntp.conf文件:
1. 去掉#,并修改成自己的网关
restrict 10.0.0.1 mask 255.255.255.0 nomodify notrap
2. 注释(可以不注释或添加外网时间服务器)
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
3. 配置在无网络下使用本机为时间服务器
server 127.127.1.0
fudge 127.127.1.0 stratum 10
4. 配置完毕后保存退出,重启ntpd服务,如果已经打开的话
3. 配置启动服务和开机自启(标注# ◆ 是我走的步骤)
# 临时启动
[liuwl@hadoop09-linux-01 ~]$ sudo service ntpd start # ◆
# 关闭ntpd服务
[liuwl@hadoop09-linux-01 ~]$ sudo service ntpd stop
# 重启ntpd服务
[liuwl@hadoop09-linux-01 ~]$ sudo service ntpd restart
# 开机自启ntpd服务
[liuwl@hadoop09-linux-01 ~]$ sudo chkconfig ntpd on # ◆
# 查看开机自启有哪些服务(查看ntpd是否正常配置) [liuwl@hadoop09-linux-01 ~]$ sudo chkconfig # ◆
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
4. 防火墙配置(标注# ◆ 是我走的步骤)
# 临时启动防火墙
[liuwl@hadoop09-linux-01 ~]$ sudo service iptables start
# 关闭防火墙
[liuwl@hadoop09-linux-01 ~]$ sudo service iptables stop
# 开机关闭防火墙
[liuwl@hadoop09-linux-01 ~]$ sudo chkconfig iptables on # ◆
# 当然也可以开放防火墙123端口
iptables -A INPUT -p UDP -i eno16777736 -s 192.168.1.0/24 --dport 123 -j ACCEPT
#SELinux设置
setsebool -P ntp_disable_trans 1
#允许BIOS与系统时间同步,添加下面一行或使用命令:hwclock -w
vi /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes # ◆
5. 检测NTP服务是否运行
[liuwl@hadoop09-linux-01 ~]$ sudo netstat -tlunp | grep ntp
udp 0 0 10.0.0.108:123 0.0.0.0:* 2366/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 2366/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 2366/ntpd
udp 0 0 fe80::20c:29ff:fece:ec86:123 :::* 2366/ntpd
udp 0 0 ::1:123 :::* 2366/ntpd
udp 0 0 :::123 :::* 2366/ntpd
6. 查看ntp服务器与上层ntp的状态
[liuwl@hadoop09-linux-01 ~]$ ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 10 l 24 64 377 0.000 0.000 0.000
remote - 本机和上层ntp的ip或主机名,“+”表示优先,“*”表示次优先
refid - 参考上一层ntp主机地址
st - stratum阶层
when - 多少秒前曾经同步过时间
poll - 下次更新在多少秒后
reach - 已经向上层ntp服务器要求更新的次数
delay - 网络延迟
offset - 时间补偿
jitter - 系统时间与bios时间差
7. 客户端配置计划任务同步系统时间和硬件时间
vi /etc/crontab
01 00 * * * root /usr/sbin/ntpdate -u hadoop09-linux-01.ibeifeng.com; /sbin/hwclock -w
# 规定每晚00:01分执行任务,hadoop09-linux-01.ibeifeng.com为刚才设置的时间服务器
# 查看规定的任务(-e添加新任务,-r为删除)
crontab -l
Hadoop.2.x_时间服务器搭建(CentOs6.6)的更多相关文章
- NTP时间服务器 搭建
1.1 NTP简介 NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议.它的用途是把计算机的时钟同步到世界协调时UTC,其精度在局域网内可达 ...
- 重识linux-ntp时间服务器搭建
1 安装 yum install ntp 2 启动 service ntpd start 3 配置文件 /etc/ntp.conf 4 查看是否有报错 tail /var/log/message 5 ...
- NTP时间服务器搭建
系统时区设置::: 查看当前时区# date -R修改系统时区# timeconfig 或# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtim ...
- LINUX时间服务器搭建
一. 因 为工作需要,偶需要将搭建一个NTP服务器来进行时间同步的测试,在公司里一直以为非常的难搭建,也是刚刚工作的缘故,就等正导师给帮着弄一台服务器,结 果导师给了我一个系统叫Fedora,让我偶自 ...
- Windows下的git服务器搭建
时间一晃又是两个月过去了,我好像在写博客这方面有点懒,= .= 主要也是没啥好写的,项目上的事情又不能写,能写的东西实在太少. 前两个月领导花巨资申请了一个服务器,让我搞git服务器来管理代码,花了几 ...
- Centos6.5时间服务器NTP搭建
NTP时间服务器安装与配置 第1章 Server端的安装与配置 1.1 查看系统是否已经安装ntp服务组件 rpm -qa | grep "ntp" #<==查看是否已经安装 ...
- Hadoop集群搭建:用三台云服务器搭建HA集群(过程记录和分享)
该文主要记录了自己用云服务器搭建集群的过程,也分享一些自己遇到的问题和解决方法.里面可能提及一些自己的理解,可能不够准确,希望大家能够指正我,谢谢. 1.什么是HA集群 HA :High Availa ...
- Linux - CentOS6.5服务器搭建与初始化配置详解(下)
传送带:Linux - CentOS6.5服务器搭建与初始化配置详解(上) 继续接着上面的安装,安装完后会出现下面界面 点击reboot重启 重启后可以看到下面的tty终端界面 因为这就是最小化安装 ...
- CentOS7搭建时间服务器-chrony(不坑)
标签(linux): chrony 笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 之前centos6我们一直用的ntp时间服务器,虽然到CentOS7上也可以装 ...
随机推荐
- 同一天的时间差,显示为HHMMSS和指定日期时间部分
//1.hhmmss private String setGoodsDisBalance(Date startTime,Date endTime){ //时间差:毫秒ms long diff = en ...
- 小甲鱼PE详解之IMAGE_NT_HEADERS结构定义即各个属性的作用(PE详解02)
PE Header 是PE相关结构NT映像头(IMAGE_NT_HEADER)的简称,里边包含着许多PE装载器用到的重要字段.下边小甲鱼将为大家详细讲解哈~ (视频教程:http://fishc.co ...
- 【SSH】 之 Struts
(一)什么是Struts,Struts是什么? Struts是学习轻量级J2EE框架所必须要了解的一个框架,也是我们当前最最流行的三大框架(SSH——Struts,Spring,Hibernate)之 ...
- 【项目经验】 Html Select 遇上 Easyui
一.背景: 当我在做课表选择触发事件的时候,我发现了一个问题,就是我们直接用的easyui-combobox里面的的绑定事件(onchange)貌似触发不了,这是为什么呢? 二.结论及方法 .原始方法 ...
- 日常UVA题目英语积累
quote应该是引号的意思 Two matches (i, j) and (p, q) are called independent when i = p if and only if j = q. ...
- codeforces 286 div2 B
思路:质因子累乘的值即为所求#include<iostream> #include<algorithm> #include<stdio.h> #include< ...
- hdu2476 String painter(区间dp)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2476 Problem Description There are two strings ...
- [工作bug]一个weblogic跨应用导致session丢失的bug之旅
近来,发布一个应用,开发和本地测试一切都好,一旦部署到测试环境之后,坑爹的问题随之而来,应用程序不定时的超时,导致用户正在操作过程中被踢了出来,纠结了几天,终于在今天将此问题搞定: 1.系统架构 系统 ...
- 关于jquery中 跳出each循环的方法
最近在项目中用带了jquery,在使用each循环遍历时在满足一定条件就跳出,发现break不好使,最终原来 用 return false;便可解决.
- hdu 5459 Jesus Is Here (费波纳茨递推)
Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 65535/102400 K (Java/Others)Total Submission ...