Call us Toll-Free:
1-800-218-1525
Live ChatEmail us

 Sponsors

NTP for Accurate Global Time Synchronization

Mike Peters, 02-11-2011
Running a multi-server architecture?

Keeping your server clocks in-sync is very important, especially when using NoSQL databases like Cassandra.

Cassandra attaches a timestamp to every insert operation. If your server clocks fall out of sync, some updates will be dropped, due to one server taking precedence over others.

Even if your servers are all showing the same time right now, it's important to understand that without continually applying corrections, the different clocks will eventually fall out of sync.

How does Global Time Synchronization work?

Public time servers, update their clocks using hardware based on atom's electrons frequency (aka Atomic Clocks).

Your local machines ping the time server repeatedly, applying corrections so that all clocks are in sync.

NTP

NTP (Network Time Protocol) is an Internet protocol used to synchronize the clocks of computers to a global time reference.

FreeBSD and Linux servers come with an NTPD service that automatically adjusts the local clock based on the selected global time server.

To start NTPD on Linux:
ntpdate pool.ntp.org
service ntpd restart

To start NTPD on FreeBSD:
ntpdate pool.ntp.org
/etc/rc.d/ntpd start

Controlling which time server to use is done by updating /etc/ntp.conf. Example:
server pool.ntp.org prefer
driftfile /var/db/ntpd.drift
logfile /var/log/ntpd.log

To configure NTPD to start on boot automatically on Linux:
chkconfig --level 2345 ntpd on

To configure NTPD to start on boot automatically on FreeBSD:
Add these lines to your /etc/rc.conf file:
ntpd_enable="YES"
ntpdate_enable="YES"
ntpdate_flags="pool.ntp.org"

Mike Peters, 08-15-2011
Here's a good basic /etc/ntp.conf:

server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
driftfile /var/db/ntpd.drift
logfile /var/log/ntpd.log
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions