Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose clustering params as environment variables #14

Open
yaronr opened this issue Sep 16, 2014 · 7 comments
Open

Expose clustering params as environment variables #14

yaronr opened this issue Sep 16, 2014 · 7 comments

Comments

@yaronr
Copy link
Collaborator

yaronr commented Sep 16, 2014

Hi

I'm exploring running your docker setup in a cross-datacenter cluster.
Would it be possible to expose the following params as -e environment variables for the docker container?

cluster_name: ''
initial_token:
seed_provider:
- seeds: ""
listen_address:
rpc_address: 0.0.0.0
endpoint_snitch:

pokle added a commit that referenced this issue Sep 16, 2014
pokle added a commit that referenced this issue Sep 16, 2014
@pokle
Copy link
Owner

pokle commented Sep 16, 2014

Yes, that's a very good idea. I've added support for the SEEDS. Would you care to add support for the rest, and send me a pull request?

Another perhaps more flexible way this could be done is by mapping in the config file from outside the container. I've made it possible in the start.sh script to override the default template file for cassandra.yaml. So you could do something like:

docker run -v my-template.yaml:/etc/my-template.yaml -e DEFAULT=/etc/my-template.yaml poklet/cassandra start

Would that work for you?

pokle added a commit that referenced this issue Sep 16, 2014
@yaronr
Copy link
Collaborator Author

yaronr commented Sep 17, 2014

Hi

First, thanks for integrating that change.
I am trying to run Cassandra in a cluster that spans two different 'clouds' or network zones. I will be trying 'weave' (which I mentioned in a comment) as an overlay network. It may be that 'seeds' are enough for that. In any case, I will let you know.

Regarding supplying a container with the configuration: That's simple enough, but it complicates things for clustered systems such as kubernets, and I believe this is where Docker in 'production' is heading. It will always be better to supply configuration parameters though the command line (even if, for example, you allow supplying a template URL).

That said, if I can contribute to your project I will happily do it, but I'm rather a beginner in Docker.

BTW: I am guessing your automated build / docker.io push takes the latest of the master branch, right?

@yaronr
Copy link
Collaborator Author

yaronr commented Sep 17, 2014

I added the LISTEN_ADDRESS param (see pull req). Trying to see if it works. Getting close.. :)

@yaronr
Copy link
Collaborator Author

yaronr commented Sep 17, 2014

Ok, I'm pretty close, and this is pretty cool, but I may need your help. I'm very new to Cassandra, relatively new to Docker.

I am running two Cassandra instances, on two different locations. There's an overlay network (provided by 'weave') which connects both instances, similar to a 'virtual network switch'. All ports are accessible for inter-node communication using this technology.
(This is using the pull request you yet have to approve) - see commands below.

I can ping from either instance to the other (nsenter), but they both fail to 'gossip' with each other, failing on "java.lang.RuntimeException: Unable to gossip with any seeds".

I've checked the cassandra.yaml and it is correct (as long as the parameters I've specified are correct)

#On node 1:
#setup virtual network
sudo ./weave launch 10.2.0.1/16

start cassandra, give the docker image an IP(10.2.1.3) in the virtual network, set seed to node 2

sudo ./weave run 10.2.1.3/24 -d -name cass1 -e SNITCH=GossipingPropertyFileSnitch -e DC=HOME -e RACK=LAPTOP -e SEEDS=10.2.1.4 -e LISTEN_ADDRESS=10.2.1.3 localhost:5000/yaronr/cassandra

#On node 2 (boot2docker)
#setup virtual net, same address space, connect to node 1
boot2docker ssh "sudo ./weave launch 10.2.0.1/16 "
#start cassandra, , give the docker image an IP(10.2.1.4), set seed to node 1
boot2docker ssh "sudo ./weave run 10.2.1.4/24 -d -name cass1 -e SNITCH=GossipingPropertyFileSnitch -e DC=HOME -e RACK=LAPTOP -e SEEDS=10.2.1.3 -e LISTEN_ADDRESS=10.2.1.4 localhost:5000/yaronr/cassandra"

I know that this is slightly more involving than a plan vanilla cluster, but also much more interesting.
Thoughts?

@pokle
Copy link
Owner

pokle commented Sep 17, 2014

I'm happy to go with your judgement about environment variables like SEED and LISTEN_ADDRESS rather than specifying a config files.

Weave looks interesting. I haven't used it, but again, I'm very happy for you to apply your learnings to this image, and shape it as you feel fit for production. I'm sure we'll all benefit from the experience.

Perhaps for your weave example, you could start a different page outside of README.MD so that you have all the space to explain the set up. Going to production can always be a little more involved than simple demonstrators.

@yaronr
Copy link
Collaborator Author

yaronr commented Sep 17, 2014

Hey, good news.
I solved the problem.

I just created a Cassandra cluster, on top of weave SON (virtual network), using docker. One node on my laptop, the other on AWS. How cool is that?

@pokle
Copy link
Owner

pokle commented Sep 17, 2014

That does sound very cool actually :)

Can't wait to try it out - write up the instructions and push!

On Thursday, September 18, 2014, Yaron Rosenbaum [email protected]
wrote:

Hey, good news.
I solved the problem.

I just created a Cassandra cluster, on top of weave SON (virtual network),
using docker. One node on my laptop, the other on AWS. How cool is that?


Reply to this email directly or view it on GitHub
#14 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants