Operating System - HP-UX
1833780 Members
2426 Online
110063 Solutions
New Discussion

Get the time synced on 2 servers

 
SOLVED
Go to solution
Marty Metras
Super Advisor

Get the time synced on 2 servers

I have 2 HP-9000's and I see the time difference on the 2 boxes is over 5 minutes.
I know I can just change it. I do not want to do that just yet.
What does HP-UX 11.0 have available to keep one of them to have the correct time and the other one synced to it? And how do you set it up? One server is our primary database and the other one has a standby database.
Can you help?
Marty
The only thing that always remain the same are the changes.
19 REPLIES 19
Patrick Wallek
Honored Contributor

Re: Get the time synced on 2 servers

You should look into NTP.

Have a look at this document (TKB Doc ID: 1100390400): http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000063201958
Patrick Wallek
Honored Contributor

Re: Get the time synced on 2 servers

You should also have a look at the document:

/usr/share/doc/NTP_Primer.txt
Anthony deRito
Respected Contributor

Re: Get the time synced on 2 servers

NTP is the way to go... simple to set up. Good to have several peers that can act as primary time source in case primary server crashes.

Rick Garland
Honored Contributor

Re: Get the time synced on 2 servers

There are numerous posts that are specific to NTP. A site that is a good source of information is from University of Delaware - you can find the URL in these previous posts.

Essentially you want to have a couple of nodes go to an external clock such as the atomic clock in Boulder, CO or the Navy in Colorado Springs. (These are local for me - check to see what is local for you).

The other nodes you can make peers.

The timezone should not be a factor if you have the proper TZ variable set for the systems. Since the NTP time is in UTC, the TZ variable will offset the time to the correct timezone based on the TZ variable.
James R. Ferguson
Acclaimed Contributor

Re: Get the time synced on 2 servers

Hi Marty:

Another good reference for setting up, troubleshooting and understanding NTP is chapter-7 in "Installing and Administering Internet Services":

http://docs.hp.com/hpux/onlinedocs/B2355-90685/B2355-90685.html

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: Get the time synced on 2 servers

Hi (again) Marty:

...and here's a good list of available, public servers from which to choose:

http://www.eecis.udel.edu/~mills/ntp/clock2.html

Regards!

...JRF...
Marty Metras
Super Advisor

Re: Get the time synced on 2 servers

I must have some thing missing.
I used Patrick's first idea to set it NTP using sam. This is easy enough to do.
Well, in sam when I try to start NTP it says it is not running. Also I see no deamon running. Should there be?
This is the case on both the Primary and the Standby server.
On the Primary server was pointing to our Time clock server. It should be running NTP Ver 3. I think this was working because my work station sync to that server(NT) and both match at once about a time. How do I verify that this is broadcasting the time?
In sam it shows that NTP is not running. How do you start this from the command line?
What did I miss?
Marty
The only thing that always remain the same are the changes.
Patrick Wallek
Honored Contributor

Re: Get the time synced on 2 servers

To start NTP from the command line you first need to modify the file /etc/rc.config.d/netdaemons so that it knows NTP needs to start. Modify the line 'export XNTPD' so that it looks like:

export XNTPD=1

Then to try to start the daemons from the command line do:

# /sbin/init.d/xntpd start
Marty Metras
Super Advisor

Re: Get the time synced on 2 servers

Still some thing is not right.
I motified /etc/rc.config.d/netdaemons
NTPDATE_SERVER had our time cloce server.
When I tryed to start xintpd it said it was invalid so I changed to what you see below. XNTPD=1 was already right.
looks like this:

export NTPDATE_SERVER=ntp-1.mcs.anl.gov
export XNTPD=1

When I started executed the `/sbin/init.d/xntpd start`
It returned a message like this. It was 67 seconds the first time.

30 Dec 12:43:35 ntpdate[29099]: step time server 140.221.9.20 offset -0.046400 sec

In sam it still show that ntp is not running.
Using `ps -ef|grep ntp` alss returns nothing.
It is like it runs once and dies.
the "ntp.conf"(below) file has only a few lines.

driftfile /etc/ntp.drift
authenticate no
broadcastclient yes
server milo.mcs.anl.gov version 3 prefer
broadcast 121.1.255.255 version 3

What else am I missing?
Marty
The only thing that always remain the same are the changes.
Marty Metras
Super Advisor

Re: Get the time synced on 2 servers

Update:
I forgot about checking syslog.log for errors.
Here is what I found when I stry to start xntpd:

