Step 2: Manage NebulaGraph Service¶
NebulaGraph supports managing services with scripts.
Enterpriseonly
You can also manage NebulaGraph with systemd in the NebulaGraph Enterprise Edition.
Danger
The two methods are incompatible. It is recommended to use only one method in a cluster.
Manage services with script¶
You can use the nebula.service script to start, stop, restart, terminate, and check the NebulaGraph services.
Note
nebula.service is stored in the /usr/local/nebula/scripts directory by default. If you have customized the path, use the actual path in your environment.
Syntax¶
$ sudo /usr/local/nebula/scripts/nebula.service
[-v] [-c <config_file_path>]
<start | stop | restart | kill | status>
<metad | graphd | storaged | all>
| Parameter | Description |
|---|---|
-v |
Display detailed debugging information. |
-c |
Specify the configuration file path. The default path is /usr/local/nebula/etc/. |
start |
Start the target services. |
stop |
Stop the target services. |
restart |
Restart the target services. |
kill |
Terminate the target services. |
status |
Check the status of the target services. |
metad |
Set the Meta Service as the target service. |
graphd |
Set the Graph Service as the target service. |
storaged |
Set the Storage Service as the target service. |
all |
Set all the NebulaGraph services as the target services. |
Manage services with systemd¶
For easy maintenance, NebulaGraph Enterprise Edition supports managing services with systemd. You can start, stop, restart, and check services with systemctl commands.
Note
- After installing NebulaGraph Enterprise Edition, the
.servicefiles required by systemd are located in theetc/unitpath in the installation directory. NebulaGraph installed with the RPM/DEB package automatically places the.servicefiles into the path/usr/lib/systemd/systemand the parameterExecStartis generated based on the specified NebulaGraph installation path, so you can usesystemctlcommands directly.
- The
systemctlcommands cannot be used to manage the Enterprise Edition cluster that is created with Dashboard of the Enterprise Edition.
- Otherwise, users need to move the
.servicefiles manually into the directory/usr/lib/systemd/system, and modify the file path of the parameterExecStartin the.servicefiles.
Syntax¶
$ systemctl <start | stop | restart | status > <nebula | nebula-metad | nebula-graphd | nebula-storaged>
| Parameter | Description |
|---|---|
start |
Start the target services. |
stop |
Stop the target services. |
restart |
Restart the target services. |
status |
Check the status of the target services. |
nebula |
Set all the NebulaGraph services as the target services. |
nebula-metad |
Set the Meta Service as the target service. |
nebula-graphd |
Set the Graph Service as the target service. |
nebula-storaged |
Set the Storage Service as the target service. |
Start NebulaGraph¶
Run the following command to start NebulaGraph.
$ sudo /usr/local/nebula/scripts/nebula.service start all
[INFO] Starting nebula-metad...
[INFO] Done
[INFO] Starting nebula-graphd...
[INFO] Done
[INFO] Starting nebula-storaged...
[INFO] Done
Users can also run the following command:
$ systemctl start nebula
If users want to automatically start NebulaGraph when the machine starts, run the following command:
$ systemctl enable nebula
Stop NebulaGraph¶
Danger
Do not run kill -9 to forcibly terminate the processes. Otherwise, there is a low probability of data loss.
Run the following command to stop NebulaGraph.
$ sudo /usr/local/nebula/scripts/nebula.service stop all
[INFO] Stopping nebula-metad...
[INFO] Done
[INFO] Stopping nebula-graphd...
[INFO] Done
[INFO] Stopping nebula-storaged...
[INFO] Done
Users can also run the following command:
$ systemctl stop nebula
Check the service status¶
Run the following command to check the service status of NebulaGraph.
$ sudo /usr/local/nebula/scripts/nebula.service status all
-
NebulaGraph is running normally if the following information is returned.
INFO] nebula-metad(33fd35e): Running as 29020, Listening on 9559 [INFO] nebula-graphd(33fd35e): Running as 29095, Listening on 9669 [WARN] nebula-storaged after v3.0.0 will not start service until it is added to cluster. [WARN] See Manage Storage hosts:ADD HOSTS in https://docs.nebula-graph.io/ [INFO] nebula-storaged(33fd35e): Running as 29147, Listening on 9779Note
After starting NebulaGraph, the port of the
nebula-storagedprocess is shown in red. Because thenebula-storagedprocess waits for thenebula-metadto add the current Storage service during the startup process. The Storage works after it receives the ready signal. Starting from NebulaGraph 3.0.0, the Meta service cannot directly read or write data in the Storage service that you add in the configuration file. The configuration file only registers the Storage service to the Meta service. You must run theADD HOSTScommand to enable the Meta to read and write data in the Storage service. For more information, see Manage Storage hosts.
- If the returned result is similar to the following one, there is a problem. You may also go to the NebulaGraph community for help.
[INFO] nebula-metad: Running as 25600, Listening on 9559 [INFO] nebula-graphd: Exited [INFO] nebula-storaged: Running as 25646, Listening on 9779
Users can also run the following command:
$ systemctl status nebula
● nebula.service
Loaded: loaded (/usr/lib/systemd/system/nebula.service; disabled; vendor preset: disabled)
Active: active (exited) since 一 2022-03-28 04:13:24 UTC; 1h 47min ago
Process: 21772 ExecStart=/usr/local/ent-nightly/scripts/nebula.service start all (code=exited, status=0/SUCCESS)
Main PID: 21772 (code=exited, status=0/SUCCESS)
Tasks: 325
Memory: 424.5M
CGroup: /system.slice/nebula.service
├─21789 /usr/local/ent-nightly/bin/nebula-metad --flagfile /usr/local/ent-nightly/etc/nebula-metad.conf
├─21827 /usr/local/ent-nightly/bin/nebula-graphd --flagfile /usr/local/ent-nightly/etc/nebula-graphd.conf
└─21900 /usr/local/ent-nightly/bin/nebula-storaged --flagfile /usr/local/ent-nightly/etc/nebula-storaged.conf
3月 28 04:13:24 xxxxxx systemd[1]: Started nebula.service.
...
The NebulaGraph services consist of the Meta Service, Graph Service, and Storage Service. The configuration files for all three services are stored in the /usr/local/nebula/etc/ directory by default. You can check the configuration files according to the returned result to troubleshoot problems.