Giter Site home page Giter Site logo

grokzen / docker-redis-cluster Goto Github PK

View Code? Open in Web Editor NEW
1.4K 37.0 547.0 115 KB

Dockerfile for Redis Cluster (redis 3.0+)

License: MIT License

Shell 42.45% Makefile 6.55% Dockerfile 14.43% Python 36.58%
docker redis redis-cluster database cluster docker-redis-cluster docker-image

docker-redis-cluster's Introduction

docker-redis-cluster

Docker Stars Docker Pulls Build Status

Docker image with redis built and installed from source and a cluster is built.

To find all redis-server releases see them here https://github.com/antirez/redis/releases

Discussions, help, guides

Github have recently released their Discussions feature into beta for more repositories across the github space. This feature is enabled on this repo since a while back.

Becuase we now have this feature, the issues feature will NOT be a place where you can now ask general questions or need simple help with this repo and what it provides.

What can you expect to find in there?

  • A place where you can freely ask any question regarding this repo.
  • Ask questions like how do i do X?
  • General help with problems with this repo
  • Guides written by me or any other contributer with useful examples and ansers to commonly asked questions and how to resolve thos problems.
  • Approved answers to questions marked and promoted by me if help is provided by the community regarding some questions

What this repo and container IS

This repo exists as a resource to make it quick and simple to get a redis cluster up and running with no fuzz or issues with mininal effort. The primary use for this container is to get a cluster up and running in no time that you can use for demo/presentation/development. It is not intended or built for anything else.

I also aim to have every single release of redis that supports a cluster available for use so you can run the exact version you want.

I personally use this to develop redis cluster client code https://github.com/Grokzen/redis-py-cluster

What this repo and container IS NOT

This container that i have built is not supposed to be some kind of production container or one that is used within any environment other than running locally on your machine. It is not ment to be run on kubernetes or in any other prod/stage/test/dev environment as a fully working commponent in that environment. If that works for you and your use-case then awesome. But this container will not change to fit any other primary solution than to be used locally on your machine.

If you are looking for something else or some production quality or kubernetes compatible solution then you are looking in the wrong repo. There is other projects or forks of this repo that is compatible for that situation/solution.

For all other purposes other than what has been stated you are free to fork and/or rebuild this container using it as a template for what you need.

Redis major version support and docker.hub availability

Starting from 2020-04-01 this repo will only support and make available on docker.hub all minor versions in the latest 3 major versions of redis-server software. At this date the tags on docker.hub for major versions 3.0, 3.2 & 4.0, 5.0 will be removed and only 6.0, 6.2, 7.0 will be available to download. This do not mean that you will not be able to build your desired version from this repo but there is no guarantees or support or hacks that will support this out of the box.

Moving forward when a new major release is shipped out, at the first minor release X.Y.1 version of the next major release, all tags from the last supported major version will be removed from docker.hub. This will give some time for the community to adapt and move forward in the versions before the older major version is removed from docker.hub.

This major version schema support follows the same major version support that redis itself use.

Redis instances inside the container

The cluster is 6 redis instances running with 3 master & 3 slaves, one slave for each master. They run on ports 7000 to 7005.

If the flag -e "SENTINEL=true" is passed there are 3 Sentinel nodes running on ports 5000 to 5002 matching cluster's master instances.

This image requires at least Docker version 1.10 but the latest version is recommended.

Important for Mac users

If you are using this container to run a redis cluster on your mac computer, then you need to configure the container to use another IP address for cluster discovery as it can't use the default discovery IP that is hardcoded into the container.

If you are using the docker-compose file to build the container, then you must export a environment variable on your machine before building the container.

# This will make redis do cluster discovery and bind all nodes to ip 127.0.0.1 internally

export REDIS_CLUSTER_IP=0.0.0.0

If you are downloading the container from dockerhub, you must add the internal IP environment variable to your docker run command.

docker run -e "IP=0.0.0.0" -p 7000-7005:7000-7005 grokzen/redis-cluster:latest

Usage

This git repo is using invoke to pull, build, push docker images. You can use it to build your own images if you like.

The invoke scripts in this repo is written only for python 3.7 and above

Install invoke with pip install invoke.

This script will run N num of cpu - 1 parralell tasks based on your version input.

To see available commands run invoke -l in the root folder of this repo. Example

(tmp-615229a94c330b9) ➜  docker-redis-cluster git:(invoke) ✗ invoke -l
"Configured multiprocess pool size: 3
Available tasks:

  build
  list
  pull
  push

Each command is only taking one required positional argument version. Example:

(tmp-615229a94c330b9) ➜  docker-redis-cluster git:(invoke) ✗ invoke build 7.0
...

and it will run the build step on all versions that starts with 6.0.

The only other optional usefull argument is --cpu=N and it will set how many paralell processes will be used. By default you will use n - 1 number of cpu cores that is available on your system. Commands like pull and push aare not very cpu intensive so using a higher number here might speed things up if you have good network bandwidth.

Makefile (legacy)

Makefile still has a few docker-compose commands that can be used

To build your own image run:

make build

To run the container run:

make up

To stop the container run:

make down

To connect to your cluster you can use the redis-cli tool:

redis-cli -c -p 7000

Or the built redis-cli tool inside the container that will connect to the cluster inside the container

make cli

Include sentinel instances

Sentinel instances is not enabled by default.

If running with plain docker send in -e SENTINEL=true.

When running with docker-compose set the environment variable on your system REDIS_USE_SENTINEL=true and start your container.

version: '2'
services:
  redis-cluster:
    ...
  environment:
    SENTINEL: 'true'

Change number of nodes

Be default, it is going to launch 3 masters with 1 slave per master. This is configurable through a number of environment variables:

Environment variable Default
INITIAL_PORT 7000
MASTERS 3
SLAVES_PER_MASTER 1

Therefore, the total number of nodes (NODES) is going to be $MASTERS * ( $SLAVES_PER_MASTER + 1 ) and ports are going to range from $INITIAL_PORT to $INITIAL_PORT + NODES - 1.

At the docker-compose provided by this repository, ports 7000-7050 are already mapped to the hosts'. Either if you need more than 50 nodes in total or if you need to change the initial port number, you should override those values.

Also note that the number of sentinels (if enabled) is the same as the number of masters. The docker-compose file already maps ports 5000-5010 by default. You should also override those values if you have more than 10 masters.

version: '2'
services:
  redis-cluster:
    ...
  environment:
    INITIAL_PORT: 9000,
    MASTERS: 2,
    SLAVES_PER_MASTER: 2

IPv6 support

By default, redis instances will bind and accept requests from any IPv4 network. This is configurable by an environment variable that specifies which address a redis instance will bind to. By using the IPv6 variant :: as counterpart to IPv4s 0.0.0.0 an IPv6 cluster can be created.

Environment variable Default
BIND_ADDRESS 0.0.0.0

Note that Docker also needs to be configured for IPv6 support. Unfortunately Docker does not handle IPv6 NAT so, when acceptable, --network host can be used.

# Example using plain docker
docker run -e "IP=::1" -e "BIND_ADDRESS=::" --network host grokzen/redis-cluster:latest

Build alternative redis versions

For a release to be buildable it needs to be present at this url: http://download.redis.io/releases/

docker build

To build a different redis version use the argument --build-arg argument.

# Example plain docker
docker build --build-arg redis_version=6.0.11 -t grokzen/redis-cluster .

docker-compose

To build a different redis version use the --build-arg argument.

# Example docker-compose
docker-compose build --build-arg "redis_version=6.0.11" redis-cluster

Available tags

The following tags with pre-built images is available on docker-hub.

Latest release in the most recent stable branch will be used as latest version.

  • latest == 7.2.5

Redis 7.4-rc1 version:

  • 7.4-rc1

Redis 7.2.x version:

  • 7.2.5
  • 7.2.4
  • 7.2.3
  • 7.2.2
  • 7.2.1
  • 7.2.0

Redis 7.0.x version:

  • 7.0.15
  • 7.0.14
  • 7.0.13
  • 7.0.12
  • 7.0.11
  • 7.0.10
  • 7.0.9
  • 7.0.8
  • 7.0.7
  • 7.0.6
  • 7.0.5
  • 7.0.4
  • 7.0.3
  • 7.0.2
  • 7.0.1
  • 7.0.0

Redis 6.2.x versions:

  • 6.2.14
  • 6.2.13
  • 6.2.12
  • 6.2.11
  • 6.2.10
  • 6.2.9
  • 6.2.8
  • 6.2.7
  • 6.2.6
  • 6.2.5
  • 6.2.4
  • 6.2.3
  • 6.2.2
  • 6.2.1
  • 6.2.0

Redis 6.0.x versions:

  • 6.0.20
  • 6.0.19
  • 6.0.18
  • 6.0.17
  • 6.0.16
  • 6.0.15
  • 6.0.14
  • 6.0.13
  • 6.0.12
  • 6.0.11
  • 6.0.10
  • 6.0.9
  • 6.0.8
  • 6.0.7
  • 6.0.6
  • 6.0.5
  • 6.0.4
  • 6.0.3
  • 6.0.2
  • 6.0.1
  • 6.0.0

Unavailable major versions

The following major versions is no longer available to be downloaded from docker.hub. You can still build and run them directly from this repo.

  • 5.0
  • 4.0
  • 3.2
  • 3.0

License

This repo is using the MIT LICENSE.

You can find it in the file LICENSE

docker-redis-cluster's People

Contributors

aplescia avatar benoitcharret avatar bjosv avatar cscutcher avatar davefu113 avatar feiyuw avatar ferhatelmas avatar grokzen avatar kosukeohmura avatar lowjoel avatar mtakahashi-ivi avatar oshai avatar pcejrowski avatar tao12345666333 avatar tiagofabre avatar viniciusd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-redis-cluster's Issues

Update makefile to push 4.0.10 release

It looks like 4.0.10 is being built as part of build-4.0 but not pushed to dockerhub as part of push-releases, which may be why it's not present on dockerhub?

On relaunching docker-redis-cluster its fail to rebuild clusters

I need to persist the redis data so i bind outer /mnt/data/ volume , My Docker compose as follows

version: '2'
services:
redis-cluster:
build:
context: .
args:
redis_version: '4.0.8'
hostname: server
volumes:
- /mnt/data/redis-data:/redis-data
- /mnt/logs:/logs
- /etc/localtime:/etc/localtime:ro
ports:
- '7000-7007:7000-7007'

On first fresh launch with command docker-compose build then docker-compose up all things working. If i stop services and relaunch again with command docker-compose up its not working
here the logs

redis-cluster_1 | bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
redis-cluster_1 | >>> Creating cluster
redis-cluster_1 | [ERR] Node 0.0.0.0:7000 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
redis-cluster_1 | ==> /var/log/supervisor/redis-1.log <==
redis-cluster_1 | 57:C 21 Apr 18:35:11.523 # Configuration loaded
redis-cluster_1 | 57:M 21 Apr 18:35:11.526 * No cluster configuration found, I'm fdcae75ea777f7f3359a92858a15cce1c260d1bd
redis-cluster_1 | 57:M 21 Apr 18:35:11.612 * Running mode=cluster, port=7000.
redis-cluster_1 | 57:M 21 Apr 18:35:11.612 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn isset to the lower value of 128.
redis-cluster_1 | 57:M 21 Apr 18:35:11.612 # Server initialized
redis-cluster_1 | 57:M 21 Apr 18:35:11.612 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fixthis issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis-cluster_1 | 57:M 21 Apr 18:35:11.612 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis-cluster_1 | 57:M 21 Apr 18:35:11.612 * DB loaded from append only file: 0.000 seconds
redis-cluster_1 | 57:M 21 Apr 18:35:11.612 # I have keys for unassigned slot 2376. Taking responsibility for it.
redis-cluster_1 | 57:M 21 Apr 18:35:11.720 * Ready to accept connections
redis-cluster_1 |
redis-cluster_1 | ==> /var/log/supervisor/redis-2.log <==
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 * Running mode=cluster, port=7001.
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn isset to the lower value of 128.
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 # Server initialized
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fixthis issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 * DB loaded from append only file: 0.000 seconds
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 # I have keys for unassigned slot 6918. Taking responsibility for it.
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 # I have keys for unassigned slot 6992. Taking responsibility for it.
redis-cluster_1 | 59:M 21 Apr 18:35:11.720 # I have keys for unassigned slot 7735. Taking responsibility for it.
redis-cluster_1 | 59:M 21 Apr 18:35:11.761 * Ready to accept connections
redis-cluster_1 |
redis-cluster_1 | ==> /var/log/supervisor/redis-3.log <==
redis-cluster_1 | 58:C 21 Apr 18:35:11.533 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-cluster_1 | 58:C 21 Apr 18:35:11.534 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=58, just started
redis-cluster_1 | 58:C 21 Apr 18:35:11.534 # Configuration loaded
redis-cluster_1 | 58:M 21 Apr 18:35:11.536 * No cluster configuration found, I'm 10674cb3321573f635bec757aa71f6dd30ee948d
redis-cluster_1 | 58:M 21 Apr 18:35:11.703 * Running mode=cluster, port=7002.
redis-cluster_1 | 58:M 21 Apr 18:35:11.704 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn isset to the lower value of 128.
redis-cluster_1 | 58:M 21 Apr 18:35:11.704 # Server initialized
redis-cluster_1 | 58:M 21 Apr 18:35:11.704 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fixthis issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis-cluster_1 | 58:M 21 Apr 18:35:11.704 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis-cluster_1 | 58:M 21 Apr 18:35:11.704 * Ready to accept connections
redis-cluster_1 |
redis-cluster_1 | ==> /var/log/supervisor/redis-4.log <==
redis-cluster_1 | 54:C 21 Apr 18:35:11.515 # Configuration loaded
redis-cluster_1 | 54:M 21 Apr 18:35:11.517 * No cluster configuration found, I'm 9001f3f99e014fdb8a8478abc8bcc80a9a7d8b5d
redis-cluster_1 | 54:M 21 Apr 18:35:11.612 * Running mode=cluster, port=7003.
redis-cluster_1 | 54:M 21 Apr 18:35:11.612 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn isset to the lower value of 128.
redis-cluster_1 | 54:M 21 Apr 18:35:11.612 # Server initialized
redis-cluster_1 | 54:M 21 Apr 18:35:11.612 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fixthis issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis-cluster_1 | 54:M 21 Apr 18:35:11.612 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis-cluster_1 | 54:M 21 Apr 18:35:11.612 * DB loaded from append only file: 0.000 seconds
redis-cluster_1 | 54:M 21 Apr 18:35:11.612 # I have keys for unassigned slot 2376. Taking responsibility for it.
redis-cluster_1 | 54:M 21 Apr 18:35:11.719 * Ready to accept connections
redis-cluster_1 |
redis-cluster_1 | ==> /var/log/supervisor/redis-5.log <==
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 * Running mode=cluster, port=7004.
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn isset to the lower value of 128.
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 # Server initialized
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fixthis issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 * DB loaded from append only file: 0.000 seconds
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 # I have keys for unassigned slot 6918. Taking responsibility for it.
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 # I have keys for unassigned slot 6992. Taking responsibility for it.
redis-cluster_1 | 53:M 21 Apr 18:35:11.572 # I have keys for unassigned slot 7735. Taking responsibility for it.
redis-cluster_1 | 53:M 21 Apr 18:35:11.703 * Ready to accept connections
redis-cluster_1 |
redis-cluster_1 | ==> /var/log/supervisor/redis-6.log <==
redis-cluster_1 | 56:C 21 Apr 18:35:11.533 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-cluster_1 | 56:C 21 Apr 18:35:11.533 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=56, just started
redis-cluster_1 | 56:C 21 Apr 18:35:11.533 # Configuration loaded
redis-cluster_1 | 56:M 21 Apr 18:35:11.536 * No cluster configuration found, I'm a12500b7294d062ad406817025c9771209967e05
redis-cluster_1 | 56:M 21 Apr 18:35:11.720 * Running mode=cluster, port=7005.
redis-cluster_1 | 56:M 21 Apr 18:35:11.720 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn isset to the lower value of 128.
redis-cluster_1 | 56:M 21 Apr 18:35:11.720 # Server initialized
redis-cluster_1 | 56:M 21 Apr 18:35:11.720 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fixthis issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis-cluster_1 | 56:M 21 Apr 18:35:11.721 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis-cluster_1 | 56:M 21 Apr 18:35:11.721 * Ready to accept connections
redis-cluster_1 |
redis-cluster_1 | ==> /var/log/supervisor/redis-7.log <==
redis-cluster_1 | 55:C 21 Apr 18:35:11.530 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-cluster_1 | 55:C 21 Apr 18:35:11.531 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=55, just started
redis-cluster_1 | 55:C 21 Apr 18:35:11.531 # Configuration loaded
redis-cluster_1 | 55:M 21 Apr 18:35:11.534 * Running mode=standalone, port=7006.
redis-cluster_1 | 55:M 21 Apr 18:35:11.534 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn isset to the lower value of 128.
redis-cluster_1 | 55:M 21 Apr 18:35:11.534 # Server initialized
redis-cluster_1 | 55:M 21 Apr 18:35:11.534 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fixthis issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis-cluster_1 | 55:M 21 Apr 18:35:11.534 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis-cluster_1 | 55:M 21 Apr 18:35:11.534 * Ready to accept connections
redis-cluster_1 |
redis-cluster_1 | ==> /var/log/supervisor/redis-8.log <==
redis-cluster_1 | 60:C 21 Apr 18:35:11.534 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis-cluster_1 | 60:C 21 Apr 18:35:11.534 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=60, just started
redis-cluster_1 | 60:C 21 Apr 18:35:11.534 # Configuration loaded
redis-cluster_1 | 60:M 21 Apr 18:35:11.536 * Running mode=standalone, port=7007.
redis-cluster_1 | 60:M 21 Apr 18:35:11.536 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn isset to the lower value of 128.
redis-cluster_1 | 60:M 21 Apr 18:35:11.536 # Server initialized
redis-cluster_1 | 60:M 21 Apr 18:35:11.536 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fixthis issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis-cluster_1 | 60:M 21 Apr 18:35:11.536 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis-cluster_1 | 60:M 21 Apr 18:35:11.536 * Ready to accept connections

My Cluster Status ::

redis-cli -c -p 7000
127.0.0.1:7003> cluster info
cluster_state:fail
cluster_slots_assigned:1
cluster_slots_ok:1
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:1
cluster_size:1
cluster_current_epoch:0
cluster_my_epoch:0
cluster_stats_messages_sent:0
cluster_stats_messages_received:0

Connection is getting timed out

My client application cannot connect to this redis cluster. It tries on all the nodes but connections gets tied out/
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at redis.clients.jedis.Connection.connect(Connection.java:184)
... 74 common frames omitted

Timeout on redirect to slot

Running the commands in the README does not seem to yield a reachable cluster. I've tried the

docker run -i -t -p 7000:7000 -p 7001:7001 -p 7002:7002 -p 7003:7003 -p 7004:7004 -p 7005:7005 -p 7006:7006 -p 7007:7007

with

  • grokzen/redis-cluster
  • grokzen/redis-cluster:3.0.7
  • newly built image from the master branch

The result is always the same when connecting via redis-cli from the same machine running the container (which is localhost):

redis-cli -c -p 7000
127.0.0.1:7000> set a b
-> Redirected to slot [15495] located at 172.17.0.3:7002
Could not connect to Redis at 172.17.0.3:7002: Operation timed out
Could not connect to Redis at 172.17.0.3:7002: Operation timed out
(150.98s)

All commands seem to work properly from the docker container:

docker exec -it 1c4dbc9e5185 /bin/bash
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
root@1c4dbc9e5185:/data# redis-cli -c -p 7000
127.0.0.1:7000> set a b
-> Redirected to slot [15495] located at 172.17.0.3:7002
OK
172.17.0.3:7002>

Jedis fails to connect to the cluster at all:

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
Caused by: java.net.SocketTimeoutException: connect timed out
Caused by: java.net.SocketTimeoutException: connect timed out

Seems to me I may be missing something obvious, but can't figure out what. Running MAC OS X, Docker 17.03.0-ce-mac1.

P.S.: same result when building & starting using docker compose.
P.P.S.: hardcoding the IP in the entrypoint to 127.0.0.1 is a workaround.

(error) MOVED 13563 127.0.0.1:7002

Hi , please help me !
I trying to setup redis-cluster 4.0.9 on my project , get code from here but has issue
when i connect to 7001 ( redis-cli -p 7001) set mykey then get (error) MOVED 13563 127.0.0.1:7002
i'm using docker-compose
{code}
version: '2'
services:
redis-cluster:
environment:
IP: ${REDIS_CLUSTER_IP}
build:
context: .
args:
redis_version: '4.0.9'
hostname: server
ports:
- '7000-7007:7000-7007'
networks:
- redis

networks:
redis:
driver: bridge
{code}

docker run grokzen/redis-cluster:latest -e "IP=0.0.0.0"

Ciao!
How are you?
How can I enabled to connect to it? If I do not enable binding to 0.0.0.0, i cannot connect, if i add the IP variable i get this:

patrikx3@bitang:~$ docker run grokzen/redis-cluster:latest -e "IP=0.0.0.0"
/docker-entrypoint.sh: 72: exec: -e: not found
patrikx3@bitang:~$

Thanks so much!

is there any way to keep the data?

ciao!

how are you?
do you know if is there a way to keep the data after running the docker stopped and started?

thanks!
(i see there is a /redis-data folder but when i start it, it deletes the data with rm)

problem reaching debian.org

I'm having issues while updating and fetching the packages in container. I did docker-compose up. The logs are


Step 3/24 : ENV HOME /root
 ---> Using cache
 ---> 51358e5d91eb
Step 4/24 : ENV DEBIAN_FRONTEND noninteractive
 ---> Using cache
 ---> 20332ede29cd
Step 5/24 : RUN apt-get update -qq &&     apt-get install --no-install-recommends -yqq       net-tools supervisor ruby rubygems locales gettext-base &&     apt-get clean -yqq
 ---> Running in f83eeab9f040
W: Failed to fetch http://deb.debian.org/debian/dists/jessie/InRelease  

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease  

