Giter VIP home page Giter VIP logo

redis-cluster's Introduction

Redis cluster docker image

Redis cluster docker image is a cluste enabled image for container technology.

Quick start

The redis has two types, redis-server and redis-sentinel, to work in cluster. The redis-server is the main application for the memory cache service. The redis-sentinel act as a arbitrator to judge which redis-server is master for writing. When you run redis-master or redis-slave, the redis sentinel is also activated as well. The following commands for how to run the docker image in different type.

NOTE: You can also use this image to work in standalone mode.

NOTE: The quorun can be reference to the section of redis sentinel website.

Parameters

Parameter Description
REDISPASSWORD The authentication for the redis access
STANDALONE The redis will act as a standalone cache server
ACT_MASTER The redis will act as a master for data write access in the cache cluster
ACT_SLAVE The redis will act as a slave for synchronizing data access in the cache cluster
ACT_SENTINEL The redis will perform judge to decide which redis server is master
REDIS_MASTER_HOSTNAME The first connecting redis hostname or ip address, basically it is the redis master in the cluster
SENTINEL_QUORUM The quorum value defined in the redis sentinel
LOGSTASH_STRING This docker image includes a filebeat daemon, it forwards the redis log to logstash

For non-swarm mode

Standalone

$ docker run -p 6379:6379 -p 26379:26379 --name redis-standalone -h redis-standalone -e STANDALONE=1 -e REDISPASSWORD=redispass -e LOGSTASH_STRING=\"aaa:5044\",\"bbb:5044\" wiarea/redis:3.0.7-alpine

Cluster-Master

$ docker run -p 6379:6379 -p 26379:26379 --name redis-master -h redis-master -e ACT_MASTER=1 -e REDISPASSWORD=redispass -e REDIS_MASTER_HOSTNAME=master_host_ip -e SENTINEL_QUORUM=quorum_num -e LOGSTASH_STRING=\"aaa:5044\",\"bbb:5044\" wiarea/redis:3.0.7-alpine

Cluster-Slave

$ docker run -p 6379:6379 -p 26379:26379 --name redis-slave -h redis-slave -e ACT_SLAVE=1 -e REDISPASSWORD=redispass -e REDIS_MASTER_HOSTNAME=master_host_ip -e SENTINEL_QUORUM=quorum_num -e LOGSTASH_STRING=\"aaa:5044\",\"bbb:5044\" wiarea/redis:3.0.7-alpine

Sentinel only

$ docker run -p 6379:6379 -p 26379:26379 --name redis-sentinel -h redis-sentinel -e ACT_SLAVE=1 -e REDIS_MASTER_HOSTNAME=master_host_ip -e SENTINEL_QUORUM=quorum_num -e LOGSTASH_STRING=\"aaa:5044\",\"bbb:5044\" wiarea/redis:3.0.7-alpine

Build in swarm

$ docker -H tcp://swarmmaster:50000 build --build-arg="constraint:node==[node]" -t "wiarea/redis:3.0.7-alpine" .

For swarm mode

Standalone

$ docker -H tcp://swarmmaster:50000 run -d -p 6379:6379 -p 26379:26379 -e constraint:node==[node] --name redis-standalone --net oanet -h redis-standalone -e STANDALONE=1 -e REDISPASSWORD=redispass -e LOGSTASH_STRING=\"aaa:5044\",\"bbb:5044\" wiarea/redis:3.0.7-alpine

Cluster-Master

$ docker -H tcp://swarmmaster:50000 run -d -p 6379:6379 -p 26379:26379 -e constraint:node==[node] --name redis-master --net oanet -h redis-master -e ACT_MASTER=1 -e REDISPASSWORD=redispass -e REDIS_MASTER_HOSTNAME=master_host_ip -e SENTINEL_QUORUM=quorum_num -e LOGSTASH_STRING=\"aaa:5044\",\"bbb:5044\" wiarea/redis:3.0.7-alpine

Cluster-Slave

$ docker -H tcp://swarmmaster:50000 run -d -p 6379:6379 -p 26379:26379 -e constraint:node==[node] --name redis-slave --net oanet -h redis-slave -e ACT_SLAVE=1 -e REDISPASSWORD=redispass -e REDIS_MASTER_HOSTNAME=master_host_ip -e SENTINEL_QUORUM=quorum_num -e LOGSTASH_STRING=\"aaa:5044\",\"bbb:5044\" wiarea/redis:3.0.7-alpine

Sentinel only

$ docker -H tcp://swarmmaster:50000 run -d -p 6379:6379 -p 26379:26379 -e constraint:node==[node] --name redis-sentinel --net oanet -h redis-sentinel -e ACT_SLAVE=1 -e REDIS_MASTER_HOSTNAME=master_host_ip -e SENTINEL_QUORUM=quorum_num -e LOGSTASH_STRING=\"aaa:5044\",\"bbb:5044\" wiarea/redis:3.0.7-alpine

Stop container in swarm

$ docker -H tcp://swarmmaster:50000 stop [container_name]

Remove container in swarm

$ docker -H tcp://swarmmaster:50000 rm [container_name]

Execute command in specific container

$ docker -H tcp://swarmmaster:50000 exec [container_name] command

redis-cluster's People

Contributors

bochengyang avatar

Watchers

 avatar

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.