15

redis-server 不能在我有 nginx、apache、php 和 mysql 的服务器上工作

是否有任何软件包会导致以下问题

PS:安装 BBB 时出现此错误

https://github.com/bigbluebutton/bbb-install

redis-server.service:控制进程退出,code=exited status=1 无法启动高级键值存储。

--
-- The result is failed.
Apr 05 12:28:44 ns3081715 systemd[1]: redis-server.service: Unit entered failed state.
Apr 05 12:28:44 ns3081715 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Apr 05 12:28:44 ns3081715 systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
Apr 05 12:28:44 ns3081715 systemd[1]: Stopped Advanced key-value store.
-- Subject: Unit redis-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has finished shutting down.
Apr 05 12:28:44 ns3081715 systemd[1]: Starting Advanced key-value store...
-- Subject: Unit redis-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has begun starting up.
Apr 05 12:28:44 ns3081715 run-parts[19223]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example
Apr 05 12:28:44 ns3081715 redis-server[19239]: *** FATAL CONFIG FILE ERROR ***
Apr 05 12:28:44 ns3081715 redis-server[19239]: Reading the configuration file, at line 108
Apr 05 12:28:44 ns3081715 redis-server[19239]: >>> 'logfile /var/log/redis/redis-server.log'
Apr 05 12:28:44 ns3081715 redis-server[19239]: Can't open the log file: Permission denied
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Control process exited, code=exited status=1
Apr 05 12:28:45 ns3081715 systemd[1]: Failed to start Advanced key-value store.
-- Subject: Unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has failed.
--
-- The result is failed.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Unit entered failed state.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
Apr 05 12:28:45 ns3081715 systemd[1]: Stopped Advanced key-value store.
-- Subject: Unit redis-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has finished shutting down.
Apr 05 12:28:45 ns3081715 systemd[1]: Starting Advanced key-value store...
-- Subject: Unit redis-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has begun starting up.
Apr 05 12:28:45 ns3081715 run-parts[19251]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example
Apr 05 12:28:45 ns3081715 redis-server[19270]: *** FATAL CONFIG FILE ERROR ***
Apr 05 12:28:45 ns3081715 redis-server[19270]: Reading the configuration file, at line 108
Apr 05 12:28:45 ns3081715 redis-server[19270]: >>> 'logfile /var/log/redis/redis-server.log'
Apr 05 12:28:45 ns3081715 redis-server[19270]: Can't open the log file: Permission denied
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Control process exited, code=exited status=1
Apr 05 12:28:45 ns3081715 systemd[1]: Failed to start Advanced key-value store.
-- Subject: Unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has failed.
--
-- The result is failed.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Unit entered failed state.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Failed with result 'exit-code'.

其他日志

> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has failed.
> --
> -- The result is failed. Apr 05 12:38:23 ns3081715 systemd[1]: redis-server.service: Unit entered failed state. Apr 05 12:38:23
> ns3081715 systemd[1]: redis-server.service: Failed with result
> 'exit-code'. Apr 05 12:38:23 ns3081715 systemd[1]:
> redis-server.service: Service hold-off time over, scheduling restart.
> Apr 05 12:38:23 ns3081715 systemd[1]: Stopped Advanced key-value
> store.
> -- Subject: Unit redis-server.service has finished shutting down
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has finished shutting down. Apr 05 12:38:23 ns3081715 systemd[1]: Starting Advanced key-value store...
> -- Subject: Unit redis-server.service has begun start-up
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has begun starting up. Apr 05 12:38:23 ns3081715 run-parts[20653]: run-parts: executing
> /etc/redis/redis-server.pre-up.d/00_example Apr 05 12:38:23 ns3081715
> redis-server[20669]: *** FATAL CONFIG FILE ERROR *** Apr 05 12:38:23
> ns3081715 redis-server[20669]: Reading the configuration file, at line
> 108 Apr 05 12:38:23 ns3081715 redis-server[20669]: >>> 'logfile
> /var/log/redis/redis-server.log' Apr 05 12:38:23 ns3081715
> redis-server[20669]: Can't open the log file: Permission denied Apr 05
> 12:38:23 ns3081715 systemd[1]: redis-server.service: Control process
> exited, code=exited status=1 Apr 05 12:38:23 ns3081715 systemd[1]:
> Failed to start Advanced key-value store.
> -- Subject: Unit redis-server.service has failed
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has failed.
> --
> -- The result is failed. Apr 05 12:38:23 ns3081715 systemd[1]: redis-server.service: Unit entered failed state. Apr 05 12:38:23
> ns3081715 systemd[1]: redis-server.service: Failed with result
> 'exit-code'. Apr 05 12:38:23 ns3081715 systemd[1]:
> redis-server.service: Service hold-off time over, scheduling restart.
> Apr 05 12:38:23 ns3081715 systemd[1]: Stopped Advanced key-value
> store.
> -- Subject: Unit redis-server.service has finished shutting down
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has finished shutting down. Apr 05 12:38:23 ns3081715 systemd[1]: redis-server.service: Start request
> repeated too quickly. Apr 05 12:38:23 ns3081715 systemd[1]: Failed to
> start Advanced key-value store.
> -- Subject: Unit redis-server.service has failed
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has failed.
> --
> -- The result is failed. Apr 05 12:38:24 ns3081715 sshd[20498]: Failed password for root from 218.65.30.46 port 47702 ssh2 Apr 05 12:38:24
> ns3081715 sshd[20498]: Received disconnect from 218.65.30.46 port
> 47702:11:  [preauth] Apr 05 12:38:24 ns3081715 sshd[20498]:
> Disconnected from 218.65.30.46 port 47702 [preauth] Apr 05 12:38:24
> ns3081715 sshd[20498]: PAM 2 more authentication failures; logname=
> uid=0 euid=0 tty=ssh ruser= rhost=218.65.30.46  user=root Apr 05
> 12:38:24 ns3081715 sshd[20540]: Failed password for root from
> 217.61.5.246 port 42706 ssh2 Apr 05 12:38:24 ns3081715 sshd[20540]: Received disconnect from 217.61.5.246 port 42706:11: disconnected by
> user [preauth] Apr 05 12:38:24 ns3081715 sshd[20540]: Disconnected
> from 217.61.5.246 port 42706 [preauth] Apr 05 12:38:24 ns3081715
> sshd[20540]: PAM 1 more authentication failure; logname= uid=0 euid=0
> tty=ssh ruser= rhost=217.61.5.246  user=root Apr 05 12:38:25 ns3081715
> sshd[20680]: pam_unix(sshd:auth): authentication failure; logname=
> uid=0 euid=0 tty=ssh ruser= rhost=218.65.30.46  user=root
4

