devstack systemctl 使用说明

2017-08-31  本文已影响148人  笨手笨脚越

devstack新版已经抛弃了screen指令,现在改用systemctl 来做服务重启、检查日志等。而且这个鸟东西还不支持pdb加断点,很不方便debug。大家可以去旧版的devstack考一个screenrc文件回来继续使用。

操作一个服务单位

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

上一篇下一篇

猜你喜欢

热点阅读