Closed bryanxtong closed 1 day ago
docker-compose-redis-cluster.zip docker-compose files
Hi @bryanxtong,
I just made a quick test, changed the default port in the cluster using the default docker-compose.yml file
diff --git a/bitnami/redis-cluster/docker-compose.yml b/bitnami/redis-cluster/docker-compose.yml
index 9f17c63b48f..c5d565367be 100644
--- a/bitnami/redis-cluster/docker-compose.yml
+++ b/bitnami/redis-cluster/docker-compose.yml
@@ -10,6 +10,9 @@ services:
environment:
- 'REDIS_PASSWORD=bitnami'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
+ - REDIS_PORT_NUMBER=6380
+ - REDIS_MASTER_PORT_NUMBER=6380
+ - REDIS_CLUSTER_ANNOUNCE_PORT=6380
redis-node-1:
image: docker.io/bitnami/redis-cluster:7.2
@@ -18,6 +21,9 @@ services:
environment:
- 'REDIS_PASSWORD=bitnami'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
+ - REDIS_PORT_NUMBER=6380
+ - REDIS_MASTER_PORT_NUMBER=6380
+ - REDIS_CLUSTER_ANNOUNCE_PORT=6380
redis-node-2:
image: docker.io/bitnami/redis-cluster:7.2
@@ -26,6 +32,9 @@ services:
environment:
- 'REDIS_PASSWORD=bitnami'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
+ - REDIS_PORT_NUMBER=6380
+ - REDIS_MASTER_PORT_NUMBER=6380
+ - REDIS_CLUSTER_ANNOUNCE_PORT=6380
redis-node-3:
image: docker.io/bitnami/redis-cluster:7.2
@@ -34,6 +43,9 @@ services:
environment:
- 'REDIS_PASSWORD=bitnami'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
+ - REDIS_PORT_NUMBER=6380
+ - REDIS_MASTER_PORT_NUMBER=6380
+ - REDIS_CLUSTER_ANNOUNCE_PORT=6380
redis-node-4:
image: docker.io/bitnami/redis-cluster:7.2
@@ -42,6 +54,9 @@ services:
environment:
- 'REDIS_PASSWORD=bitnami'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
+ - REDIS_PORT_NUMBER=6380
+ - REDIS_MASTER_PORT_NUMBER=6380
+ - REDIS_CLUSTER_ANNOUNCE_PORT=6380
redis-node-5:
image: docker.io/bitnami/redis-cluster:7.2
@@ -59,6 +74,9 @@ services:
- 'REDIS_CLUSTER_REPLICAS=1'
- 'REDIS_NODES=redis-node-0 redis-node-1 redis-node-2 redis-node-3 redis-node-4 redis-node-5'
- 'REDIS_CLUSTER_CREATOR=yes'
+ - REDIS_PORT_NUMBER=6380
+ - REDIS_MASTER_PORT_NUMBER=6380
+ - REDIS_CLUSTER_ANNOUNCE_PORT=6380
volumes:
redis-cluster_data-0:
and everything worked as expected
# Replication
role:master
connected_slaves:1
slave0:ip=172.20.0.2,port=6380,state=online,offset=280,lag=1
Could you please take a look at this?
Yes, if all the container shares the same port, It works. My problem is that why different ports in different container port doesnot work.
try this version which different ports are set for different containers
Hi @bryanxtong,
I'm afraid that that configuration is not supported in the solution. Would like to contribute? You can follow our contributing guidelines and improve the solution based on your needs. Our team will be more than happy to review the changes.
However, I also offer you a "solution", why don't you use the default configuration (port 6379) and expose each container using a different port in the host machine using the ports field? Would that work for you?
Once I used others docker compose for testing redis cluster with different ports and then switch to bitnami later. Ok since It is not an issue,you can close it now.
By configuring the port in REDIS_NODES, I was able to launch the Redis cluster on a different port.
- 'REDIS_NODES=redis-node-0:port0 redis-node-1:port1 redis-node-2:port2 redis-node-3:port3 redis-node-4:port4 redis-node-5:port5'
By configuring the port in REDIS_NODES, I was able to launch the Redis cluster on a different port.
- 'REDIS_NODES=redis-node-0:port0 redis-node-1:port1 redis-node-2:port2 redis-node-3:port3 redis-node-4:port4 redis-node-5:port5'
I tried but It doesnot work, please refer to attachment. docker-compose-diff-port.zip
When you set REDIS_CLUSTER_ANNOUNCE_IP
, REDIS_NODES
must be
REDIS_NODES=192.168.71.4:6380 ...
The REDIS_NODES items should match the result of redis-cli -c -p 6380 cluster nodes
When you set
REDIS_CLUSTER_ANNOUNCE_IP
,REDIS_NODES
must beREDIS_NODES=192.168.71.4:6380 ...
The REDIS_NODES items should match the result of
redis-cli -c -p 6380 cluster nodes
Hi takkyuuplayer,
Thanks for the answer and It is working. I provided the attachment for both hostname(needs hosts file config) and ip for other people who may encounter the same issue and this version supported external access by java.
and now you can help close the ticket.
docker-compose-redis-cluster-working.zip
Br Bryan
Thanks for providing that useful information @takkyuuplayer. It'll be really helpful for all those users who want to use different ports during the deployment
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
Name and Version
bitnami/redis-cluster:7.2
What architecture are you using?
amd64
What steps will reproduce the bug?
With different port mapping, It gives different results and when using all the default redis port 6379 for container, It is working but It doesnot work when using different redis port in different containers, please refer to attached for full files which includes the correct and wrong file, the only difference is the port mapping.
---It is working----
---Not working---
The error is as below
What is the expected behavior?
No response
What do you see instead?
It should create redis cluster successfully whatever port mapping we are using
Additional information
No response