欢迎访问 OceanBase 官网获取更多信息:https://www.oceanbase.com/
此文档主要描述 TuGraph 服务的运行模式、启动、停止和重启的操作。
运行模式
TuGraph 可以作为前台普通进程启动,也可以作为后台守护进程启动。 当作为普通进程运行时,TuGraph 可以直接将日志打印到终端,这在调试服务器配置时非常方便。但是,由于前台进程在终端退出后被终止,因此用户须确保在 TuGraph 服务器处于运行状态时,终端保持打开状态。另一方面,在守护进程模式下,即使启动它的终端退出,TuGraph 服务器也可以继续运行。因此,在长时间运行的服务器下推荐以守护进程模式启动 TuGraph 服务器。
运行普通进程
lgraph_server -d run
命令可以将 TuGraph 作为普通进程运行。普通进程依赖命令行终端,因此终端结束时,TuGraph 进程也会自动终止。普通进程模式配合--log_dir ""
可以将进程日志直接输出到终端,因此更方便调试。
启动命令:
$ ./lgraph_server -c lgraph_standalone.json --log_dir ""
复制
普通模式的运行输出示例:
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.
复制
普通进程模式下,用户可以通过按 CTRL+C
来提前终止 TuGraph 进程。
运行进程守护模式
启动命令:
$ ./lgraph_server -d start -c lgraph_daemon.json
复制
守护模式的运行输出示例:
Starting lgraph... The service process is started at pid 12109.
复制
此命令启动的 TuGraph 服务器进程为守护进程,它将从文件lgraph_daemon.json
加载相关配置。服务器启动后,它将开始在日志文件中打印日志,之后可用该日志文件确定服务器的状态。
服务操作
启动服务
TuGraph 需要通过 lgraph_server -d start
命令行启动,启动命令示例如下:
$ ./lgraph_server -d start -c lgraph_daemon.json Starting lgraph... The service process is started at pid 12109.
复制
此命令启动的 TuGraph 服务器进程为守护进程,它将从文件lgraph_daemon.json
加载相关配置。服务器启动后,它将开始在日志文件中打印日志,之后可用该日志文件确定服务器的状态。
停止服务
用户可以使用kill
命令以及lgraph_server -d stop
命令停止 TuGraph 守护进程。由于可能在同一台计算机上运行多个 TuGraph 服务器进程,因此我们使用.pid
文件区分不同的服务器进程,该文件写入启动该进程的工作目录。因此,需要在相同工作目录中运行lgraph_server-d stop
命令,以停止正确的服务器进程。
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.
复制
重启服务
用户也可以通过lgraph_server -d restart
来重启 TuGraph 服务:
$ ./lgraph_server -d restart Stopping lgraph... Process stopped. Starting lgraph... The service process is started at pid 20899.
复制
欢迎访问 OceanBase 官网获取更多信息:https://www.oceanbase.com/