hectcastro / docker-riak

A Docker project to bring up a local Riak cluster.
https://registry.hub.docker.com/u/hectcastro/riak/
Apache License 2.0
167 stars 83 forks source link

Docker Riak between multiple hosts with Docker Swarm? #39

Open bholt opened 9 years ago

bholt commented 9 years ago

I'm trying to set up something similar to #10. Thanks, that thread definitely gives me a good place to start.

I know a recent release of Docker introduced "Docker Swarm" which seems aimed to address this kind of issue — allowing docker containers running on different hosts to communicate. Anyone know more about this new feature and know how to use it to run Riak between containers on multiple hosts?

eproxus commented 9 years ago

AFAIK, Docker Swarm does nothing for networking? It seems more to be aimed at distributing/scheduling Docker containers over multiple hosts.

matthub commented 8 years ago

Hi, we've setup riak as swarm cluster here, basically you need first to create an overlay network like

docker network create --driver overlay --subnet=10.0.7.0/24 riak-net

And then we are starting the containers like following

docker run -e "DOCKER_RIAK_CLUSTER_SIZE=5" -e "DOCKER_RIAK_AUTOMATIC_CLUSTERING=1" -e "DOCKER_RIAK_BACKEND=bitcask" -p 32767:8097 -p 32768:8098 --net="riak-net" --name "riak01" -d hectcastro/riak

and then link the next ones with the hard coded address of riak01 (it did not work for me via --link) like following

docker run -e "DOCKER_RIAK_CLUSTER_SIZE=5" -e "DOCKER_RIAK_AUTOMATIC_CLUSTERING=1" -e "DOCKER_RIAK_BACKEND=bitcask" -p 32769:8097 -p 32770:8098 -e "SEED_PORT_8098_TCP_ADDR=10.0.7.2" --net="riak-net" --name "riak02" -d hectcastro/riak

HTH

bholt commented 8 years ago

Thanks! Docker's new networking stuff is really pretty great, it's come a long way in the last year. On a related project I'm now using overlay networks just like this (but with Cassandra) with no problems. In fact, I've been having a lot of success simulating adverse network conditions (a.la Jepsen) with this setup using tc netem. Hoping to make it into a real tool sometime.