me.prettyprint.hector.api.HConsistencyLevel Java Examples

The following examples show how to use me.prettyprint.hector.api.HConsistencyLevel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThresholdsDao.java    From oneops with Apache License 2.0 6 votes vote down vote up
/**
 * Bean post init method. The following configuration is used
 * for initializing the ThresholdsDao cassandra cluster,
 * <p>
 * <ul>
 * <li>Active clients per node - 4</li>
 * <li>Cassandra Thrift timeout - 600 sec</li>
 * </ul>
 */
public void init() {
    logger.info("Initializing Monitor Thresholds Dao...");

    Cluster cluster = cb.getCluster(clusterName, 4, timeout);
    logger.info("Connected to cluster : " + clusterName);

    SchemaBuilder.createSchema(cluster, keyspaceName);
    ConfigurableConsistencyLevel cl = new ConfigurableConsistencyLevel();
    cl.setDefaultWriteConsistencyLevel(HConsistencyLevel.ONE);
    cl.setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);

    keyspace = HFactory.createKeyspace(keyspaceName, cluster, cl);
    thresholdMutator = HFactory.createMutator(keyspace, longSerializer);
    manifestMapMutator = HFactory.createMutator(keyspace, longSerializer);
    realizedAsMutator = HFactory.createMutator(keyspace, longSerializer);
}
 
Example #2
Source File: OpsEventDao.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Bean post init method. The following configuration is used
 * for initializing the OpsEventDao cassandra cluster,
 * <p>
 * <ul>
 * <li>Active clients per node - 4</li>
 * <li>Cassandra Thrift timeout - 5 sec </li>
 * </ul>
 */
public void init() {
    logger.info("Initializing OpsEvent Dao...");
    Cluster cluster = cb.getCluster(clusterName, 4, 5 * 1000);
    logger.info("Connected to cluster : " + clusterName);

    SchemaBuilder.createSchema(cluster, keyspaceName);
    ConfigurableConsistencyLevel cl = new ConfigurableConsistencyLevel();
    cl.setDefaultWriteConsistencyLevel(HConsistencyLevel.ONE);
    cl.setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);
    keyspace = createKeyspace(keyspaceName, cluster, cl);
    eventMutator = HFactory.createMutator(keyspace, bytesSerializer);
    ciMutator = HFactory.createMutator(keyspace, longSerializer);
    orphanCloseMutator = HFactory.createMutator(keyspace, longSerializer);
}
 
Example #3
Source File: OpsCiStateDao.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Bean post init method. The following configuration is used
 * for initializing the OpsCiStateDao cassandra cluster,
 * <p/>
 * <ul>
 * <li>Active clients per node - 4</li>
 * <li>Cassandra Thrift timeout - 5 sec </li>
 * </ul>
 */
public void init() {
    logger.info("Initializing OpsCiState Dao...");
    Cluster cluster = cb.getCluster(clusterName, 4, 5 * 1000);
    logger.info("Connected to cluster : " + clusterName);

    SchemaBuilder.createSchema(cluster, keyspaceName);
    ConfigurableConsistencyLevel cl = new ConfigurableConsistencyLevel();
    HConsistencyLevel wrCL = System.getProperty("com.sensor.cistates.cl","LOCAL_QUORUM").equals("ONE") ? HConsistencyLevel.ONE :HConsistencyLevel.LOCAL_QUORUM;
    cl.setDefaultWriteConsistencyLevel(wrCL);
    cl.setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);
    keyspace = createKeyspace(keyspaceName, cluster, cl);
    ciStateHistMutator = HFactory.createMutator(keyspace, longSerializer);
    componentStateMutator = HFactory.createMutator(keyspace, longSerializer);
}