7 回答 7

24

我刚刚从 debian 10.1 软件包存储库中全新安装 redis 5.0.3 时遇到了同样的问题。

对我来说,解决方案是将配置文件(读取)和日志文件(读写)的访问权限授予用户 redis。

chown -R redis:redis /var/log/redis
chmod -R u+rwX,g+rwX,u+rx /var/log/redis

chmod +r /etc/redis/redis.conf
于 2019-10-02T04:39:22.737 回答
19

我在 ubuntu 16.04 上遇到过同样的问题。它发生在更新 redis-server 包之后。

该服务无法启动,但手动运行服务器

 /usr/bin/redis-server /etc/redis/redis.conf

让我们开始吧。

/var/log/redis/redis.log 不会提供有关它的有用信息。

我所做的是(在 ubutu 16.04 上)删除 redis-server 及其所有配置文件

sudo apt-get --purge remove redis-server

/etc/redis 中有一个剩余的文件dumb.rdb,所以为了确定:

sudo rm -rf /etc/redis/dump.rdb

然后重新安装redis-server

sudo apt-get update
sudo apt-get install redis-server

这为我解决了这个问题。

请记住,尽管那只是在我的系统上。显然,redis 服务器无法启动错误可能是由于不同系统上的许多条件造成的,其中一些是例如:

您的里程可能会有所不同。

无论如何尝试重新安装,甚至降级到以前的版本都不会受到伤害:)

编辑:更正了一个错字

于 2019-02-08T10:58:08.663 回答
3

对我来说,解决方案是:

sudo ps aux | grep redis

然后我杀死了redis-serverPID:

sudo kill 7453

最后:

sudo service redis start
于 2021-02-25T23:46:01.070 回答
3

Redis 工作正常,然后我开始收到此错误

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 Mon 2021-07-19 09:43:47 EEST; 10s ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
    Process: 161736 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=1/FAILURE)

然后,我尝试直接运行该命令(该命令在大多数情况下可以显示问题)

/usr/bin/redis-server /etc/redis/redis.conf

原来Redis找不到日志文件

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 171
>>> 'logfile /var/log/redis/redis-server.log'
Can't open the log file: No such file or directory

解决方案很简单:

 sudo mkdir -p  /var/log/redis/ && sudo touch /var/log/redis/redis-server.log && sudo chown redis:redis /var/log/redis/redis-server.log
于 2021-07-19T07:31:32.843 回答
0

更改/etc/redis/redis.conf. 我花了一个晚上才发现系统服务的读写权限不仅取决于文件系统权限,还取决于服务本身的单元文件中授予的权限:

如果您需要将日志文件和数据库重新定位到默认位置之外的某个位置,则需要根据需要调整ReadWriteDirectories指令/lib/systemd/system/redis-server.service

不要忘记跑步systemctl daemon-reload,你应该没问题systemctl start redis-server

如果单元文件被替换,包更新可能会破坏修复。

于 2020-12-17T23:14:55.867 回答
0

更改 redis.conf 对 redis.conf 文件进行以下更改以重新启动 Redis 服务器。通过执行以下命令编辑 redis.conf 文件

纳米 /etc/redis/redis.conf

将行 bind 127.0.0.1::1 更改为 127.0.0.1 将 line supervised no 更改为 spervised systemd

保存更改并关闭文件。下一步是启动 Redis 服务器。执行以下命令以启动 Redis 服务器并为 Redis 服务创建必要的符号链接。

systemctl enable redis-server systemctl daemon-reload

现在一切就绪,您可以通过执行命令 systemctl status redis 检查服务的状态来验证它。

于 2020-05-26T11:02:43.257 回答
0

我不得不运行 redis /usr/bin/redis-server /etc/redis/redis.conf 我说有一个配置错误(错别字..)

我可以修复它,现在它可以工作了

于 2021-10-13T13:06:25.347 回答