Dec 30 13:47:41 kncryvis xntpd[7840]: xntpd version 3.5f: Sat Apr 14 15:04:53 IST 2001 PHNE_23697
Dec 30 13:47:41 kncryvis xntpd[7840]: tickadj = 625, tick = 10000, tvu_maxslew = 61875
Dec 30 13:47:41 kncryvis xntpd[7840]: precision = 6 usec
Dec 30 13:47:41 kncryvis xntpd[7840]: bind() fd 10, family 2, port 123, addr 7901ffff, in_classd=0 flags=0 fails: Address already in use

Is there a way around thie?
Marty
The only thing that always remain the same are the changes.
Chakravarthi
Trusted Contributor

Re: Get the time synced on 2 servers

use rdate
harry d brown jr
Honored Contributor
Solution

Re: Get the time synced on 2 servers

Marty Metras
Super Advisor

Re: Get the time synced on 2 servers

After looking through the Documents that all of you have linked to, here is what I have done and why.
I wanted to keep time synced on two HP-9000s.
I wanted one to be the master clock for the other.
I looked at `xntpd` and could not get it to keep running. On linux I have been using `rdate` with no problem.
After reading all that documention on time sync, I decided to use `ntpdate`. It is much easer to use. I will put it in a cron job to check the time once a day or so and it adjust the time as needed. I will run it to get time from 10 NTP servers and then ntpdate adjust the time using the average. I use the same NTP servers on both of my servers.
I have both server synced and can use both of then as master clocks for the rest of the network.
For the next week I will monitor the adjustmets without changing the time on the servers. This way I will know how it will work before I put it in automatic mode.

Here is the what I have set up in cron.

ntpdate -q NTP_server1 NTP_server2 >Record_adjistments.log

The -q is just for the query.
Remove the -q to make the adjustments.

I am sure there is other ways to do this.
This one worked for me.

Thanks for all your help. I could not have figture this out with out you.
Happy New Year.

Marty
The only thing that always remain the same are the changes.
Patrick Wallek
Honored Contributor

Re: Get the time synced on 2 servers

ntpdate is fine if you are adjusting the clock while the system is booting up, but I wouldn't necessarily recomment it for a system that is up and running with applications running.

Adjusting the time by running ntpdate, or even just date for that matter, and making the adjustment all at once, can have a severe impact on a database, especially if you go backwards.

I would recomment further work with ntp as it will slew (slowly adjust forward or backward) the time as necessary and thus none of your applications will suffer.
Patrick Wallek
Honored Contributor

Re: Get the time synced on 2 servers

Also, for your "address already in use" issue, have a look at ITRC TKB document S3100005401.

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000063210872

Also be sure that you have the latest NTP patch installed. The latest is PHNE_27223.

http://www1.itrc.hp.com/service/patch/patchDetail.do?patchid=PHNE_27223&context=hpux:800:11:00
Marty Metras
Super Advisor

Re: Get the time synced on 2 servers

Good point Patrick.
I will look deeper.

Thanks for making me slow down.
Marty
The only thing that always remain the same are the changes.
Marty Metras
Super Advisor

Re: Get the time synced on 2 servers

Patrick,
The problem with `xntpd` not starting was in the "ntp.conf" file.
It did not like broadcastclient. I removed that and now the xntpd deamon is running.
I also installed the patch on both servers.
If I understand `xntpd` it makes fine adjustments to the clock as needed. And when I reboot or restart `xntpd` it gets a new time sample and makes small adjustments. basicly `xntpd` it the clock keeper.
----
Now as far as syncing the two server I have to have one of then server broadcast that it is a source of the time standard. On the other servers I just have to have `xntpd` running and tell it what server to use when it is restarted. When they are rebooted then `xntpd` gets a new time sample to use.
---
I should never rest the clock with the server in the normal production mode. Basiclly on a reboot.
---
New question. Dose `xntpd` the the location form /etc/ntp.conf or from /etc/rc.config.d/netdaemons? It is in both places.

all thing change,
Marty
The only thing that always remain the same are the changes.
John Poff
Honored Contributor

Re: Get the time synced on 2 servers

Hi Marty,

The /etc/rc.config.d/netdaemons config file controls whether or not xntpd gets started at boot time. The /etc/ntp.conf file contains all the configuration information for the xntpd daemon, so xntpd needs both of the files.

JP
Marty Metras
Super Advisor

Re: Get the time synced on 2 servers

So it looks like I might have it working now.
I can sit back and see if the time on these 2 servers stay synced.

Thanks for your help.
Happy new Year
Marty
The only thing that always remain the same are the changes.