/docker-redis

Redis server with optional Sentinel

Primary LanguageDockerfileMIT LicenseMIT

build status

Docker image for redis server with optional sentinel.

Introduction

Docker image for running Redis, image is based upon Alpine Linux.

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

Docker Registries

  • datacore/redis:latest
  • registry.timmertech.nl/docker/redis:latest

Source Repositories

Installation

Install from DockerHub

Download:

docker pull datacore/redis:latest

Build:

docker build -t datacore/redis https://github.com/gjrtimmer/docker-redis


Install from TimmerTech

Download:

docker pull registry.timmertech.nl/docker/redis:latest

Build:

docker build -t datacore/redis https://gitlab.timmertech.nl/docker/redis

Examples

Locations

Default(s):

Type Default
Redis Port 6379
Sentinel Port 26379
Data /var/lib/redis
Log(s) /var/log/redis
Unix Socket /var/run/redis/redis.sock

Configuration

General

General Configuration

Option Default Description
REDIS 1 / true Activate Redis Server
SENTINEL 0 / false Activate Redis Sentinel
USERMAP_UID redis Map ownership to UID
USERMAP_GID redis Map ownership to GID


Redis

Redis Configuration

Option Default Description
REDIS 1 / true Activate Redis Server
REDIS_TIMEOUT 0 Close the connection after a client is idle for N seconds (0 to disable)
REDIS_KEEPALIVE 300 TCP keepalive.

If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence
of communication. This is useful for two reasons:

1) Detect dead peers.
2) Take the connection alive from the point of view of network
equipment in the middle.

On Linux, the specified value (in seconds) is the period used to send ACKs.
Note that to close the connection the double of the time is needed.
On other kernels the period depends on the kernel configuration.

A reasonable value for this option is 300 seconds, which is the new
Redis default starting with Redis 3.2.1.
REDIS_DATABASES 16 Number of redis databases
REDIS_DATA /var/lib/redis Data directory of redis
REDIS_PASSWORD - Redis password
REDIS_MAXCLIENTS 10000 Max connected clients
REDIS_MIN_SLAVES_TO_WRITE 1 It is possible for a master to stop accepting writes if there are less than
N slaves connected, having a lag less or equal than M seconds.
REDIS_MIN_SLAVES_MAX_LAG 10 It is possible for a master to stop accepting writes if there are less than
N slaves connected, having a lag less or equal than M seconds.


Slave

Slave Configuration

Option Default Required Description
SLAVE 0 - Mark redis server as slave
SLAVE_MHOST - Yes IP of master server
SLAVE_MPORT 6379 No Port of the master redis server
SLAVE_MPASS - No Password of the master redis server
SLAVE_IP - No Publish IP of slave, used for docker NAT, IP is the docker host IP to reach container, uses redis slave-announce-ip
SLAVE_PORT - No Publish port of slave, used for docker, PORT is the docker host port to reach container, uses redis slave-announce-port


Sentinel

Sentinel Configuration

Option Default Required Description
SENTINEL 0 - Activate redis-server sentinel
SENTINEL_IP - No Publish IP of sentinel, used for docker NAT, IP is the docker host IP to reach container, uses sentinel announce-ip
SENTINEL_PORT - No Publish IP of sentinel, used for docker NAT, PORT is the docker host PORT to reach container, uses sentinel announce-ip
SENTINEL_MSET - Yes Name of master set
SENTINEL_MHOST - Yes IP of master redis
SENTINEL_MPORT 6379 No Port of master redis server
SENTINEL_MPASS - No Password of master redis server
SENTINEL_QUORUM - Yes Quorum voting value
SENTINEL_DOWN_AFTER_MS 30000 No Number of milliseconds the master (or any attached slave or sentinel) should
be unreachable (as in, not acceptable reply to PING, continuously, for the
specified period) in order to consider it in S_DOWN state (Subjectively
Down).

Default is 30 seconds.
SENTINEL_PARALLEL_SYNCS 1 No How many slaves we can reconfigure to point to the new slave simultaneously
during the failover. Use a low number if you use the slaves to serve query
to avoid that all the slaves will be unreachable at about the same
time while performing the synchronization with the master.
SENTINEL_FAILOVER_TIMEOUT 180000 No Specifies the failover timeout in milliseconds. It is used in many ways:

- The time needed to re-start a failover after a previous failover was
already tried against the same master by a given Sentinel, is two
times the failover timeout.

- The time needed for a slave replicating to a wrong master according
to a Sentinel current configuration, to be forced to replicate
with the right master, is exactly the failover timeout (counting since
the moment a Sentinel detected the misconfiguration).

- The time needed to cancel a failover that is already in progress but
did not produced any configuration change (SLAVEOF NO ONE yet not
acknowledged by the promoted slave).

- The maximum time a failover in progress waits for all the slaves to be
reconfigured as slaves of the new master. However even after this time
the slaves will be reconfigured by the Sentinels anyway, but not with
the exact parallel-syncs progression as specified.

Default is 3 minutes.