Created
August 9, 2023 06:18
-
-
Save sunny352/ff95bd60d2999e030e3b808b57cb4dca to your computer and use it in GitHub Desktop.
HOST_IP=replace_with_your_ip REDIS_PASS=redis_password docker-compose up -d
This file contains 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' | |
services: | |
redis-0: | |
image: redis:6.2-bullseye | |
command: redis-server --cluster-enabled yes --port 7000 --requirepass "${REDIS_PASS}" --masterauth "${REDIS_PASS}" | |
ports: | |
- "7000:7000" | |
- "17000:17000" | |
expose: | |
- "7000" | |
- "17000" | |
network_mode: host | |
restart: always | |
environment: | |
TZ: "Asia/Shanghai" | |
redis-1: | |
image: redis:6.2-bullseye | |
command: redis-server --cluster-enabled yes --port 7001 --requirepass "${REDIS_PASS}" --masterauth "${REDIS_PASS}" | |
ports: | |
- "7001:7001" | |
- "17001:17001" | |
expose: | |
- "7001" | |
- "17001" | |
network_mode: host | |
restart: always | |
environment: | |
TZ: "Asia/Shanghai" | |
redis-2: | |
image: redis:6.2-bullseye | |
command: redis-server --cluster-enabled yes --port 7002 --requirepass "${REDIS_PASS}" --masterauth "${REDIS_PASS}" | |
ports: | |
- "7002:7002" | |
- "17002:17002" | |
expose: | |
- "7002" | |
- "17002" | |
network_mode: host | |
restart: always | |
environment: | |
TZ: "Asia/Shanghai" | |
redis-3: | |
image: redis:6.2-bullseye | |
command: redis-server --cluster-enabled yes --port 7003 --requirepass "${REDIS_PASS}" --masterauth "${REDIS_PASS}" | |
ports: | |
- "7003:7003" | |
- "17003:17003" | |
expose: | |
- "7003" | |
- "17003" | |
network_mode: host | |
restart: always | |
environment: | |
TZ: "Asia/Shanghai" | |
redis-4: | |
image: redis:6.2-bullseye | |
command: redis-server --cluster-enabled yes --port 7004 --requirepass "${REDIS_PASS}" --masterauth "${REDIS_PASS}" | |
ports: | |
- "7004:7004" | |
- "17004:17004" | |
expose: | |
- "7004" | |
- "17004" | |
network_mode: host | |
restart: always | |
environment: | |
TZ: "Asia/Shanghai" | |
redis-5: | |
image: redis:6.2-bullseye | |
command: redis-server --cluster-enabled yes --port 7005 --requirepass "${REDIS_PASS}" --masterauth "${REDIS_PASS}" | |
ports: | |
- "7005:7005" | |
- "17005:17005" | |
expose: | |
- "7005" | |
- "17005" | |
network_mode: host | |
restart: always | |
environment: | |
TZ: "Asia/Shanghai" | |
redis-cli: | |
image: redis:6.2-bullseye | |
command: redis-cli --cluster create --cluster-replicas 1 -a ${REDIS_PASS} --cluster-yes ${HOST_IP}:7000 ${HOST_IP}:7001 ${HOST_IP}:7002 ${HOST_IP}:7003 ${HOST_IP}:7004 ${HOST_IP}:7005 | |
restart: "no" | |
environment: | |
TZ: "Asia/Shanghai" | |
depends_on: | |
- redis-0 | |
- redis-1 | |
- redis-2 | |
- redis-3 | |
- redis-4 | |
- redis-5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment