Does Pelops client support autodiscovery mode for local nodes only corresponding to each datacenter?

17 views
Skip to first unread message

compte...@gmail.com

unread,
May 10, 2013, 8:34:04 PM5/10/13
to sca...@googlegroups.com
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;
    }

Dan Washusen

unread,
May 10, 2013, 8:49:48 PM5/10/13
to sca...@googlegroups.com
Hmm, 'out of the box' you'll be limited to either suspending nodes using INodeSuspensionStrategy or filtering nodes using INodeSelectionStrategy neither of which is ideal for the use case (see CommonsBackedPool for details). 

I'd suggest adding a INodeFilterStrategy interface and an impl. that filters nodes based on their data center and then plugging that into handleClusterRefresh. That way you'll be able to filter nodes before adding them to the pool.  Feel free to submit a pull request :)


--
You received this message because you are subscribed to the Google Groups "Scale 7 - Libraries and systems for scalable computing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scale7+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Dan Washusen
Make big files fly!
Reply all
Reply to author
Forward
0 new messages