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