devstack systemctl 使用說明

devstack新版已經拋棄了screen指令,現(xiàn)在改用systemctl 來做服務重啟、檢查日志等。而且這個鳥東西還不支持pdb加斷點,很不方便debug。大家可以去舊版的devstack考一個screenrc文件回來繼續(xù)使用。

操作一個服務單位

Enable a unit (allows it to be started):

sudo systemctl enable devstack@n-cpu.service

Disable a unit:

sudo systemctl disable devstack@n-cpu.service

Start a unit:

sudo systemctl start devstack@n-cpu.service

Stop a unit:

sudo systemctl stop devstack@n-cpu.service

Restart a unit:

sudo systemctl restart devstack@n-cpu.service

See status of a unit:

sudo systemctl status devstack@n-cpu.service

批量操作服務單位

Operating on more than one unit at a time?
Systemd supports wildcarding for unit operations. To restart every service in devstack you can do that following:

sudo systemctl restart devstack@*

Or to see the status of all Nova processes you can do:

sudo systemctl status devstack@n-*

檢查日志

Querying Logs

One of the other major things that comes with systemd is journald, a consolidated way to access logs (including querying through structured metadata). This is accessed by the user via journalctl command.

Logs can be accessed through journalctl. journalctl has powerful query facilities. We’ll start with some common options.

Follow logs for a specific service:

journalctl -f --unit devstack@n-cpu.service

Following logs for multiple services simultaneously:

journalctl -f --unit devstack@n-cpu.service --unit

devstack@n-cond.service
or you can even do wild cards to follow all the nova services:

journalctl -f --unit devstack@n-*

Use higher precision time stamps:

journalctl -f -o short-precise --unit devstack@n-cpu.service

By default, journalctl strips out “unprintable” characters, including ASCII color codes. To keep the color codes (which can be interpreted by an appropriate terminal/pager - e.g. less, the default):

journalctl -a --unit devstack@n-cpu.service

參考:

https://docs.openstack.org/devstack/latest/systemd.html

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容