使用 redis 进行一些小小尝试。redis 发出的错误相当不明确...
当我这样做时,journalctl -xe
我得到:
-- The process' exit code is 'exited' and its exit status is 1.
Nov 05 20:53:34 servername systemd[1]: redis-server.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit redis-server.service has entered the 'failed' state with result 'exit-code'.
Nov 05 20:53:34 servername systemd[1]: Failed to start Advanced key-value store.
-- Subject: A start job for unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit redis-server.service has finished with a failure.
--
-- The job identifier is 184424 and the job result is failed.
执行时sudo service redis status
:
sudo service redis status
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2020-11-05 20:53:35 UTC; 11min ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Process: 1468552 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=1/FAILURE)
Nov 05 20:53:35 servername systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 5.
Nov 05 20:53:35 servername systemd[1]: Stopped Advanced key-value store.
Nov 05 20:53:35 servername systemd[1]: redis-server.service: Start request repeated too quickly.
Nov 05 20:53:35 servername systemd[1]: redis-server.service: Failed with result 'exit-code'.
Nov 05 20:53:35 servername systemd[1]: Failed to start Advanced key-value store.
那么如何解决呢?
答案1
因此我开始寻找解决“systemd[1]:无法启动高级键值存储”和“redis-server.service:启动请求重复太快”问题的解决方案。
提供的解决方案似乎都无济于事,也没有任何意义。不过,通过执行以下命令很容易找到问题的真正原因/usr/bin/redis-server /etc/redis/redis.conf
。这检查了配置文件,我得到了以下信息:
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 151
>>> 'supervised yes'
Invalid option for 'supervised'. Allowed values: 'upstart', 'systemd', 'auto', or 'no'
supervised yes
改成之后supervised systemd
一切都变得轻松了。瞧!
最后,是高级时刻的错误将错误的配置添加到了文件。:)
答案2
我在 Ubuntu 上升级 redis-sentinel 后也遇到了类似的问题
我在 /etc/redis/sentinel.conf 中添加了行监督 systemd 并开始工作。