W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease  

W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg  Could not resolve 'security.debian.org'

W: Failed to fetch http://deb.debian.org/debian/dists/jessie/Release.gpg  Could not resolve 'deb.debian.org'

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/Release.gpg  Could not resolve 'deb.debian.org'

W: Some index files failed to download. They have been ignored, or old ones used instead.
E: Unable to locate package net-tools
E: Unable to locate package supervisor
E: Unable to locate package ruby
E: Unable to locate package rubygems
E: Package 'locales' has no installation candidate
E: Unable to locate package gettext-base
ERROR: Service 'rediscluster' failed to build: The command '/bin/sh -c apt-get update -qq &&     apt-get install --no-install-recommends -yqq       net-tools supervisor ruby rubygems locales gettext-base &&     apt-get clean -yqq' returned a non-zero code: 100

Unable to use from remote machine

It has been found that if you start this docker image on machine A and then trying to connect to the redis instances from machine B then RedisCluster can't talk to all nodes in the cluster becuase CLUSTER SLOTS will tell the client that it should talk to 127.0.0.1 but there is no instance on that IP:PORT.

The one known solution from the client side is to provide the entire clusters IP:PORTs in startup_nodes and set init_slot_cache=False and the client should be able to talk to all nodes.

One solution that can be done in this repo is to remake the repo to work with 6 docker images and connect them externally with so it will connect with the correct IP addresses.

cluster not starting

Error After connecting:
127.0.0.1:7000> GET *
(error) CLUSTERDOWN The cluster is down

docker-compose config
version: '2'
services:
redis-cluster:
environment:
IP: '0.0.0.0'
build:
context: .
args:
redis_version: '4.0.10'
hostname: server
ports:
- '7000-7007:7000-7007'
environment:
CLUSTER_ONLY: 'true'

redis cluster connection timeout or refuse connection

A another server with application would access the redis cluster within docker server.

It is connect timeout without the ENV of IP.

It is refuse connection with the ENV of IP = 0.0.0.0.

It is connect timeout with the ENV of IP = Intranet IP (such as : 127.17.0.2).

The docker server with application would access the redis cluster within docker server.
However, it work well.

How to solve it?

Unable to run on MacOSX

I was able to write/read to the cluster successfully on an EC2 instance running Centos OS. However on a Macbook laptop I can run the cluster but I'm unable to read/write into the cluster.

This is the error I'm getting:

redis-cli -c -p 7000
127.0.0.1:7000> get k
-> Redirected to slot [7629] located at 172.17.0.2:7001
Could not connect to Redis at 172.17.0.2:7001: Operation timed out

compatibility with Swarm

As I understand, this image will run a single container which contains 6 redis instances? So I have 6 instances on one machine? What's the benefit of that?
Or can I use this for Docker Swarm mode - so that I have 6 VMs configured in Docker Swarm mode and run this image over these 6 VMs?

Docker build fails because of incorrect version of Ruby

I tried to build today but with no success.

> docker build --tag redis-cluster:latest .redis-cluster-docker/
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM redis:3.2
3.2: Pulling from library/redis
5233d9aed181: Pull complete 
ca1b33d3f114: Pull complete 
920cdc17d3c2: Pull complete 
039bc0a8c4af: Pull complete 
39d721bfb392: Pull complete 
853085e403eb: Pull complete 
Digest: sha256:848b4fd76a5dacb56988af810a6e86719e313cf4e1186f3d3050384686dbc120
Status: Downloaded newer image for redis:3.2
 ---> c6988031bc47
Step 2 : MAINTAINER Johan Andersson <[email protected]>
 ---> Running in 44fc25ade063
 ---> 9cf4c2e50647
Removing intermediate container 44fc25ade063
Step 3 : ENV HOME /root
 ---> Running in 6ca7f2b6fdac
 ---> 87c9b986d4fc
Removing intermediate container 6ca7f2b6fdac
Step 4 : ENV DEBIAN_FRONTEND noninteractive
 ---> Running in d09cfca6fe83
 ---> c7955ca3f33a
Removing intermediate container d09cfca6fe83
Step 5 : RUN apt-get update -qq &&     apt-get install --no-install-recommends -yqq       net-tools supervisor ruby rubygems locales gettext-base wget &&     apt-get clean -yqq
 ---> Running in c6c4da1654e5
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libgdbm3:amd64.
(Reading database ... 7461 files and directories currently installed.)
Preparing to unpack .../libgdbm3_1.8.3-13.1_amd64.deb ...
Unpacking libgdbm3:amd64 (1.8.3-13.1) ...
Selecting previously unselected package libssl1.0.0:amd64.
Preparing to unpack .../libssl1.0.0_1.0.1t-1+deb8u6_amd64.deb ...
Unpacking libssl1.0.0:amd64 (1.0.1t-1+deb8u6) ...
Selecting previously unselected package libasprintf0c2:amd64.
Preparing to unpack .../libasprintf0c2_0.19.3-2_amd64.deb ...
Unpacking libasprintf0c2:amd64 (0.19.3-2) ...
Selecting previously unselected package libgmp10:amd64.
Preparing to unpack .../libgmp10_2%3a6.0.0+dfsg-6_amd64.deb ...
Unpacking libgmp10:amd64 (2:6.0.0+dfsg-6) ...
Selecting previously unselected package libnettle4:amd64.
Preparing to unpack .../libnettle4_2.7.1-5+deb8u2_amd64.deb ...
Unpacking libnettle4:amd64 (2.7.1-5+deb8u2) ...
Selecting previously unselected package libhogweed2:amd64.
Preparing to unpack .../libhogweed2_2.7.1-5+deb8u2_amd64.deb ...
Unpacking libhogweed2:amd64 (2.7.1-5+deb8u2) ...
Selecting previously unselected package libffi6:amd64.
Preparing to unpack .../libffi6_3.1-2+deb8u1_amd64.deb ...
Unpacking libffi6:amd64 (3.1-2+deb8u1) ...
Selecting previously unselected package libp11-kit0:amd64.
Preparing to unpack .../libp11-kit0_0.20.7-1_amd64.deb ...
Unpacking libp11-kit0:amd64 (0.20.7-1) ...
Selecting previously unselected package libtasn1-6:amd64.
Preparing to unpack .../libtasn1-6_4.2-3+deb8u3_amd64.deb ...
Unpacking libtasn1-6:amd64 (4.2-3+deb8u3) ...
Selecting previously unselected package libgnutls-deb0-28:amd64.
Preparing to unpack .../libgnutls-deb0-28_3.3.8-6+deb8u7_amd64.deb ...
Unpacking libgnutls-deb0-28:amd64 (3.3.8-6+deb8u7) ...
Selecting previously unselected package libidn11:amd64.
Preparing to unpack .../libidn11_1.29-1+deb8u2_amd64.deb ...
Unpacking libidn11:amd64 (1.29-1+deb8u2) ...
Selecting previously unselected package libsqlite3-0:amd64.
Preparing to unpack .../libsqlite3-0_3.8.7.1-1+deb8u2_amd64.deb ...
Unpacking libsqlite3-0:amd64 (3.8.7.1-1+deb8u2) ...
Selecting previously unselected package libpython2.7-minimal:amd64.
Preparing to unpack .../libpython2.7-minimal_2.7.9-2+deb8u1_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.9-2+deb8u1) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.9-2+deb8u1_amd64.deb ...
Unpacking python2.7-minimal (2.7.9-2+deb8u1) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.9-1_amd64.deb ...
Unpacking python-minimal (2.7.9-1) ...
Selecting previously unselected package mime-support.
Preparing to unpack .../mime-support_3.58_all.deb ...
Unpacking mime-support (3.58) ...
Selecting previously unselected package libexpat1:amd64.
Preparing to unpack .../libexpat1_2.1.0-6+deb8u4_amd64.deb ...
Unpacking libexpat1:amd64 (2.1.0-6+deb8u4) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.9-2+deb8u1_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.9-2+deb8u1) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.9-2+deb8u1_amd64.deb ...
Unpacking python2.7 (2.7.9-2+deb8u1) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.9-1_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.9-1) ...
Setting up libpython2.7-minimal:amd64 (2.7.9-2+deb8u1) ...
Setting up python2.7-minimal (2.7.9-2+deb8u1) ...
Setting up python-minimal (2.7.9-1) ...
Selecting previously unselected package python.
(Reading database ... 8361 files and directories currently installed.)
Preparing to unpack .../python_2.7.9-1_amd64.deb ...
Unpacking python (2.7.9-1) ...
Selecting previously unselected package libicu52:amd64.
Preparing to unpack .../libicu52_52.1-8+deb8u5_amd64.deb ...
Unpacking libicu52:amd64 (52.1-8+deb8u5) ...
Selecting previously unselected package libyaml-0-2:amd64.
Preparing to unpack .../libyaml-0-2_0.1.6-3_amd64.deb ...
Unpacking libyaml-0-2:amd64 (0.1.6-3) ...
Selecting previously unselected package net-tools.
Preparing to unpack .../net-tools_1.60-26+b1_amd64.deb ...
Unpacking net-tools (1.60-26+b1) ...
Selecting previously unselected package libpsl0:amd64.
Preparing to unpack .../libpsl0_0.5.1-1_amd64.deb ...
Unpacking libpsl0:amd64 (0.5.1-1) ...
Selecting previously unselected package wget.
Preparing to unpack .../wget_1.16-1+deb8u2_amd64.deb ...
Unpacking wget (1.16-1+deb8u2) ...
Selecting previously unselected package gettext-base.
Preparing to unpack .../gettext-base_0.19.3-2_amd64.deb ...
Unpacking gettext-base (0.19.3-2) ...
Selecting previously unselected package locales.
Preparing to unpack .../locales_2.19-18+deb8u10_all.deb ...
Unpacking locales (2.19-18+deb8u10) ...
Selecting previously unselected package openssl.
Preparing to unpack .../openssl_1.0.1t-1+deb8u6_amd64.deb ...
Unpacking openssl (1.0.1t-1+deb8u6) ...
Selecting previously unselected package ca-certificates.
Preparing to unpack .../ca-certificates_20141019+deb8u3_all.deb ...
Unpacking ca-certificates (20141019+deb8u3) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../python-pkg-resources_5.5.1-1_all.deb ...
Unpacking python-pkg-resources (5.5.1-1) ...
Selecting previously unselected package rubygems-integration.
Preparing to unpack .../rubygems-integration_1.8_all.deb ...
Unpacking rubygems-integration (1.8) ...
Selecting previously unselected package libruby2.1:amd64.
Preparing to unpack .../libruby2.1_2.1.5-2+deb8u3_amd64.deb ...
Unpacking libruby2.1:amd64 (2.1.5-2+deb8u3) ...
Selecting previously unselected package ruby2.1.
Preparing to unpack .../ruby2.1_2.1.5-2+deb8u3_amd64.deb ...
Unpacking ruby2.1 (2.1.5-2+deb8u3) ...
Selecting previously unselected package ruby.
Preparing to unpack .../ruby_1%3a2.1.5+deb8u2_all.deb ...
Unpacking ruby (1:2.1.5+deb8u2) ...
Selecting previously unselected package python-meld3.
Preparing to unpack .../python-meld3_1.0.0-1_amd64.deb ...
Unpacking python-meld3 (1.0.0-1) ...
Selecting previously unselected package supervisor.
Preparing to unpack .../supervisor_3.0r1-1+deb8u1_all.deb ...
Unpacking supervisor (3.0r1-1+deb8u1) ...
Processing triggers for systemd (215-17+deb8u7) ...
Setting up libgdbm3:amd64 (1.8.3-13.1) ...
Setting up libssl1.0.0:amd64 (1.0.1t-1+deb8u6) ...
Setting up libasprintf0c2:amd64 (0.19.3-2) ...
Setting up libgmp10:amd64 (2:6.0.0+dfsg-6) ...
Setting up libnettle4:amd64 (2.7.1-5+deb8u2) ...
Setting up libhogweed2:amd64 (2.7.1-5+deb8u2) ...
Setting up libffi6:amd64 (3.1-2+deb8u1) ...
Setting up libp11-kit0:amd64 (0.20.7-1) ...
Setting up libtasn1-6:amd64 (4.2-3+deb8u3) ...
Setting up libgnutls-deb0-28:amd64 (3.3.8-6+deb8u7) ...
Setting up libidn11:amd64 (1.29-1+deb8u2) ...
Setting up libsqlite3-0:amd64 (3.8.7.1-1+deb8u2) ...
Setting up mime-support (3.58) ...
Setting up libexpat1:amd64 (2.1.0-6+deb8u4) ...
Setting up libpython2.7-stdlib:amd64 (2.7.9-2+deb8u1) ...
Setting up python2.7 (2.7.9-2+deb8u1) ...
Setting up libpython-stdlib:amd64 (2.7.9-1) ...
Setting up python (2.7.9-1) ...
Setting up libicu52:amd64 (52.1-8+deb8u5) ...
Setting up libyaml-0-2:amd64 (0.1.6-3) ...
Setting up net-tools (1.60-26+b1) ...
Setting up libpsl0:amd64 (0.5.1-1) ...
Setting up wget (1.16-1+deb8u2) ...
Setting up gettext-base (0.19.3-2) ...
Setting up locales (2.19-18+deb8u10) ...
Generating locales (this might take a while)...
Generation complete.
Setting up openssl (1.0.1t-1+deb8u6) ...
Setting up ca-certificates (20141019+deb8u3) ...
Updating certificates in /etc/ssl/certs... 174 added, 0 removed; done.
Setting up python-pkg-resources (5.5.1-1) ...
Setting up rubygems-integration (1.8) ...
Setting up libruby2.1:amd64 (2.1.5-2+deb8u3) ...
Setting up ruby2.1 (2.1.5-2+deb8u3) ...
Setting up ruby (1:2.1.5+deb8u2) ...
Setting up python-meld3 (1.0.0-1) ...
Setting up supervisor (3.0r1-1+deb8u1) ...
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for libc-bin (2.19-18+deb8u10) ...
Processing triggers for ca-certificates (20141019+deb8u3) ...
Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
Processing triggers for systemd (215-17+deb8u7) ...
 ---> 2f930113e334
Removing intermediate container c6c4da1654e5
Step 6 : RUN locale-gen en_US.UTF-8
 ---> Running in eeed1bfbf66f
Generating locales (this might take a while)...
Generation complete.
 ---> 67765fd9cca2
Removing intermediate container eeed1bfbf66f
Step 7 : ENV LANG en_US.UTF-8
 ---> Running in 5f56b0788e0e
 ---> 0f4aecf9391d
Removing intermediate container 5f56b0788e0e
Step 8 : ENV LC_ALL en_US.UTF-8
 ---> Running in d88ec2f9983f
 ---> 64e43aeaf778
Removing intermediate container d88ec2f9983f
Step 9 : RUN gem install redis
 ---> Running in 04fef0cb63cd
