Redis cluster proxy 解决方法

本文探讨了Redis Cluster在Docker环境下遇到的问题及其解决方案,包括如何通过使用Docker的host网络模式来确保兼容性,以及针对特定配置问题如NAT环境下的地址映射和端口偏移提供的调整建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


Redis Cluster and Docker

Currently Redis Cluster does not support NATted environments and in general environments where IP addresses or TCP ports are remapped.

Docker uses a technique called port mapping: programs running inside Docker containers may be exposed with a different port compared to the one the program believes to be using. This is useful in order to run multiple containers using the same ports, at the same time, in the same server.

In order to make Docker compatible with Redis Cluster you need to use the host networking mode of Docker. Please check the --net=host option in the Docker documentation for more information.

Redis 集群不支持nat转换的ip访问

其实可以这样处理

第一步:使用nat创建集群

第二步:停止redis cluster

第三步:修改每个节点的 node.conf 里面myself地址为nat地址

 

Redis cluster偏移量10000的解决方式

修改cluster.h里面的#define CLUSTER_PORT_INCR 10000

#define CLUSTER_PORT_INCR xxxx你想偏移多少偏移多少

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值