Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add systemd #1205

Merged
merged 13 commits into from
Apr 1, 2022
88 changes: 83 additions & 5 deletions docs-2.0/reuse/source_manage-service.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
You can use the `nebula.service` script to start, stop, restart, terminate, and check the Nebula Graph services. This topic takes starting, stopping and checking the Nebula Graph services for examples.
Nebula Graph supports managing services with script or systemd. This topic will describe the two methods in detail.
randomJoe211 marked this conversation as resolved.
Show resolved Hide resolved

`nebula.service` is stored in the `/usr/local/nebula/scripts` directory by default, which is also the default installation path of Nebula Graph. If you have customized the path, use the actual path in your environment.
!!! enterpriseonly

## Syntax
Systemd only available for the Nebula Graph Enterprise Edition.

!!! note

The two methods are incompatible. It is recommended to use only one method at a cluster.
cooper-lzy marked this conversation as resolved.
Show resolved Hide resolved

## Manage services with script

You can use the `nebula.service` script to manage services, including start, stop, restart, terminate, and check the Nebula Graph services.
cooper-lzy marked this conversation as resolved.
Show resolved Hide resolved

!!! note

`nebula.service` is stored in the `/usr/local/nebula/scripts` directory by default, which is also the default installation path of Nebula Graph. If you have customized the path, use the actual path in your environment.

### Syntax

```bash
$ sudo /usr/local/nebula/scripts/nebula.service
[-v] [-c <config_file_path>]
<start|stop|restart|kill|status>
<metad|graphd|storaged|all>
<start | stop | restart | kill | status>
<metad | graphd | storaged | all>
```

|Parameter|Description|
Expand All @@ -25,6 +39,33 @@ $ sudo /usr/local/nebula/scripts/nebula.service
|`storaged`|Set the Storage Service as the target service.|
|`all`|Set all the Nebula Graph services as the target services.|

## Manage services with systemd

For easy maintenance, Nebula Graph supports managing services with systemd. Starting, stopping, restarting, and viewing services with command `systemctl`.
cooper-lzy marked this conversation as resolved.
Show resolved Hide resolved

!!! note

After installing the Nebula Graph, the `.service` files required for systemd are in the directory `etc/unit` of installation directory. The Nebula Graph installed with the RPM/DEB package automatically places the `.service` files into the directory `/usr/lib/systemd/system`, and the parameter `ExecStart` also automatically generated from the specified Nebula Graph installation path, so you can use the command `systemctl` directly.
cooper-lzy marked this conversation as resolved.
Show resolved Hide resolved

Otherwise, users need to move the `.service` files manually into the directory `/usr/lib/systemd/system`, and modify the file path of parameter `ExecStart` in the `.service` files.
cooper-lzy marked this conversation as resolved.
Show resolved Hide resolved

### Syntax

```bash
$ 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 Nebula Graph 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 Nebula Graph

### In non-container environment
Expand All @@ -41,6 +82,18 @@ $ sudo /usr/local/nebula/scripts/nebula.service start all
[INFO] Done
```

Users can also run the following command:

```bash
$ systemctl start nebula
```

If users want to automatically start the Nebula Graph when the machine starts, run the following command:
cooper-lzy marked this conversation as resolved.
Show resolved Hide resolved

```bash
$ systemctl enable nebula
```

### In docker container (deployed with docker-compose)

Run the following command in the `nebula-docker-compose/` directory to start Nebula Graph.
Expand Down Expand Up @@ -80,6 +133,12 @@ $ sudo /usr/local/nebula/scripts/nebula.service stop all
[INFO] Done
```

Users can also run the following command:

```bash
$ systemctl stop nebula
```

### In docker container (deployed with docker-compose)

Run the following command in the `nebula-docker-compose/` directory to stop Nebula Graph.
Expand Down Expand Up @@ -137,6 +196,25 @@ $ sudo /usr/local/nebula/scripts/nebula.service status all
[INFO] nebula-storaged: Running as 25646, Listening on 9779
```

Users can also run the following command:

```bash
$ 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 Nebula Graph 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.

### In docker container (deployed with docker-compose)
Expand Down