NTP is Network Time Protocol. This protocol is used for clock synchronisation between computer systems. NTP is one of the oldest protocols which are still used on the Internet.
The scenario below explains the use of NTP:
While the server is running, the system clock will gradually slow or run faster which will lead to clock misalignment. Whether you are running multiple systems over a load balancer, or just multiple systems in parallel, it’s very important to make sure that they are all on the same clock, interpreting and processing the records with the same current time. As simple as it sounds before NTP this was a very challenging task.
The concept of NTP is to synchronise all computer clocks over some reference point. Having NTPd - being a Network Time Protocol daemon running on all the systems, you will assure that all your system clocks are synchronised against one reference point.
sudo ntpdate -s ntp.ubuntu.com; sudo apt-get install ntp; sudo service ntp reload; sudo service apache2 reload;
If you would like to execute this algorithm for several nodes over the network, you can do as follows:
sudo ssh -i key.pem ubuntu@machine1 ‘sudo ntpdate -s ntp.ubuntu.com; sudo apt-get install ntp; sudo service ntp reload; sudo service apache2 reload;’ ;
sudo ssh -i key.pem ubuntu@machine2 ‘sudo ntpdate -s ntp.ubuntu.com; sudo apt-get install ntp; sudo service ntp reload; sudo service apache2 reload;’ ;
sudo ssh -i key.pem ubuntu@machine3 ‘sudo ntpdate -s ntp.ubuntu.com; sudo apt-get install ntp; sudo service ntp reload; sudo service apache2 reload;’ ;