ubuntu 错误:处理时遇到错误:redis-server

Beh*_*uli 5 process redis

我运行时出错 sudo apt-get upgrade

输出错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up redis-server (5:4.0.9-1) ...
dpkg-statoverride: error: user 'redis' does not exist
dpkg: error processing package redis-server (--configure):
 installed redis-server package post-installation script subprocess returned error exit status 2

Errors were encountered while processing:
 redis-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

关于 redis-server 的错误,无法删除 redis-server。

我的 linux 是 ubuntu 18 桌面。

小智 5

您可能应该更改 redis.conf 文件以强制它使用 IPv4(如果它仅支持该模式),然后也许您可以在没有 IPv6 的情况下运行它。

nano /etc/redis/redis.conf
Run Code Online (Sandbox Code Playgroud)

::1只需从绑定配置选项中删除IPv6 环回地址即可:

- bind 127.0.0.1 ::1
+ bind 127.0.0.1
Run Code Online (Sandbox Code Playgroud)

现在redis不会尝试使用IPv6网络。

尝试再次安装

apt install redis-server
Run Code Online (Sandbox Code Playgroud)

测试 Redis 实例功能 要测试您的服务是否正常运行,请使用命令行客户端连接到 Redis 服务器:

redis-cli
Run Code Online (Sandbox Code Playgroud)

在随后的提示中,通过键入以下内容来测试连接:

ping 你应该看到:

$ 127.0.0.1:6379> ping
Run Code Online (Sandbox Code Playgroud)

输出

PONG
Run Code Online (Sandbox Code Playgroud)

检查您是否可以通过键入以下内容来设置键:

$ 127.0.0.1:6379> set test "It's working!"
Run Code Online (Sandbox Code Playgroud)

输出

OK
Run Code Online (Sandbox Code Playgroud)

现在,通过键入以下内容检索值:

$ 127.0.0.1:6379> get test
Run Code Online (Sandbox Code Playgroud)

您应该能够检索我们存储的值:

输出

$ 127.0.0.1:6379>“工作正常!”

退出 Redis 提示符以返回 shell:

127.0.0.1:6379> exit
Run Code Online (Sandbox Code Playgroud)

作为最后的测试,让我们重新启动 Redis 实例:

$ sudo systemctl restart redis
Run Code Online (Sandbox Code Playgroud)