「Redis」- 常见问题处理

[Sol] READONLY You can’t write against a read only replica.

READONLY You can’t write against a read only replica. · Issue #1643 · go-redis/redis · GitHub

问题描述:执行 SET 命令,提示 READONLY You can’t write against a read only replica. 信息;

原因分析:在我们场景,Redis 单实例,无主从。从 INFO 中,我们看到当前节点的 ROLE 为 Slave 角色。我们猜测是有人调整主从关系而引发的错误。

解决方案:redis-cli -h 127.0.0.1 -p 6379 slaveof no one

[Sol] Fatal: Can’t initialize Background Jobs

Redis: Fatal: Can’t initialize Background Jobs – Feedback & Bug Reports – CircleCI Discuss
docker redis:6.0 run error: Fatal: Can’t initialize Background Jobs. · Issue #12364 · redis/redis

# docker run --ulimit nofile=1024000:1024000 redis:7.0
1:C 13 Dec 2023 02:20:26.744 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 13 Dec 2023 02:20:26.745 # Redis version=7.0.14, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 13 Dec 2023 02:20:26.745 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 13 Dec 2023 02:20:26.745 * monotonic clock: POSIX clock_gettime
1:M 13 Dec 2023 02:20:26.746 * Running mode=standalone, port=6379.
1:M 13 Dec 2023 02:20:26.746 # Server initialized
1:M 13 Dec 2023 02:20:26.746 # Fatal: Can't initialize Background Jobs.

更换镜像,使用 7.0.0, 7.0.10, 6.2.6 都能成功运行。