怎么在各个平台上配置NTP的微调模式

51次阅读
没有评论

共计 4457 个字符,预计需要花费 12 分钟才能阅读完成。

丸趣 TV 小编给大家分享一下怎么在各个平台上配置 NTP 的微调模式,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

对于 11.2 之前的版本,很多环境的重启原因(top5 的情况)是由于 NTP 调整时间的步伐过大导致的,所以 RAC 环境中,我们建议用户如果使用 NTP,需要配置成微调模式;

具体重启的原因,请大家参考 Allen Gao 写的博客:如何诊断节点重启问题

这里介绍几个主流 linux 和 unix 平台上 NTP 微调的配置方法:

For Linux:

1. 请确确认各节点的 ntp 包已经安装 , 我这里是个 4.2.2 的版本

[oracle@nascds10 ~]$ rpm -qa | grep ntp

ntp-4.2.2p1-9.el5_4.1

2. 请编辑各个节点的 ntp.conf 文件

[oracle@nascds10 ~]$ su – root

Password:

[root@nascds10 ~]#  vi /etc/ntp.conf

#New ntp server added by Robinson

server  192.168.1.128 prefer  =========== 这里是时钟服务器

restrict 192.168.7.0  mask 255.255.255.255 nomodify notrap #基于网段的限制(限制在网段 192.168.7.0)

broadcastdelay 0.008

[root@nascds11 ~]# vi /etc/ntp.conf

#New ntp server added by Robinson

server 192.168.7.71 prefer

broadcastdelay 0.008

3、配置 ntpd 的参数,我们主要强调的是要配置成 微调的模式 也就是在 options 中要加入 - x 的选项

[root@nascds10 ~]# vi /etc/sysconfig/ntpd

#The following item added by Robinson

#Set to yes to sycn hw clock after successful ntpdate

SYNC_HWCLOCK=yes  

OPTIONS= -x -u ntp:ntp -p /var/run/ntpd.pid

[root@nascds11 ~]# vi /etc/sysconfig/ntpd

The following item added by Robinson

SYNC_HWCLOCK=yes

OPTIONS= -x -u ntp:ntp -p /var/run/ntpd.pid

4、自动启动配置

[root@nascds10 ~]# chkconfig ntpd on

[root@nascds11 ~]# chkconfig ntpd on

5、重启一下,使最新配置生效

[root@nascds10 ~]# service ntpd restart

Shutting down ntpd: [  OK ]

ntpd: Synchronizing with time server: [  OK ]

Syncing hardware clock to system time [  OK ]

Starting ntpd: [  OK ]

[root@nascds11 ~]# service ntpd restart

Shutting down ntpd: [  OK ]

ntpd: Synchronizing with time server: [  OK ]

Syncing hardware clock to system time [  OK ]

Starting ntpd: [  OK ]

6、检查 ntpd 进程的状态

[root@nascds10 ~]# ntpq -p

  remote  refid  st t when poll reach  delay  offset  jitter

==============================================================================

  LOCAL(0)  .LOCL.  10 l  40  64  1  0.000  0.000  0.001

[root@nascds11 ~]# ntpq -p

  remote  refid  st t when poll reach  delay  offset  jitter

==============================================================================

  test.oracle.com  .INIT.  16 u  60  64  0  0.000  0.000  0.000

  LOCAL(0)  .LOCL.  10 l  59  64  1  0.000  0.000  0.001

For Aix:

1. NTP 的同步设置   编辑 /etc/ntp.conf 文件, 内容如下:

—————————-

#broadcastclient

server 192.168.5.2 

driftfile /etc/ntp.drift

tracefile /etc/ntp.trace

slewalways yes

—————————-

我们这里还是要强调微调 slewalways  , 这个值的默认设置是 no,也就是说如果您不设置,NTP 最大可一次调整 1000 秒. 根据 IBM 的官方说明,如果我们不指定 slewthreshold  那么默认值是 0.128 seconds. 如果想特别设置,请指定 slewthreshold 的值,注意单位是 second

2. 在 NTP 客户端启动 xntpd 守护进程

# startsrc -s xntpd

3. 查询 xntpd 的状态

当 system peer 不为 insane 时, 表明客户端已与服务器端成功地进行了同步.

# lssrc -ls xntpd

Program name: –/usr/sbin/xntpd

Version: ——-3

Leap indicator: 00 (No leap second today.) Sys peer: ——192.168.5.2 …

关于更多的关于 IBM 的平台上 NTP 的设置,可以参考 IBM 的官方文档解释:

http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.files/doc/aixfiles/ntp.conf.htm

For HP  UX:

NTP 在 HP 上的配置,是比较省心的,不容易导致 RAC 重启的,因为 HP 上的 NTP 默认的就是微调的模式

1、首先我们还是要编辑 ntp 的配置文件 /etc/rc.config.d/netdaemons,把 XNTPD 设定为 1 表示启动

  export XNTPD=1

2、编辑配置文件 /etc/ntp.conf,配置好时间同步服务器

  server 192.168.5.2  #  第一个地址是主服务器

  server 192.168.5.3  #  第二个地址是备用服务器

3、启动 ntp 的进程

  # /sbin/init.d/xntpd start

4、检查 NTP 的状态

  # /usr/sbin/ntpq -p

  这个命令您会看到同步的地址

  如果出现的结果是 No association ID s returned 那么表示您失败了

关于 HP 主机上 NTP 的模式,有 3 种如下,在 HP 平台的 man page 中有详细的说明:

模式 1:offset below 128 milliseconds

This is the normal operating regime of NTP. A properly configured NTP hierarchy (with reasonable networking) can operate for years without ever approaching the 128 millisecond upper limit. All time adjustments are small and smooth (known as slewing), and nobody even notices the slew adjustments unless they have a cesium clock or a GPS clock and expensive instrumentation to make sophisticated measurements (HP/Agilent makes the instruments).

模式 2:offset above 128 milliseconds

This regime is often encountered at power-on because, those battery-backed real-time clocks they put in computers are not too great. Because NTP is quite capable of keeping the offset below one millisecond all the time it is running, many users want to get into the normal regime quickly when an offset above 128 millisecond is encountered at startup. So in this situation NTP will (fairly quickly) make a single step change, and is usually successful in getting the offset well below 128 millisecond so there will be no more of the disruptive step changes.

模式 3:offset above 1000 seconds

This is so far out of the normal operating range that NTP decides something is terribly wrong and human intervention is required. The daemon shuts down.

For Solars:

我这没有测试的平台,不过在 KM (How to Configure NTP or Windows Time for Oracle Clusterware (Doc ID 1056693.1)) 里找到了配置的办法,这里还有 Windows 的配置方式

检查配置:

/usr/bin/svcs ntp

STATE  STIME  FMRI

online  7:39:29 svc:/network/ntp:default

ps -ef|grep ntp

root 21212  1  0  Feb 02 ?  0:33 /usr/lib/inet/xntpd

配置 /etc/inet/ntp.conf 启用 slewalaways

grep slewalways|pll /etc/inet/ntp.conf

slewalways yes

disable pll

启动:

/usr/sbin/svcadm enable ntp

看完了这篇文章,相信你对“怎么在各个平台上配置 NTP 的微调模式”有了一定的了解,如果想了解更多相关知识,欢迎关注丸趣 TV 行业资讯频道,感谢各位的阅读!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-26发表,共计4457字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)