要修改Redis哨兵模式的端口,需要在redis.conf配置文件中进行修改。以下是修改端口的步骤:

  1. 打开redis.conf配置文件,可以使用命令:sudo vi /etc/redis/redis.conf

  2. 找到以下两行:

# The port that Redis Sentinel will run on. Note that the default
# Sentinel port number is 26379.
sentinel port 26379
  1. 将“sentinel port”后面的端口号26379修改为所需的端口号,例如:sentinel port 16379

  2. 保存修改后的redis.conf文件并退出编辑器。

  3. 重启Redis服务,可以使用以下命令:

sudo systemctl restart redis-server.service
  1. 确认修改是否生效,可以使用以下命令查看Redis哨兵模式的端口号:
redis-cli info Sentinel

在返回的信息中,可以看到“sentinel_port”的值已经被修改为新的端口号

redis哨兵模式修改端口

原文地址: https://www.cveoy.top/t/topic/eQOr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录