LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to synchronize time on 2 server CentOS (do not use NTP) (https://www.linuxquestions.org/questions/linux-server-73/how-to-synchronize-time-on-2-server-centos-do-not-use-ntp-929139/)

huydq_bk 02-13-2012 12:19 PM

How to synchronize time on 2 server CentOS (do not use NTP)
 
Hi everybody.

I'm using CentOS 5.5 on VMware. Assume that I have two servers CentOS: one primary server (IP 192.168.10.10)

and one backup server (IP 192.168.10.20). Now I want to synchronize time on 2 servers and I was told not to use

NTP. I search on Internet and found 2 way as follow:

+) using rdate: on backup server, I use :

[root@localhost ~]# rdate -s 192.168.10.10

and the following error:

[root@localhost ~]# rdate: couldn't connect to host localhost: Connection refused.

+) using net time and also failure:

[root@localhost ~]# net time set 192.168.10.10 /set /y

Could not locate a time server. Try specifying a target host.

I don't understand why errors occur. Is there other way to synchronize time on 2 servers? Can you help me, please!

Thanks!

lithos 02-13-2012 02:23 PM

Hi,

You have 2 (two) options:
- htpdate , man htpdate, rpm
and my favorite
- ntpdate

but, I doubt you will have success in VMWare machines, because they are synced to HOST machine running VMWare (and which should have been NTP synced). VMWare guests cannot have different time/date than host machine (by my experience)

good luck

TenTenths 02-14-2012 02:56 AM

Another messy way is to set up keypairs and then run a script on primary that creates a keypair authenticated ssh session on backup and then uses date -s to set the time.

huydq_bk 02-14-2012 10:37 AM

Thank everybody. I used htpdate and I synchronized on 2 servers.

lithos 02-14-2012 12:00 PM

Great,

can you please mark the thread as solved if you find the solution appropriate (how- look my sign.)

Regards.

huydq_bk 02-14-2012 12:07 PM

Ok. I has marked the thread as solved. Thanks lithos very much.


All times are GMT -5. The time now is 04:45 PM.