Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have recently started using Cassandra in our Production environment. We have a 24 node cross colo cluster with replication factor of 4. We have 12 nodes in PHX colo and 12 nodes in SLC colo. And because of replication factor 2 copies will be there in each data center.

I am using Astyanax client to read the data in Cassandra database. Below is the code I am using with Astyanax client that will auto discover all the nodes for each data center. Currently it will auto discover the nodes for PHX colo.

private CassandraAstyanaxConnection() {

    context = new AstyanaxContext.Builder()
    .forCluster(ModelConstants.CLUSTER)
    .forKeyspace(ModelConstants.KEYSPACE)
    .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
        .setPort(9160)
        .setMaxConnsPerHost(40)
        .setSeeds("cdb03.vip.phx.host.com:9160,cdb04.vip.phx.host.com:9160")
        .setLocalDatacenter("phx")
    )
    .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
        .setCqlVersion("3.0.0")
        .setTargetCassandraVersion("1.2")
        .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE))
    .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
    .buildKeyspace(ThriftFamilyFactory.getInstance());

    context.start();
    keyspace = context.getEntity();

    emp_cf = ColumnFamily.newColumnFamily(
        ModelConstants.COLUMN_FAMILY, 
        StringSerializer.get(), 
        StringSerializer.get());
}

Problem Statement:-

Now I am trying to understand what will happen in these two scenarios with my above Astyanax client connection configuration-

  1. We have a replication factor of 4 so that means 2 copies of same data will be there in each colo. Now with the current configuration of Astyanax that I am using currently (see above code) which will auto discover the nodes only for each data center right? Currently it is PHX. So suppose I am looking for rowKey 123 then it will go and get the data from two replicas in PHX colo, right?
  2. What about this scenario- Then what will happen in that case, suppose two nodes in PHX colo that will contain the data for rowKey 123 are down? Then it will go and get the data from SLC colo replicas nodes? Am I correct?
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.