hypermkt blog


January 12, 2014





  • 正確なログ調査ができない。
  • 複数台化構成で時刻がずれてるとデータの並び替えにずれが起きる(レコードのcreate_dateをnow()ではなく、アプリ側で日付を作り登録する仕様だとこうなります。)
  • 5〜10分近くずれるとAPIでエラーが起こることもある(前にRoute53で登録に失敗したことがあったような)




%w{ ntp }.each do |package| package package do action :install end end

template “ntp.conf” do path “/etc/ntp.conf” owner “root” group “root” mode 0644 source “ntp.conf.erb” notifies :restart, “service[ntpd]” end

service “ntpd” do action [ :enable, :start] supports :status => true, :restart => true, :reload => true end

cookbooks/ntp/templates/default/ntp.conf.erb NTPサーバーは日本標準時刻にあわせるため、日本のサーバーを使用します。

Permit time synchronization with our time source, but do not

permit the source to query or modify the service on this system.

restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery

Permit all access over the loopback interface. This could

be tightened as well, but to do so would effect some of

the administrative functions.

restrict restrict -6 ::1

Hosts on local network are less restricted.

restrict mask nomodify notrap

Use public servers from the pool.ntp.org project.

Please consider joining the pool (http://www.pool.ntp.org/join.html).

server -4 ntp.nict.jp server -4 ntp1.jst.mfeed.ad.jp server -4 ntp2.jst.mfeed.ad.jp server -4 ntp3.jst.mfeed.ad.jp

broadcast key 42 # broadcast server

broadcastclient # broadcast client

broadcast key 42 # multicast server

multicastclient # multicast client

manycastserver # manycast server

manycastclient key 42 # manycast client

Undisciplined Local Clock. This is a fake driver intended for backup

and when no outside source of synchronized time is available.

server # local clock fudge stratum 10

Drift file. Put this in a directory which the daemon can write to.

No symbolic links allowed, either, since the daemon updates the file

by creating a temporary in the same directory and then rename()‘ing

it to the file.

driftfile /var/lib/ntp/drift

Key file containing the keys and key identifiers used when operating

with symmetric key cryptography.

keys /etc/ntp/keys

Specify the key identifiers which are trusted.

trustedkey 4 8 42

Specify the key identifier to use with the ntpdc utility.

requestkey 8

Specify the key identifier to use with the ntpq utility.

controlkey 8



/etc/rc.d/init.d/ntpd stop ntpdate ntp.nict.jp /etc/rc.d/init.d/ntpd start