This document describes the operation mode of the TuGraph service, starting, stopping, and restarting operations.
The operation mode
TuGraph can be started as a normal process in the foreground or as a daemon in the background.
When running as a normal process, TuGraph can print logs directly to the terminal, which is handy when debugging server configurations. However, because the foreground process is terminated after the terminal exits, the user must ensure that the terminal remains open while the TuGraph server is running. In daemon mode, on the other hand, the TuGraph server can continue to run even if the terminal that started it exits. If TuGraph needs to run for a long time, it is recommended to start the TuGraph server in daemon mode.
Running a normal process
The 'lgraph_server -d run' command runs TuGraph as a normal process. Normal processes depend on the command line terminal, so when the terminal ends, the TuGraph process is automatically terminated. Normal process mode with '--log_dir ""' can output the process log directly to the terminal, so it is easier to debug.
Start the command:
$ ./lgraph_server -c lgraph_standalone.json --log_dir ""
Example of running output in normal mode:
20200508120723.039: **********************************************************************
20200508120723.039: * TuGraph Graph Database v3.1.0 *
20200508120723.040: * *
20200508120723.041: * Copyright(C) 2018 Ant Group. All rights reserved. *
20200508120723.041: * *
20200508120723.044: * Licensed host: hostname threads:0, ha:0 *
20200508120723.044: **********************************************************************
20200508120723.044: Server is configured with the following parameters:
20200508120723.045: data directory: ./lgraph_db
20200508120723.045: license: ./fma.lic
20200508120723.046: enable ha: 0
20200508120723.046: async: 0
20200508120723.047: host: 127.0.0.1
20200508120723.047: REST port: 7071
20200508120723.048: RPC port: 9091
20200508120723.048: enable rpc: 0
20200508120723.051: optimistic txn: 0
20200508120723.059: verbose: 1
20200508120723.074: log_dir:
20200508120723.074: ssl_auth: 0
20200508120723.075: resource dir: ./resource
20200508120723.077: Loading DB state from disk
20200508120723.110: [RestServer] Listening for REST on port 7090
20200508120723.110: [LGraphService] Server started.
In normal process mode, the user can prematurely terminate the TuGraph process by pressing 'CTRL+C'.
Run process daemon mode
Start the command:
$ ./lgraph_server -d start -c lgraph_daemon.json
Example output from running in daemon mode:
Starting lgraph...
The service process is started at pid 12109.
The TuGraph server process started by this command is a daemon process that loads the relevant configuration from the file 'lgraph_daemon.json'. After the server starts, it will start printing logs in a log file that can then be used to determine the status of the server.
Service operation
Start the service
TuGraph needs to be started using the 'lgraph_server -d start' command line. The following is an example of the command to start TuGraph:
$ ./lgraph_server -d start -c lgraph_daemon.json
Starting lgraph...
The service process is started at pid 12109.
The TuGraph server process started by this command is a daemon process that loads the relevant configuration from the file 'lgraph_daemon.json'. After the server starts, it will start printing logs in a log file that can then be used to determine the status of the server.
Stop the service
You can stop the TuGraph daemon using the 'kill' command and the 'lgraph_server -d stop' command. Since it is possible to run multiple TuGraph server processes on the same computer, we distinguish between the different server processes using the '.pid 'file, which is written to the working directory where the process was started. Therefore, you need to run the command 'lgraph_server-d stop' in the same working directory to stop the correct server process.
user@host:~/tugraph$ ./lgraph_server -d start -c lgraph_standalone.json
20200508122306.378: Starting lgraph...
20200508122306.379: The service process is started at pid 93.
user@host:~/tugraph$ cat ./lgraph.pid
93
user@host:~/tugraph$ ./lgraph_server -d stop -c lgraph_standalone.json
20200508122334.857: Stopping lgraph...
20200508122334.857: Process stopped.
Restart the service
Users can also restart the TuGraph service by 'lgraph_server -d restart' :
$ ./lgraph_server -d restart
Stopping lgraph...
Process stopped.
Starting lgraph...
The service process is started at pid 20899.