ERROR:  Error installing redis:
	redis requires Ruby version >= 2.2.2.
The command '/bin/sh -c gem install redis' returned a non-zero code: 1

Starting the container fails randomly

After running $ docker run -it -p 7000:7000 grokzen/redis-cluster to start the container, running $ redis-cli -c -p 7000 set aaa bbb Gives the output:
(error) CLUSTERDOWN Hash slot not served

So far I haven't found any kind of pattern to explain this. I discovered it because my CI tests started failing today

Here's the output of the docker run -it ... command above:

bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
WARNING: redis-trib.rb is not longer available!
You should use redis-cli instead.

All commands and features belonging to redis-trib.rb have been moved
to redis-cli.
In order to use them you should call redis-cli with the --cluster
option followed by the subcommand name, arguments and options.

Use the following syntax:
redis-cli --cluster SUBCOMMAND [ARGUMENTS] [OPTIONS]

Example:
redis-cli --cluster create 172.17.0.2:7000 172.17.0.2:7001 172.17.0.2:7002 172.17.0.2:7003 172.17.0.2:7004 172.17.0.2:7005 --cluster-replicas 1

To get help about all subcommands, type:
redis-cli --cluster help

==> /var/log/supervisor/redis-1.log <==
43:C 24 Oct 2018 17:07:05.964 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
43:C 24 Oct 2018 17:07:05.964 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=43, just started
43:C 24 Oct 2018 17:07:05.964 # Configuration loaded
43:M 24 Oct 2018 17:07:05.966 * No cluster configuration found, I'm db6288c6719aad403741d564c71875058702f983
43:M 24 Oct 2018 17:07:05.978 * Running mode=cluster, port=7000.
43:M 24 Oct 2018 17:07:05.978 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
43:M 24 Oct 2018 17:07:05.978 # Server initialized
43:M 24 Oct 2018 17:07:05.978 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
43:M 24 Oct 2018 17:07:05.978 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
43:M 24 Oct 2018 17:07:05.978 * Ready to accept connections

==> /var/log/supervisor/redis-2.log <==
45:C 24 Oct 2018 17:07:05.968 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
45:C 24 Oct 2018 17:07:05.968 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=45, just started
45:C 24 Oct 2018 17:07:05.968 # Configuration loaded
45:M 24 Oct 2018 17:07:05.969 * No cluster configuration found, I'm f00b0451cdd3c434cf9e9bc152d06537ddd4ded0
45:M 24 Oct 2018 17:07:05.978 * Running mode=cluster, port=7001.
45:M 24 Oct 2018 17:07:05.978 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
45:M 24 Oct 2018 17:07:05.978 # Server initialized
45:M 24 Oct 2018 17:07:05.978 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
45:M 24 Oct 2018 17:07:05.978 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
45:M 24 Oct 2018 17:07:05.978 * Ready to accept connections

==> /var/log/supervisor/redis-3.log <==
44:C 24 Oct 2018 17:07:05.968 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
44:C 24 Oct 2018 17:07:05.968 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=44, just started
44:C 24 Oct 2018 17:07:05.968 # Configuration loaded
44:M 24 Oct 2018 17:07:05.969 * No cluster configuration found, I'm 1364990a69aabdddf47cc0d49d4ff3f503585fd8
44:M 24 Oct 2018 17:07:05.979 * Running mode=cluster, port=7002.
44:M 24 Oct 2018 17:07:05.979 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
44:M 24 Oct 2018 17:07:05.979 # Server initialized
44:M 24 Oct 2018 17:07:05.979 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
44:M 24 Oct 2018 17:07:05.979 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
44:M 24 Oct 2018 17:07:05.979 * Ready to accept connections

==> /var/log/supervisor/redis-4.log <==
41:C 24 Oct 2018 17:07:05.961 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
41:C 24 Oct 2018 17:07:05.961 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=41, just started
41:C 24 Oct 2018 17:07:05.961 # Configuration loaded
41:M 24 Oct 2018 17:07:05.962 * No cluster configuration found, I'm f11db2ec376ac15af46856f6d451755f954ece43
41:M 24 Oct 2018 17:07:05.970 * Running mode=cluster, port=7003.
41:M 24 Oct 2018 17:07:05.970 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
41:M 24 Oct 2018 17:07:05.970 # Server initialized
41:M 24 Oct 2018 17:07:05.970 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
41:M 24 Oct 2018 17:07:05.970 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
41:M 24 Oct 2018 17:07:05.970 * Ready to accept connections

==> /var/log/supervisor/redis-5.log <==
40:C 24 Oct 2018 17:07:05.961 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
40:C 24 Oct 2018 17:07:05.961 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=40, just started
40:C 24 Oct 2018 17:07:05.961 # Configuration loaded
40:M 24 Oct 2018 17:07:05.962 * No cluster configuration found, I'm 63338abf025fc81859f95d3a78d4c08fbfb66870
40:M 24 Oct 2018 17:07:05.970 * Running mode=cluster, port=7004.
40:M 24 Oct 2018 17:07:05.970 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
40:M 24 Oct 2018 17:07:05.970 # Server initialized
40:M 24 Oct 2018 17:07:05.970 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
40:M 24 Oct 2018 17:07:05.970 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
40:M 24 Oct 2018 17:07:05.970 * Ready to accept connections

==> /var/log/supervisor/redis-6.log <==
42:C 24 Oct 2018 17:07:05.964 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
42:C 24 Oct 2018 17:07:05.964 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=42, just started
42:C 24 Oct 2018 17:07:05.964 # Configuration loaded
42:M 24 Oct 2018 17:07:05.966 * No cluster configuration found, I'm 6594df700e1f2710fcebd8dc57be4cdd79dbeba4
42:M 24 Oct 2018 17:07:05.978 * Running mode=cluster, port=7005.
42:M 24 Oct 2018 17:07:05.978 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
42:M 24 Oct 2018 17:07:05.978 # Server initialized
42:M 24 Oct 2018 17:07:05.978 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
42:M 24 Oct 2018 17:07:05.978 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
42:M 24 Oct 2018 17:07:05.978 * Ready to accept connections
71:X 24 Oct 17:07:08.056 # Fatal error, can't open config file '/redis-conf/sentinel-7000.conf'
72:X 24 Oct 17:07:08.056 # Fatal error, can't open config file '/redis-conf/sentinel-7000.conf'
70:X 24 Oct 17:07:08.056 # Fatal error, can't open config file '/redis-conf/sentinel-7000.conf'

modules

would be great to in some way streamline the ability to add modules. right now i'm just editing the dockerfile and boot script to build and load them.

any ideas?

/docker-entrypoint.sh: 91: exec: -e: not found

after exporting

export REDIS_CLUSTER_IP=0.0.0.0

I am running the command in my mac

docker run grokzen/redis-cluster:latest -e "IP=0.0.0.0" ...

but the following error is coming

/docker-entrypoint.sh: 91: exec: -e: not found

my docker version

Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        74b1e89
 Built:             Thu Jul 25 21:18:17 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       74b1e89
  Built:            Thu Jul 25 21:17:52 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Any idea why it is happening?

Make number of nodes configurable

This relates to #2

In order to have my dev/test environment closer to production, it would be super helpful to have a similar number of masters and replicas.

In order to keep it totally compatible with previous versions, it should assume default values as the ones that are currently hardcoded

Thanks for the great work on this lean docker image for bootstrapping quick clusters :)

Redis cluster host configuration

