使用 systemd 将 OpenObserve 安装为系统服务。
创建 env 文件
/etc/openobserve.env
ZO_ROOT_USER_EMAIL = "root@example.com"ZO_ROOT_USER_PASSWORD = "Complexpass#123"ZO_DATA_DIR = "/data/openobserve"
创建 systemd service 文件
/usr/lib/systemd/system/openobserve.service
[Unit]Description=The OpenObserve serverAfter=syslog.target network-online.target remote-fs.target nss-lookup.targetWants=network-online.target[Service]Type=simpleLimitNOFILE=65535EnvironmentFile=/etc/openobserve.envExecStart=/usr/local/bin/openobserveExecStop=/bin/kill -s QUIT $MAINPIDRestart=on-failure[Install]WantedBy=multi-user.target
注意:
EnvironmentFile 和 ExecStart 应该是配置文件和 openobserve 二进制文件的路径。
开启服务
创建 env 文件和服务文件后,您可以重新加载 systemd 并启用 OpenObserve 服务。
systemctl daemon-reloadsystemctl enable openobserve
然后,您可以使用 systemctl 控制 OpenObserve 作为系统服务。
运行 OpenObserve
systemctl start openobserve
关闭 OpenObserve
systemctl stop openobserve
查看 OpenObserve 的状态
systemctl status openobserve
检查服务健康状态
curl -v http://localhost:5080/healthz
将会得到如下的返回值:
{"status":"ok"}
