Redis使用——低版本不支持SSUBSCRIBE问题的解决 & 守护线程daemonize初步

在这里插入图片描述

前言

最近在使用redis的使用,报了一个错,ERR unknown command SSUBSCRIBE,后来发现是redis版本的问题。这个似乎是redis的发布订阅模式相关的配置。

引出


1.低版本不支持SSUBSCRIBE的问题描述;
2.redis的守护线程daemonize初步理解;

低版本不支持SSUBSCRIBE

报错unknown command SSUBSCRIBE

ERR unknown command `SSUBSCRIBE`, with args beginning with: `test_upgrade_request_topic`

在这里插入图片描述

官方网站:

https://redis.io/commands/ssubscribe/

在这里插入图片描述

检查docker版本

在这里插入图片描述

拉取指定的docker版本

 docker pull redis:7.2.0

在这里插入图片描述

redis的守护线程daemonize

配置文件

https://redis.io/docs/management/config/

配置文件:

  1. bind 0.0.0.0
  2. appendonly yes
  3. daemonize yes
  4. notify-keyspace-events “Ex”
WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

sysctl vm.overcommit_memory=1

daemonize 守护进程

默认情况下,Redis不作为守护进程运行。如果需要,请使用“是”。

请注意,Redis在守护进程时会在/var/run/Redis.pid中写入一个pid文件。

redis采用的是单进程多线程的模式。当redis.conf中选项daemonize设置成yes时,代表开启守护进程模式。在该模式下,redis会在后台运行,并将进程pid号写入至redis.conf选项pidfile设置的文件中,此时redis将一直运行,除非手动kill该进程。

https://blog.csdn.net/houhj168/article/details/109481166


总结

1.低版本不支持SSUBSCRIBE的问题描述;
2.redis的守护线程daemonize初步理解;

猜你喜欢

转载自blog.csdn.net/Pireley/article/details/134982928