Hello, could you help me out? I am trying to configure redis-cluster with Spring Boot Java application, but I can't link my app server with redis cluster, docker-compose:

version: '2.1'
services:

app:
    image: my-app
    command: -m 512m
    ports:
     - "8000:8000"
    environment:
      - REDIS_CLUSTER_NODES=redis-cluster:7000,redis-cluster:7001,redis-cluster:7002
    depends_on:
      - redis-cluster

 redis-cluster:
    image: grokzen/redis-cluster:4.0.8
    environment:
     - CLUSTER_ONLY=true
    ports:
     - '7000-7005:7000-7005'

but, it does not work, I get:

org.springframework.data.redis.RedisConnectionFailureException: Could not get a resource from the pool; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

container restart uses old IP

When using this container in my docker compose file I've encountered the following issue. After calling docker-compose stop and then docker-compose start again. The data in redis-data/700*/ is retained in between restarts. (normal docker-compose behavior), the problem it leads to is that nodes that are started, read the data from previous restarts and exchange stale IP address.
Every time docker compose starts the containers, the IP address of that container changes, however if the nodes use the old IP, the cluster fails.

I worked around it by adding:
command:
- "/bin/bash"
- "-c"
- "/bin/rm -f /redis-data/700*/*; /start.sh"
in my docker-compose file. However I think the proper solution would be changing original Dockerfile:

CMD ["/bin/bash", "-c", "/bin/rm -f /redis-data/700*/*; /start.sh"]

Not able to access from other machine

getting below error while fetching gata

-> Redirected to slot [2009] located at 127.0.0.1:7000
Could not connect to Redis at 127.0.0.1:7000: Connection refused
Could not connect to Redis at 127.0.0.1:7000: Connection refused

And while i run cluster node command getting below result

redis-cli -c -p 7000 -h 172.31.228.27
172.31.228.27:7000> cluster nodes
b111992ecf3bbdd52a0ec0f277d14a582f5d03c8 127.0.0.1:7001@17001 master - 0 1553773386203 2 connected 5461-10922
0e5f24ddcedeeac8d7164b870963f90a56713f5a 127.0.0.1:7004@17004 slave f0d3f731f1d79bd6f78ab0ad258edec3a8b5ab9e 0 1553773386203 5 connected
ef29c106a39a0798cb98d1279fafd867eb6ef9ec 127.0.0.1:7005@17005 slave 0233dabcd15666814dc5a1c2863a16bfb2c70b98 0 1553773387204 6 connected
f0d3f731f1d79bd6f78ab0ad258edec3a8b5ab9e 127.0.0.1:7002@17002 master - 0 1553773387104 3 connected 10923-16383
c02ca432ece94313bb258c34e814bc213a817a63 127.0.0.1:7003@17003 slave b111992ecf3bbdd52a0ec0f277d14a582f5d03c8 0 1553773385702 4 connected
0233dabcd15666814dc5a1c2863a16bfb2c70b98 127.0.0.1:7000@17000 myself,master - 0 1553773386000 1 connected 0-5460

Can not connect to cluster from another PC

I have two machines are running on Ubuntu 18.04. First machine (IP: 192.168.1.7) run redis cluster, and second (IP: 192.168.1.8) run nodejs application.

The application can not connect to Redis cluster, I don't know why.

When I check the docker logs. It show "IP After trim: '172.22.0.2'". I use FastoRedis connect to Redis cluster with IP 192.168.1.7 successful. But when I create key-value, It show message "Redirected to slot [11518] located at 172.22.0.2:7002"

I try to set IP: 0.0.0.0 but It does not work.

I use IORedis lib on nodejs application, and this is my config:

[ { port: 7000, host: '192.168.1.7' }, { port: 7001, host: '192.168.1.7' }, { port: 7002, host: '192.168.1.7' }, { port: 7003, host: '192.168.1.7' }, { port: 7004, host: '192.168.1.7' }, { port: 7005, host: '192.168.1.7' } ]

Please help me, thank you.

Make size of cluster configurable

Currently the cluster is fixed at 6 nodes, 3 master with each one slave. This configuration should should be dynamic and allow for change to possibly test different scenarios.

Unable to run cluster after container restart

Hi,
I'm pretty fresh in Docker land, please forgive me if I misunderstood something.

After container restart cluster was unable to start properly. Looks like problem is in docker-entrypoint.sh:16:19 - removing nodes.conf for each instance.

Am I doing something wrong or this is some kind of bug?

~ docker version
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:05:26 2018
 OS/Arch:           darwin/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:13:46 2018
  OS/Arch:          linux/amd64
  Experimental:     true
 ~ uname -a
Darwin zmp.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

[Question] where do i run "make build" command?

it was successful with script "docker run groken/redis-cluster"
but where do i run "make run" command?
i am a newbie for docker.
but i need to use docker version to test redis-py-cluster.

can you give more detail guide to run docker?

servers can't agree on slots config after restart docker container.

I use the -v option to let docker save cluster data for me. but when the container restarted, servers can't agree on slot config.

      -v /data/redis/redis-data:/redis-data
      -v /data/redis/redis-conf/7000:/redis-conf/7000
      -v /data/redis/redis-conf/7001:/redis-conf/7001
      -v /data/redis/redis-conf/7002:/redis-conf/7002
      -v /data/redis/redis-conf/7003:/redis-conf/7003
      -v /data/redis/redis-conf/7004:/redis-conf/7004
      -v /data/redis/redis-conf/7005:/redis-conf/7005
      -v /data/redis/redis-conf/7006:/redis-conf/7006
      -v /data/redis/redis-conf/7007:/redis-conf/7007

Clusters are not properly configured

README states that:

The cluster is 6 redis instances running with 3 master & 3 slaves, one slave for each master. They run on ports 7000 to 7005.

When I issued command make up:

☁  docker-redis-cluster [master] ⚡ make up
docker-compose up
WARNING: The REDIS_CLUSTER_IP variable is not set. Defaulting to a blank string.
Starting docker-redis-cluster_redis-cluster_1 ... done
Attaching to docker-redis-cluster_redis-cluster_1
redis-cluster_1  | bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
redis-cluster_1  | >>> Creating cluster
redis-cluster_1  | >>> Performing hash slots allocation on 6 nodes...
redis-cluster_1  | Using 3 masters:
redis-cluster_1  | :7000
redis-cluster_1  | :7001
redis-cluster_1  | :7002
redis-cluster_1  | Adding replica :7004 to :7000
redis-cluster_1  | Adding replica :7005 to :7001
redis-cluster_1  | Adding replica :7003 to :7002
redis-cluster_1  | >>> Trying to optimize slaves allocation for anti-affinity
redis-cluster_1  | [WARNING] Some slaves are in the same host as their master
redis-cluster_1  | M: 3b441edb600ebe4a3031caa238e214b89ea160d6 :7000
redis-cluster_1  |    slots:0-5460 (5461 slots) master
redis-cluster_1  | M: aac7951b084c4e0efc4ab65d0e4fdd0a3b223aec :7001
redis-cluster_1  |    slots:5461-10922 (5462 slots) master
redis-cluster_1  | M: 8cfb585b0ffbf8fb598c42bedeacf77c8911266b :7002
redis-cluster_1  |    slots:10923-16383 (5461 slots) master
redis-cluster_1  | S: 96b361563b2340ac95135e231656726c36c0500e :7003
redis-cluster_1  |    replicates aac7951b084c4e0efc4ab65d0e4fdd0a3b223aec
redis-cluster_1  | S: 0d0407c4633ddef765e3ce4e3698873a12de2e3e :7004
redis-cluster_1  |    replicates 8cfb585b0ffbf8fb598c42bedeacf77c8911266b
redis-cluster_1  | S: 6dc48ae62b947baa50429c059d34700c52f5445a :7005
redis-cluster_1  |    replicates 3b441edb600ebe4a3031caa238e214b89ea160d6

