Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created May 15, 2023 09:30
Show Gist options
  • Save guitarrapc/2c6625acfab1c771f1543d917e3a6dd9 to your computer and use it in GitHub Desktop.
Save guitarrapc/2c6625acfab1c771f1543d917e3a6dd9 to your computer and use it in GitHub Desktop.
Reids Cluster on docker

Subscribe

docker compose exec redis /bin/bash
redis-cli -h redis-node-5 -a bitnami -c
> ssubscribe sfoo
> ssubscribe sbar

Publish

docker compose exec redis /bin/bash
redis-cli -h redis-node-5 -a bitnami -c
> spublish sfoo 1
> spublish sbar 1
services:
redis-node-0:
image: docker.io/bitnami/redis-cluster:7.0
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-node-1:
image: docker.io/bitnami/redis-cluster:7.0
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-node-2:
image: docker.io/bitnami/redis-cluster:7.0
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-node-3:
image: docker.io/bitnami/redis-cluster:7.0
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-node-4:
image: docker.io/bitnami/redis-cluster:7.0
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-node-5:
image: docker.io/bitnami/redis-cluster:7.0
depends_on:
- redis-node-0
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4
environment:
- 'REDIS_PASSWORD=bitnami'
- 'REDISCLI_AUTH=bitnami'
- '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'
ports:
- 6379:6379
redis:
image: bitnami/redis:7.0
environment:
- ALLOW_EMPTY_PASSWORD=yes
docker compose up
@guitarrapc
Copy link
Author

StackExchange.Redis is not yet support Shared Pub/Sub commands.

StackExchange/StackExchange.Redis#2055

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment