I have recently started using Cassandra in our Production environment.
We have a 24 node cluster withreplication factor of 4. Meaning 2 copies
will be there in each datacenter. So that means we have a single cross
colo cluster with 24 nodes which means 12 nodes in SLC colo and 12 nodes
in PHX colo.
I am using Pelops client to write the data in
Cassandra database. Now I am trying to figure out is there any way
Pelops client will be able to figure out all the nodes in the PHX colo
or SLC colo and not all of the nodes?
With the below code, I
am able to discover all the nodes, meaning all the 24 nodes. But Is
there any way, I can filter out the nodes corresponding to each
Datacenter using Pelops client? /**
* Creating cassandra connection using pelops client
*
*/
private CassandraPelopsConnection() {
setKeyspace(ModelConstants.
KEYSPACE);
setNodes(ModelConstants.NODES);
setPort(ModelConstants.CASSANDRA_PORT);
setPoolName(ModelConstants.CLUSTER);
createPool();
}
/**
* It will create the pool with given poolname, cluster and keyspace
*
*/
private void createPool() {
CommonsBackedPool.Policy pt = new Policy();
pt.setMaxActivePerNode(40);
OperandPolicy op = new OperandPolicy();
Pelops.addPool(getPoolName(), getCluster(), getKeyspace(), pt, op);
}
/**
* Gets the cluster information
*
* @return
*/
private Cluster getCluster() {
Config casconf = new Config(ModelConstants.CASSANDRA_PORT, true, 0);
Cluster cluster= new Cluster(nodes, casconf, ModelConstants.NODE_DISCOVERY);
return cluster;
}