Last active
December 12, 2025 10:07
-
-
Save skarnecki/05aca4a67ad3e78e8400b0b2d098c482 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.9" | |
| services: | |
| redis-cluster-node-1: | |
| image: redis:6.2.0-alpine | |
| container_name: redis-cluster-node-1 | |
| command: | |
| [ | |
| "redis-server", | |
| "--port", "30001", | |
| "--bind", "0.0.0.0", | |
| "--protected-mode", "no", | |
| "--cluster-enabled", "yes", | |
| "--cluster-config-file", "nodes.conf", | |
| "--cluster-node-timeout", "5000", | |
| "--appendonly", "yes", | |
| "--cluster-announce-ip", "192.168.1.20", # your host IP | |
| "--cluster-announce-port", "30001", | |
| "--cluster-announce-bus-port", "40001" | |
| ] | |
| ports: | |
| - "30001:30001" | |
| - "40001:40001" | |
| networks: | |
| - redis-net | |
| redis-cluster-node-2: | |
| image: redis:6.2.0-alpine | |
| container_name: redis-cluster-node-2 | |
| command: | |
| [ | |
| "redis-server", | |
| "--port", "30002", | |
| "--bind", "0.0.0.0", | |
| "--protected-mode", "no", | |
| "--cluster-enabled", "yes", | |
| "--cluster-config-file", "nodes.conf", | |
| "--cluster-node-timeout", "5000", | |
| "--appendonly", "yes", | |
| "--cluster-announce-ip", "192.168.1.20", | |
| "--cluster-announce-port", "30002", | |
| "--cluster-announce-bus-port", "40002" | |
| ] | |
| ports: | |
| - "30002:30002" | |
| - "40002:40002" | |
| networks: | |
| - redis-net | |
| redis-cluster-node-3: | |
| image: redis:6.2.0-alpine | |
| container_name: redis-cluster-node-3 | |
| command: | |
| [ | |
| "redis-server", | |
| "--port", "30003", | |
| "--bind", "0.0.0.0", | |
| "--protected-mode", "no", | |
| "--cluster-enabled", "yes", | |
| "--cluster-config-file", "nodes.conf", | |
| "--cluster-node-timeout", "5000", | |
| "--appendonly", "yes", | |
| "--cluster-announce-ip", "192.168.1.20", | |
| "--cluster-announce-port", "30003", | |
| "--cluster-announce-bus-port", "40003" | |
| ] | |
| ports: | |
| - "30003:30003" | |
| - "40003:40003" | |
| networks: | |
| - redis-net | |
| redis-cluster-node-4: | |
| image: redis:6.2.0-alpine | |
| container_name: redis-cluster-node-4 | |
| command: | |
| [ | |
| "redis-server", | |
| "--port", "30004", | |
| "--bind", "0.0.0.0", | |
| "--protected-mode", "no", | |
| "--cluster-enabled", "yes", | |
| "--cluster-config-file", "nodes.conf", | |
| "--cluster-node-timeout", "5000", | |
| "--appendonly", "yes", | |
| "--cluster-announce-ip", "192.168.1.20", | |
| "--cluster-announce-port", "30004", | |
| "--cluster-announce-bus-port", "40004" | |
| ] | |
| ports: | |
| - "30004:30004" | |
| - "40004:40004" | |
| networks: | |
| - redis-net | |
| redis-cluster-node-5: | |
| image: redis:6.2.0-alpine | |
| container_name: redis-cluster-node-5 | |
| command: | |
| [ | |
| "redis-server", | |
| "--port", "30005", | |
| "--bind", "0.0.0.0", | |
| "--protected-mode", "no", | |
| "--cluster-enabled", "yes", | |
| "--cluster-config-file", "nodes.conf", | |
| "--cluster-node-timeout", "5000", | |
| "--appendonly", "yes", | |
| "--cluster-announce-ip", "192.168.1.20", | |
| "--cluster-announce-port", "30005", | |
| "--cluster-announce-bus-port", "40005" | |
| ] | |
| ports: | |
| - "30005:30005" | |
| - "40005:40005" | |
| networks: | |
| - redis-net | |
| redis-cluster-node-6: | |
| image: redis:6.2.0-alpine | |
| container_name: redis-cluster-node-6 | |
| command: | |
| [ | |
| "redis-server", | |
| "--port", "30006", | |
| "--bind", "0.0.0.0", | |
| "--protected-mode", "no", | |
| "--cluster-enabled", "yes", | |
| "--cluster-config-file", "nodes.conf", | |
| "--cluster-node-timeout", "5000", | |
| "--appendonly", "yes", | |
| "--cluster-announce-ip", "192.168.1.20", | |
| "--cluster-announce-port", "30006", | |
| "--cluster-announce-bus-port", "40006" | |
| ] | |
| ports: | |
| - "30006:30006" | |
| - "40006:40006" | |
| networks: | |
| - redis-net | |
| networks: | |
| redis-net: | |
| driver: bridge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node_1_ip=$(getent hosts redis-cluster-node-1 | awk '{ print $1 }') | |
| node_2_ip=$(getent hosts redis-cluster-node-2 | awk '{ print $1 }') | |
| node_3_ip=$(getent hosts redis-cluster-node-3 | awk '{ print $1 }') | |
| node_4_ip=$(getent hosts redis-cluster-node-4 | awk '{ print $1 }') | |
| node_5_ip=$(getent hosts redis-cluster-node-5 | awk '{ print $1 }') | |
| node_6_ip=$(getent hosts redis-cluster-node-6 | awk '{ print $1 }') | |
| redis-cli --cluster create $node_1_ip:30001 $node_2_ip:30002 $node_3_ip:30003 $node_4_ip:30004 $node_5_ip:30005 $node_6_ip:30006 --cluster-replicas 1 --cluster-yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment