Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically adding new nodes in Cassandra

Tags:

cassandra

Is it possible to add new hosts to a Cassandra cluster dynamically?

What I'm trying to do is set up a program that can:

  • Set up a local version of the database for each user
  • Each user's machine will become part of the cluster (the machines will be hosts)
  • Data will be replicated across all the clusters

Building a cluster of multiple hosts usually entails configuring the cassandra.yaml to store the seeds, listen_address and rpc_address of each host.

My idea is to edit these files through java and insert the new host addresses as required but making sure that data is accurate across each users's cassandra.yaml files would be challenging.

I'm wondering if someone has done something similar or has any advice on a better way to achieve this.

like image 585
Lyuben Todorov Avatar asked Nov 04 '12 14:11

Lyuben Todorov


1 Answers

Yes is possible. Look at Netflix's Priam for an complete example of a dynamic cassandra cluster management (but designed to work with Amazon EC2).

For rpc_address and listen_address, you can setup a startup script that configures the cassandra.yaml if it's not ok.

For seeds you can configure a custom seed provider. Look at the seed provider used for Netflix's Priam for some ideas how to implement it

The most difficult part will be managing the tokens assigned to each node in a efficient way. Cassandra 1.2 is around the corner and will include a feature called virtual nodes that, IMO, will work well in your case. See the Acunu presentation about it

like image 74
lstern Avatar answered Sep 29 '22 09:09

lstern