redis-server就可以运行
systemctl start redis.service
一用上面的就报错
host ~]# systemctl start redis.service
Job for redis.service failed because the control process exited with error code. See "systemctl status redis.service" and "journalctl -xe" for details.
下面是错误的细节
[root@localhost ~]# systemctl status redis.service
● redis.service - redis-server
Loaded: loaded (/etc/systemd/system/redis.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
└─limit.conf, override.conf
Active: failed (Result: exit-code) since Sun 2023-05-21 23:31:24 CST; 28s ago
Process: 2801 ExecStart=/usr/bin/redis-server ~/Documents/redis-6.2.6/redis.conf (code=exited, status=1/FAILURE)
May 21 23:31:24 localhost.localdomain systemd[1]: Starting redis-ser...
May 21 23:31:24 localhost.localdomain redis-server[2801]: 2801:C 21 ...
May 21 23:31:24 localhost.localdomain systemd[1]: redis.service: con...
May 21 23:31:24 localhost.localdomain systemd[1]: Failed to start re...
May 21 23:31:24 localhost.localdomain systemd[1]: Unit redis.service...
May 21 23:31:24 localhost.localdomain systemd[1]: redis.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
下面是另外的日志
[root@localhost ~]# journalctl -xe
-- Subject: Unit redis.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis.service has begun starting up.
May 21 23:31:24 localhost.localdomain redis-server[2801]: 2801:C 21 May
May 21 23:31:24 localhost.localdomain systemd[1]: redis.service: contro
May 21 23:31:24 localhost.localdomain systemd[1]: Failed to start redis
-- Subject: Unit redis.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis.service has failed.
--
-- The result is failed.
May 21 23:31:24 localhost.localdomain systemd[1]: Unit redis.service en
May 21 23:31:24 localhost.localdomain systemd[1]: redis.service failed.
May 21 23:31:24 localhost.localdomain polkitd[701]: Unregistered Authen
lines 2611-2628/2628 (END)
下面是我系统文件的细节
[Unit]
Description=redis-server
After=network.target
After=network-online.target #增加
Wants=network-online.target #增加
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /root/Documents/redis-6.2.6/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
~