在CentOS 8中設定redis開機自啟動。
redis.service檔案內容:
[Unit]
Description=The redis-server Process Manager
Documentation=https://redis.io/
After=network.target
[Service]
Type=forking
ExecStart=/home/iotedu/webapp/service/redis-5.0.7/src/redis-server /home/iotedu/webapp/service/redis-5.0.7/redis.conf --daemonize no
ExecStop=/home/iotedu/webapp/service/redis-5.0.7/src/redis-cli -h 127.0.0.1 -p 6379 shutdown
PrivateTmp=true
[Install]
WantedBy=multi-user.target
設定好后用systemctl start redis啟動服務,報錯:
Warning: The unit file, source configuration file or drop-ins of redis.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for redis.service failed because the control process exited with error code.
See "systemctl status redis.service" and "journalctl -xe" for details.
用systemctl status redis查看:
redis.service - The redis-server Process Manager
Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2020-05-09 15:21:22 CST; 12s ago
Docs: https://redis.io/
Process: 24847 ExecStart=/home/iotedu/webapp/service/redis-5.0.7/src/redis-server /home/iotedu/webapp/service/redis-5.0.7/redis.conf --daemonize no (code=exited, status=203/EXEC)
Main PID: 12781 (code=exited, status=217/USER)
May 09 15:21:22 localhost.localdomain systemd[1]: Starting The redis-server Process Manager...
May 09 15:21:22 localhost.localdomain systemd[1]: redis.service: Control process exited, code=exited status=203
May 09 15:21:22 localhost.localdomain systemd[1]: redis.service: Failed with result 'exit-code'.
May 09 15:21:22 localhost.localdomain systemd[1]: Failed to start The redis-server Process Manager.
求各位大神指點!
uj5u.com熱心網友回復:
先systemctl daemon-reload在systemctl Start
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/31187.html
標籤:系統維護與使用區
