Environment
- YugabyteDB Anywhere - 2.16.x
Issue
When a Universe is created using "Enable Systemd Services" (the default in later versions), the master and tserver processes cannot be started with the standard systemctl
command.
Most users are familiar with the system-wide systemd services managed by the systemctl
command. But systemd services can be made for and entirely controlled by regular unprivileged users, in our case the yugabyte user.
If we drop a systemd service in ~/.config/systemd/user
, it will be picked up by systemd as a user service. The big advantage is that the particular user now manages this service without the need for sudo.
It does require the --user
flag when invoking any of the systemctl
commands
Additional Information:
It’s possible for systemctl --user
commands to fail with:
[yugabyte@yb-dev-bootstrap-test-n3 ~]$ systemctl --user status yb-master
Failed to get D-Bus connection: No such file or directory
The --user
flag isn’t supported on CentOS 7 / RHEL 7. We install our unit files as system units on CentOS 7 and RHEL 7, so the --user
flag is not required.
On other distros, you may see this error if you use su to change users because DBus initialization for a user happens during login. If you use su
, the systemd
hooks to start up DBus are never called. To avoid this issue, ensure that you log into the node as the yugabyte
user directly rather than logging in as a different user and using su
.
For additional info, please refer to the below article:
https://unix.stackexchange.com/questions/431896/failed-to-get-d-bus-connection-no-such-file-or-directory-xdg-runtime-dir-not
Steps
NOTE:
Ensure that you log into the node as the yugabyte user directly rather than logging in as a different user and using su.
1. Check the status of the master service, Example shows whether the service is running, if it is enabled, and the the path to the service file.
systemctl --user status yb-master
● yb-master.service - Yugabyte master service
Loaded: loaded (/home/yugabyte/.config/systemd/user/yb-master.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-05-03 11:04:13 UTC; 20h ago
Main PID: 75187 (yb-master)
CGroup: /user.slice/user-993.slice/user@993.service/yb-master.service
└─75187 /home/yugabyte/master/bin/yb-master --flagfile /home/yugabyte/master/conf/server.conf
2. Check status of a tserver service, similar example, shows status, whether enabled, path to service file.
systemctl --user status yb-tserver
● yb-tserver.service - Yugabyte tserver service
Loaded: loaded (/home/yugabyte/.config/systemd/user/yb-tserver.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-05-03 11:04:25 UTC; 20h ago
Main PID: 75388 (yb-tserver)
CGroup: /user.slice/user-993.slice/user@993.service/yb-tserver.service
├─ 75388 /home/yugabyte/tserver/bin/yb-tserver --flagfile /home/yugabyte/tserver/conf/server.conf
├─ 75436 /home/yugabyte/yb-software/yugabyte-2.16.0.0-b90-centos-x86_64/postgres/bin/postgres -D /mnt/d0/pg_data -p 5433 -h 10.231.0.73 -k /tmp/.yb.10.231.0.73:5433 ->
├─ 75446 postgres: logger
├─ 75448 postgres: YSQL webserver
├─ 75450 postgres: checkpointer
├─ 75451 postgres: stats collector
├─579117 postgres: postgres postgres 10.231.0.69(33450) authentication
├─579127 postgres: postgres postgres 10.231.0.69(33464) authentication
├─579138 postgres: postgres postgres 10.231.0.69(33478) authentication
├─579152 postgres: postgres postgres 10.231.0.69(46462) authentication
├─579167 postgres: postgres postgres 10.231.0.69(46476) authentication
├─579184 postgres: postgres postgres 10.231.0.69(50924) authentication
└─579200 postgres: postgres postgres 10.231.0.69(50926) authentication
3. Commands to stop, start, and re-start services
systemctl --user stop yb-master
systemctl --user stop yb-tserver
systemctl --user start yb-master
systemctl --user start yb-tserver
systemctl --user restart yb-master
systemctl --user restart yb-tserver
Comments
0 comments
Please sign in to leave a comment.