Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description


Docker image of twemproxy proxy server in front of redis instances.

Based on jgoodall/docker-twemproxy


The container reads the redis server information from etcd. The twemproxy container will use confd to watch the /services/redis path. It exposes port 6000, so map that when you do docker run.

When you start your redis containers, put their connection information into etcd in the /services/redis/<instance>:

etcdctl set /services/redis/01
etcdctl set /services/redis/02

You also need to set the port that you want twemproxy to run on:

etcdctl set /services/twemproxy/port 6000

Finally, define the etcd peer confd should use as an environment variable using -e ETCD_HOST=<host>:<port> when you do the docker run to start the container.


You may want to customize the twemproxy configuration in confd/templates/twemproxy.tmpl - particularly the hash_tag option.

# start some redis containers
docker run --name=redis-A --rm -p 6101:6379 dockerfile/redis
docker run --name=redis-B --rm -p 6102:6379 dockerfile/redis
# publish the redis host:ip information into etcd
etcdctl set /services/redis/A
etcdctl set /services/redis/B
# define the desired twemproxy and stats port
# set the twemproxy port in etcd
etcdctl set /services/twemproxy/port ${TWEMPROXY_PORT}
# use the port you set above when you start the container
docker run --name=twemproxy --rm -p ${TWEMPROXY_PORT}:6000 -p ${TWEMPROXY_STATS_PORT}:6001 -e ETCD_HOST= jgoodall/twemproxy
# publish the twemproxy host info if desired
etcdctl set /services/twemproxy/host
# connect using a redis client
redis-cli -h `etcdctl get /services/twemproxy/host` -p `etcdctl get /services/twemproxy/port`
# get stats on cluster (use `docker ps` to get `<ip>`)
Docker Pull Command
Source Repository