Chinaunix首页 | 论坛 | 博客
  • 博客访问: 960047
  • 博文数量: 584
  • 博客积分: 2293
  • 博客等级: 大尉
  • 技术积分: 3045
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-28 11:15
文章分类

全部博文(584)

文章存档

2012年(532)

2011年(47)

2009年(5)

我的朋友

分类:

2012-09-20 11:32:59

环境:
OS:Red Hat Linux As 5
 
  在做RAC的时候需要两个节点的时间需要同步,若有时间服务器的话,可以在/etc/ntp.conf中指定时间服务器,若没有时间服务器的话,可以使用其中一个节点做时间服务器,配置过程如下:
 
1.主节点文件/etc/ntp.conf中添加如下内容
server 127.127.1.0
fudge 127.127.1.0 stratum 11
broadcastdelay 0.008
 
启动ntp服务
[root@node1 /]# service ntpd start

设置ntp自启动:
#system-config-services 在选择框中选择ntpd后保存.
 或是执行如下命令:
chkconfig --level 35 ntpd on

2.次节点文件/etc/ntp.conf添加如下内容
注释掉
#server 127.127.1.0     # local clock
#fudge  127.127.1.0 stratum 10

添加如下内容
server 192.168.80.129 prefer #注意192.168.80.129为主节点的IP地址
broadcastdelay 0.008
 
3.从主节点更新时间
注意次节点不需要启动ntp服务

[root@node2 etc]# ntpdate 192.168.80.129
31 Jul 12:54:44 ntpdate[21308]: the NTP socket is in use, exiting

若提示如上的错误可以通过如下办法解决:
 
[root@node2 etc]# lsof -i:123
COMMAND   PID USER   FD   TYPE DEVICE SIZE NODE NAME
ntpd    21306  ntp   16u  IPv4  60767       UDP *:ntp
ntpd    21306  ntp   17u  IPv6  60768       UDP *:ntp
ntpd    21306  ntp   18u  IPv6  60769       UDP localhost6.localdomain6:ntp
ntpd    21306  ntp   19u  IPv6  60770       UDP [fe80::20c:29ff:fe36:e27e]:ntp
ntpd    21306  ntp   20u  IPv6  60771       UDP [fe80::20c:29ff:fe36:e288]:ntp
ntpd    21306  ntp   21u  IPv4  60772       UDP localhost:ntp
ntpd    21306  ntp   22u  IPv4  60773       UDP node2:ntp
ntpd    21306  ntp   23u  IPv4  60774       UDP node2-priv:ntp
 
[root@node2 etc]# kill -9 21306
[root@node2 etc]# lsof -i:123
[root@node2 etc]# ntpdate 192.168.80.129
31 Jul 13:00:46 ntpdate[21318]: step time server 192.168.80.129 offset 213.362339 sec
[root@node2 etc]#
 
可以将时间获取(ntpdate 192.168.202.134)放入到contrab中每隔1分钟执行一次
如:
#crontab -e
添加如下内容:
*/1 * * * * /usr/sbin/ntpdate 192.168.202.134 >>$HOME/utpdate.log 2>&1
 
注意若是语法不对的话保存的时候会提示如下错误:
[root@node2 cron]# crontab -e
crontab: installing new crontab
"/tmp/crontab.XXXXs5X6nB":2: bad command
errors in crontab file, can't install.
Do you want to retry the same edit? n
 
这个时候需要排查语法问题.
 
说明:
1.做ntp服务器的节点需要关闭iptables
service iptables stop
禁止开机启动
chkconfig iptables off

2.关系防火墙,将SELINUX设置成disabled
[root@node1 etc]# more /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 
 
-- The End --
阅读(879) | 评论(0) | 转发(0) |
0

上一篇:查看函数索引存储结构

下一篇:ASMCMD工具

给主人留下些什么吧!~~