devstack systemctl 使用说明

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

操作一个服务单位

Enable a unit (allows it to be started):

sudo systemctl enable [email protected]

Disable a unit:

sudo systemctl disable [email protected]

Start a unit:

sudo systemctl start [email protected]

Stop a unit:

sudo systemctl stop [email protected]

Restart a unit:

sudo systemctl restart [email protected]

See status of a unit:

sudo systemctl status [email protected]

批量操作服务单位

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 [email protected]

Following logs for multiple services simultaneously:

journalctl -f --unit [email protected] --unit

[email protected]
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 [email protected]

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 [email protected]

参考:

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

你可能感兴趣的:(devstack systemctl 使用说明)