# ...

But it seems to me all nodes are master ones:

☁  docker-redis-cluster [master] ⚡ redis-cli -p 7000 info | grep role
role:master
☁  docker-redis-cluster [master] ⚡ redis-cli -p 7004 info | grep role
role:master

Would you please tell me what wrong is?

docker-redis-cluster fails to start up (partially)

docker-redis-cluster is failing to boot up consistently on a linux machine (docker 18.06.0-ce); we're also seeing intermittent errors on mac machines (18.06.1-ce-mac73). Specifically, the cluster seems to come up but only cover about a third of the expected slots.

docker-compose.yml

redis_sessions:
  dns: 8.8.8.8
  image: grokzen/redis-cluster:4.0.9
  environment:
    CLUSTER_ONLY: 'true'

beginning docker-compose logs from failing linux box

bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
:7000
:7001
:7002
Adding replica :7004 to :7000
Adding replica :7005 to :7001
Adding replica :7003 to :7002
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: 55ce20d0ae2671c67f0108044e3f89ac72fa2d7a :7000
   slots:0-5460 (5461 slots) master
M: 6c6565c2a52c289e64363f44a28c1e0ff7980ba6 :7001
   slots:5461-10922 (5462 slots) master
M: 0217470798f829dc14bf263132ca0066e94991e5 :7002
   slots:10923-16383 (5461 slots) master
S: 49ed982815367407e0c4320867b8b74d2227a0e2 :7003
   replicates 0217470798f829dc14bf263132ca0066e94991e5
S: c17fa5d257784134f088c2e6eafde59c79e6a49e :7004
   replicates 55ce20d0ae2671c67f0108044e3f89ac72fa2d7a
S: 45e3c71df75b0d9fabbc8d9c15f122df435721b0 :7005
   replicates 6c6565c2a52c289e64363f44a28c1e0ff7980ba6
/var/lib/gems/2.1.0/gems/redis-3.3.3/lib/redis/client.rb:121:in `call': ERR Invalid node address specified: :7000 (Redis::CommandError)
  from /var/lib/gems/2.1.0/gems/redis-3.3.3/lib/redis.rb:2705:in `block in method_missing'
  from /var/lib/gems/2.1.0/gems/redis-3.3.3/lib/redis.rb:58:in `block in synchronize'
  from /usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
  from /var/lib/gems/2.1.0/gems/redis-3.3.3/lib/redis.rb:58:in `synchronize'
  from /var/lib/gems/2.1.0/gems/redis-3.3.3/lib/redis.rb:2704:in `method_missing'
  from /redis/src/redis-trib.rb:941:in `block in join_cluster'
  from /redis/src/redis-trib.rb:939:in `each'
  from /redis/src/redis-trib.rb:939:in `join_cluster'
  from /redis/src/redis-trib.rb:1431:in `create_cluster_cmd'
  from /redis/src/redis-trib.rb:1830:in `<main>'
Can I set the above configuration? (type 'yes' to accept): >>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
==> /var/log/supervisor/redis-1.log <==
43:C 18 Oct 17:47:45.690 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=43, just started
43:C 18 Oct 17:47:45.690 # Configuration loaded
43:M 18 Oct 17:47:45.691 * No cluster configuration found, I'm 55ce20d0ae2671c67f0108044e3f89ac72fa2d7a
43:M 18 Oct 17:47:45.696 * Running mode=cluster, port=7000.
43:M 18 Oct 17:47:45.696 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
43:M 18 Oct 17:47:45.696 # Server initialized
43:M 18 Oct 17:47:45.696 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
43:M 18 Oct 17:47:45.696 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create laten...

I suspect the key is ERR Invalid node address specified: :7000 (Redis::CommandError). On a working mac box, this error doesn't show up, and CLUSTER MEET has additional output after it detailing the different nodes joining the cluster.

This seems likely to be an issue with how we've configured our container. I did try setting REDIS_CLUSTER_IP=0.0.0.0 in docker-compose for the linux user and it did not resolve the issue.

generate-supervisor-conf.sh does not account for changed INITIAL_PORT

Discovered when trying to set this up with java testcontainers. When i set the INITIAL_PORT env var to be the first in whatever the random generated port range is, the docker-entrypoint script correctly calculates the new $max-port value. This value is then sent into the generate-supervisor-conf.sh but the seq line still has a hardcoded 7000 for the start value which will take a considerable time if the new max port is somewhere in the 30000s.
I tested this using docker run -e "INITIAL_PORT=33011" grokzen/redis-cluster:latest
and again with docker run -e "INITIAL_PORT=6998" grokzen/redis-cluster:latest and you can really see the difference in startup times (I gave up on the 33011 try).

Container IP changes break the cluster

I'm not sure why my container changed IPs and maybe that's my real issue, but if you could run redis-cli -p 7000 cluster meet 127.0.0.1 700X for each of the nodes at the end of the Dockerfile then I think this problem would go away. That's what I did to fix it once it was up. It would be nice if it was that way by default.

243:S 19 May 19:11:07.279 * Connecting to MASTER 172.17.0.7:7000
243:S 19 May 19:11:07.279 * MASTER <-> SLAVE sync started
243:S 19 May 19:11:07.279 # Error condition on socket for SYNC: Connection refused
root@0cd0e6c5d29f:/# ifconfig
eth0      Link encap:Ethernet  HWaddr 02:42:ac:11:00:08
          inet addr:172.17.0.8  Bcast:0.0.0.0  Mask:255.255.0.0

redis requires Ruby version >= 2.2.2.

Command

docker build --build-arg redis_version=4.0.11 -t grokzen/redis-cluster .

Error during building the container

Step 13/22 : RUN gem install redis
 ---> Running in 395e4a2b054e
ERROR:  Error installing redis:
        redis requires Ruby version >= 2.2.2.
The command '/bin/sh -c gem install redis' returned a non-zero code: 1

redis changed the cluster form command

using Grokzen/docker-redis-cluster on circleci. Now we get
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
WARNING: redis-trib.rb is not longer available!
You should use redis-cli instead.

All commands and features belonging to redis-trib.rb have been moved
to redis-cli.
In order to use them you should call redis-cli with the --cluster
option followed by the subcommand name, arguments and options.

Add support for passwords

It would be great to be able to use docker-redis-cluster and put a password in front of it. It's not clear to me from the existing documentation whether that's possible; I'm fairly certain it isn't.

Redis-Cli hangs after redirecting to other nodes

Thanks for the package, @Grokzen.

When I build, run the container and then try accessing using the redis-cli -c -p 7000 command, everything looks fine. However, when I try and use Redis by either SETing or GETting key, I get the message Redirected to slot [11058] located at 172.17.0.2:7002 and the redis-cli hangs. It seems like that it's trying to access other redis nodes on 172.17.0.2 (not sure where this IP comes from).

Do you have any suggestions on how to fix for this?

How to set up Redis cluster with 1 shard and some replica?

The default set up have 3 master and 3 read replica
I guess 3 master means there will be 3 shards.

I need exactly one shard with cluster-mode on.
How can I set up redis cluster with 1 master and 2 read replica?

I read the script and cannot find any setting which specify the number of master and slave.
Seems they all share the same redis-cluster.tmpl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.