背景
OS:Ubuntu 16.04
修改了osd的一些配置,修改后,需要重啟osd服務才能生效。第一次重啟后,配置立刻生效。再改了一些配置,重啟osd服務后,配置卻不再生效了。ps命令查看進程,發現osd進程都沒有啟動。
分析
osd進程未啟動,第一直覺就是配置出錯,osd進程啟動后又掛掉。於是,進入/var/log/ceph目錄,查看ceph-osd.0.log,發現日志末尾只有關閉進程的相關日志,並沒有osd啟動的信息。再查看該日志的時間,時間就是關閉服務時的時間。換句話說,第二次重啟服務后,osd沒有啟動。既然沒有啟動,那就不是osd本身的問題,而是和重啟服務的命令systemctl restart ceph-osd.target相關了。
先檢查下osd服務的狀態。
$ systemctl status ceph-osd.target
● ceph-osd.target - ceph target allowing to start/stop all ceph-osd@.service instances at once
Loaded: loaded (/lib/systemd/system/ceph-osd.target; enabled; vendor preset: enabled)
Active: inactive (dead) since Sun 2017-03-05 16:52:04 CST; 3s ago
果然,服務是inactvice的。再查看服務相關的日志:
$ journalctl -xe
Mar 05 14:21:43 node3 systemd[1]: ceph-osd@0.service: Start request repeated too quickly.
Mar 05 14:21:43 node3 systemd[1]: Failed to start Ceph object storage daemon.
果然是服務啟動失敗,並且給出的原因是啟動請求太快。這很可能和osd服務的配置有關,打開osd服務配置文件/etc/systemd/system/ceph-osd.target.wants/ceph-osd@2.service,發現有服務器啟動間隔的限制,並且限制時間為30分鍾,難怪第一次啟動服務成功,而第二次就失敗了。
$ vi /etc/systemd/system/ceph-osd.target.wants/ceph-osd@0.service
StartLimitInterval=30min
解決方案
注釋掉服務配置文件的啟動間隔限制,並且重新加載服務配置。
$ systemctl daemon-reload
再重啟osd服務,並檢查osd服務的狀態。
$ systemctl restart ceph-osd.target
$ systemctl status ceph-osd.target
● ceph-osd.target - ceph target allowing to start/stop all ceph-osd@.service instances at once
Loaded: loaded (/lib/systemd/system/ceph-osd.target; enabled; vendor preset: enabled)
Active: active since Sun 2017-03-05 16:47:53 CST; 5s ago
Mar 05 16:47:53 node2 systemd[1]: Reached target ceph target allowing to start/stop all ceph-osd@.service instances at once.
服務狀態變為active,問題解決。