Thursday, May 15, 2014

[aix] time setting on aix using xntp daemon

[AIX] time sync using NTP daemon, xnptd setting
How to make a time sync. between systems

We need to make a time sync. between clustering system and many database(DB) server.
There are big 3-ways that we can make a time sync.

1. This is very simple command using 'setclock'
It makes a time sync only once with host so can be different as time goes by.
you can use 'crontab', schedule daemon, if you want to set up time every time you want to.
I'll introduce to you how to use crontab daemon later


2. Using timed daemon
- Synchronize servers' time on the same network(LAN).
- It can make huge gaps between systems because it ignores under 20ms.
- Having Back server risk, if the client time is faster than server's

3. Using NTP damon
The last way to synchronize time is using NTP daemon. The accurate daemon name is 'xntpd'
It can use the system under the different network
NTP(network time protocol) daemon is using UDP port(port 123), so you can't use if your system isn't open UPD port. Basically timed daemon immediately synchronize time after configuration but ntp daemon is synchronized after 8~10 min.(It's different by distance and drift)

- Configuration 
  1. Env: AIX 6.1
1.1 Making Server(base time) environment configuration
1) /etc/ntp.conf, /etc/ntp.drift, /etc/trace file check
2) /etc/ntp.conf file modify

   # vi /etc/ntp.conf 
==================== /etc/ntp.conf : server===============
server 127.127.1.0 prefer    # local clock as a reference, default setting
fudge 127.127.1.0 stratum 0    # values for local clock, not required
driftfile /etc/ntp.drift    # where to keep drift data
tracefile /etc/ntp.trace
=================================================


3) xntpd daemon start
#startsrc -s xntpd

xnntp daemon check command
#ps -ef|grep xntpd   
 
or
#lssrc -ls xntpd
check xntpd subsystem status is 'active' or not
ntp_2

1.2 Client
1) Check the gap between server and client. xntpd isn't make sync if there are over about 16min gap. so you should change the time smilary(Using # smitty date)
2) Check the below files
/etc/ntp.conf, /etc/ntp.drift, /etc/ntp.trace
3) Modify /etc/ntp.conf file 
==================== /etc/ntp.conf : Client================
server ServerIP prefer    # Input server's IP address where the ServerIP is
driftfile /etc/ntp.drift    # where to keep drift data
tracefile /etc/ntp.trace
==================================================

4) xntpd daemon start
#startsrc -s xntpd -a -X       
// -X option is prevent time backward(It controls time flow)
Check the clinet xntp daemon.
#ps -ef|grep xntpd   
ntp_3
 or
#lssrc -ls xntpd
If service is active normally, the subsystem's status is in 'active'

ntp_2

You can check the process time is synchronizing through below command
# ntpq –p
ntp_5

Most of all systems will be completed when the reach value is 377 but it can be long time up to time gap between server and client

Tip Usually NTP daemon is never starting when the system is reboot.
If you want to active the daemon automatically, insert the below item into /etc/rc.tcpip


start /usr/sbin/xntpd "$src_running" "-x"


No comments:

Post a Comment