• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NodeDiscoveryType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.netflix.astyanax.connectionpool.NodeDiscoveryType的典型用法代码示例。如果您正苦于以下问题:Java NodeDiscoveryType类的具体用法?Java NodeDiscoveryType怎么用?Java NodeDiscoveryType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NodeDiscoveryType类属于com.netflix.astyanax.connectionpool包,在下文中一共展示了NodeDiscoveryType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: HBaseClient

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
public HBaseClient(final Config config) {
  this.config = config;
  if (config.getString("asynccassandra.seeds") == null || 
      config.getString("asynccassandra.seeds").isEmpty()) {
    throw new IllegalArgumentException(
        "Missing required config 'asynccassandra.seeds'");
  }
  
  ast_config = new AstyanaxConfigurationImpl()      
    .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE);
  pool = new ConnectionPoolConfigurationImpl("MyConnectionPool")
    .setPort(config.getInt("asynccassandra.port"))
    .setMaxConnsPerHost(1)
    .setSeeds(config.getString("asynccassandra.seeds"));
  monitor = new CountingConnectionPoolMonitor();
  
  tsdb_table = config.getString("tsd.storage.hbase.data_table").getBytes();
  tsdb_uid_table = config.getString("tsd.storage.hbase.uid_table").getBytes();
  
  column_family_schemas.put("t".getBytes(), TSDB_T);
  column_family_schemas.put("name".getBytes(), TSDB_UID_NAME);
  column_family_schemas.put("id".getBytes(), TSDB_UID_ID);
}
 
开发者ID:OpenTSDB,项目名称:asynccassandra,代码行数:24,代码来源:HBaseClient.java


示例2: setupAstyanaxContext

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
private Keyspace setupAstyanaxContext(String clusterName)
{
    AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
            .forCluster(clusterName)
            .forKeyspace("CrawlerKS")
            .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                            .setDiscoveryType(NodeDiscoveryType.NONE)
                            .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
            )
            .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("CassandraPool")
                            .setPort(9160)
                            .setMaxConnsPerHost(3)
                            .setSeeds("127.0.0.1:9160")
            )
            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
            .buildKeyspace(ThriftFamilyFactory.getInstance());


    context.start();
    return context.getClient();
}
 
开发者ID:Esquive,项目名称:iticrawler,代码行数:22,代码来源:StorageCluster.java


示例3: initialSetup

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
public void initialSetup() throws NotFoundException, InvalidRequestException, NoSuchFieldException, UnavailableException, IllegalAccessException, InstantiationException, ClassNotFoundException, TimedOutException, URISyntaxException, IOException, TException {
  context = new AstyanaxContext.Builder()
  .forCluster(_cluster) //"Test Cluster"
  .forKeyspace(_keyspaceName)
  .withAstyanaxConfiguration(new AstyanaxConfigurationImpl().setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE))
  .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl(_pool).setPort(_port).setMaxConnsPerHost(1).setSeeds(_host+":"+_port))
  .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
  .buildKeyspace(ThriftFamilyFactory.getInstance());

  context.start();
  GlobalVariables.KS_AST = context.getClient();

  CF_AST_BACK = ColumnFamily
      .newColumnFamily(_columnFamilyNameBack,
        StringSerializer.get(),  // Key Serializer
        StringSerializer.get()) ;  // Column Serializer 

  CF_AST_DYNA = ColumnFamily
      .newColumnFamily(_columnFamilyNameDyna,
        StringSerializer.get(),  // Key Serializer
        StringSerializer.get()) ;  // Column Serializer

  this.cliSchema();
}
 
开发者ID:faustineinsun,项目名称:WiseCrowdRec,代码行数:25,代码来源:AstyanaxCassandraManipulator.java


示例4: deleteCassandraKeySpace

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
public static void deleteCassandraKeySpace(String cassandraConnString, String keySpace) throws Exception {

        try {
            AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
                    .forCluster("ClusterName")
                    .forKeyspace(keySpace)
                    .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                                    .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
                    )
                    .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
                                    .setMaxConnsPerHost(1)
                                    .setSeeds(cassandraConnString)
                    )
                    .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
                    .buildKeyspace(ThriftFamilyFactory.getInstance());

            context.start();
            Keyspace keyspace = context.getClient();
            keyspace.dropKeyspace();
            context.shutdown();
        } catch (BadRequestException e) {
            LOG.warn("Could not delete cassandra keyspace, assuming it does not exist.", e);
        }
    }
 
开发者ID:Parth-Brahmbhatt,项目名称:storm-smoke-test,代码行数:25,代码来源:CleanupUtils.java


示例5: getConnection

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
/**
 * Creates connection to Cassandra
 */
public static Keyspace getConnection() {
    final AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
            .forCluster("ClusterName")
            .forKeyspace(KEYSPACE_NAME)
            .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                    .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
            )
            .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
                    .setPort(9160)
                    .setMaxConnsPerHost(1)
                    .setSeeds("127.0.0.1:9160")
                    .setSocketTimeout(60000)
            )
            .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                    .setCqlVersion("3.0.0")
                    .setTargetCassandraVersion("1.2")
            )
            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
            .buildKeyspace(ThriftFamilyFactory.getInstance());

    context.start();
    return context.getClient();
}
 
开发者ID:Benky,项目名称:webdav-cassandra,代码行数:27,代码来源:CassandraUtils.java


示例6: initWithThriftDriverWithEurekaHostsSupplier

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
private AstyanaxContext<Keyspace> initWithThriftDriverWithEurekaHostsSupplier() {
    logger.info("Boot cluster (BOOT_CLUSTER) is {}, keyspace name (KS_NAME) is {}", BOOT_CLUSTER, KS_NAME);

    return new AstyanaxContext.Builder()
            .forCluster(BOOT_CLUSTER)
            .forKeyspace(KS_NAME)
            .withAstyanaxConfiguration(
                    new AstyanaxConfigurationImpl()
                            .setDiscoveryType(
                                    NodeDiscoveryType.DISCOVERY_SERVICE))
            .withConnectionPoolConfiguration(
                    new ConnectionPoolConfigurationImpl(
                            "MyConnectionPool")
                            .setMaxConnsPerHost(3)
                            .setPort(thriftPortForAstyanax))
            .withHostSupplier(eurekaHostsSupplier.getSupplier(BOOT_CLUSTER))
            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
            .buildKeyspace(ThriftFamilyFactory.getInstance());

}
 
开发者ID:Netflix,项目名称:Raigad,代码行数:21,代码来源:InstanceDataDAOCassandra.java


示例7: initWithThriftDriverWithExternalHostsSupplier

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
private AstyanaxContext<Keyspace> initWithThriftDriverWithExternalHostsSupplier() {
    logger.info("Boot cluster (BOOT_CLUSTER) is {}, keyspace name (KS_NAME) is {}", BOOT_CLUSTER, KS_NAME);

    return new AstyanaxContext.Builder()
            .forCluster(BOOT_CLUSTER)
            .forKeyspace(KS_NAME)
            .withAstyanaxConfiguration(
                    new AstyanaxConfigurationImpl()
                            .setDiscoveryType(
                                    NodeDiscoveryType.DISCOVERY_SERVICE)
                            .setConnectionPoolType(
                                    ConnectionPoolType.ROUND_ROBIN))
            .withConnectionPoolConfiguration(
                    new ConnectionPoolConfigurationImpl(
                            "MyConnectionPool")
                            .setMaxConnsPerHost(3)
                            .setPort(thriftPortForAstyanax))
            .withHostSupplier(getSupplier())
            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
            .buildKeyspace(ThriftFamilyFactory.getInstance());

}
 
开发者ID:Netflix,项目名称:Raigad,代码行数:23,代码来源:InstanceDataDAOCassandra.java


示例8: setProperties

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
@Override
public void setProperties(Map<String, Object> properties) {
  super.setProperties(properties);
  AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
  .forCluster("ClusterName")
  .forKeyspace((String) properties.get(KEYSPACE))
  .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()      
      .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
  )
  .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
      .setPort((int)properties.get(PORT))
      .setMaxConnsPerHost(1)
      .setSeeds((String) properties.get(HOST_LIST))
  )
  .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
  .buildKeyspace(ThriftFamilyFactory.getInstance() );
  context.start();
  
  keyspace = context.getEntity(); 
}
 
开发者ID:edwardcapriolo,项目名称:teknek-cassandra,代码行数:21,代码来源:CassandraOperator.java


示例9: TimedGroupByEngine

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
public TimedGroupByEngine(String ks, int port, String hostlist){
  AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
  .forCluster("ClusterName")
  .forKeyspace(ks)
  .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()      
      .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
  )
  .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
      .setPort(port)
      .setMaxConnsPerHost(1)
      .setSeeds(hostlist)
  )
  .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
  .buildKeyspace(ThriftFamilyFactory.getInstance() );
  context.start();
  keyspace = context.getEntity();
}
 
开发者ID:edwardcapriolo,项目名称:teknek-cassandra,代码行数:18,代码来源:TimedGroupByEngine.java


示例10: setProperties

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
@Override
public void setProperties(Map<String, Object> properties) {
  super.setProperties(properties);
  AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
  .forCluster("ClusterName")
  .forKeyspace((String) properties.get(KEYSPACE))
  .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()      
      .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
  )
  .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
      .setPort((int)properties.get(PORT))
      .setMaxConnsPerHost(1)
      .setSeeds((String) properties.get(HOST_LIST))
  )
  .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
  .buildKeyspace(ThriftFamilyFactory.getInstance() );
  context.start();
  batchSize = (Integer) properties.get(BATCH_SIZE);
  keyspace = context.getEntity();
  m = keyspace.prepareMutationBatch();
}
 
开发者ID:edwardcapriolo,项目名称:teknek-cassandra,代码行数:22,代码来源:CassandraBatchingOperator.java


示例11: CassandraArtifactCache

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
public CassandraArtifactCache(
    String hosts,
    int port,
    int timeoutSeconds,
    boolean doStore,
    BuckEventBus buckEventBus)
    throws ConnectionException {
  this(timeoutSeconds, doStore, buckEventBus, new AstyanaxContext.Builder()
          .forCluster(CLUSTER_NAME)
          .forKeyspace(KEYSPACE_NAME)
          .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                  .setCqlVersion("3.0.0")
                  .setTargetCassandraVersion("1.2")
                  .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
          )
          .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl(POOL_NAME)
                  .setSeeds(hosts)
                  .setPort(port)
                  .setMaxConnsPerHost(1)
          )
          .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
          .buildKeyspace(ThriftFamilyFactory.getInstance()));
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:24,代码来源:CassandraArtifactCache.java


示例12: beforeClass

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {

    astyanaxContext =
            new AstyanaxContext.Builder()
                    .forKeyspace("timeSeriesKeyspace")
                    .withConnectionPoolConfiguration(
                            new ConnectionPoolConfigurationImpl("myCPConfig")
                                    .setSeeds("localhost")
                                    .setPort(9171))
                    .withAstyanaxConfiguration(
                            new AstyanaxConfigurationImpl()
                                    .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
                                    .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE))
                    .buildKeyspace(ThriftFamilyFactory.getInstance());

    keyspace = astyanaxContext.getClient();
    astyanaxContext.start();
}
 
开发者ID:iZettle,项目名称:izettle-toolbox,代码行数:20,代码来源:TimeSeriesIT.java


示例13: setup

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
@Before
public void setup() {
	AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
			.forCluster("Test Cluster")
			.forKeyspace(KS)
			.withAstyanaxConfiguration(
					new AstyanaxConfigurationImpl()
							.setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE))
			.withConnectionPoolConfiguration(
					new ConnectionPoolConfigurationImpl("MyConnectionPool")
							.setPort(9160).setMaxConnsPerHost(1)
							.setSeeds("127.0.0.1:9160"))
			.withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
			.buildKeyspace(ThriftFamilyFactory.getInstance());

	context.start();
	keyspace = context.getClient();
}
 
开发者ID:Netflix,项目名称:staash,代码行数:19,代码来源:TestChunking.java


示例14: connect

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
private static AstyanaxContext<Keyspace> connect(String host, int port, String keyspace, int threads, NodeDiscoveryType discovery) {
    AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
                    .forKeyspace(keyspace)
            .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                .setDiscoveryType(discovery)
                .setRetryPolicy(new RetryNTimes(10)))
                
            .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl(host + ":" + keyspace)
                    .setMaxConns(threads * 2)
                    .setSeeds(host)
                    .setPort(port)
                    .setRetryBackoffStrategy(new FixedRetryBackoffStrategy(1000, 1000)))
            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
            .buildKeyspace(ThriftFamilyFactory.getInstance());
    context.start();
    return context;
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:18,代码来源:Migration.java


示例15: testCassandraContext

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
public static AstyanaxContext<Keyspace> testCassandraContext() {
    return new AstyanaxContext.Builder()
            .forCluster(CLUSTER_NAME)
            .forKeyspace(KEYSPACE_NAME)
            .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                    .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
                    .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN)
                    .setAsyncExecutor(Executors.newFixedThreadPool(
                            CLIENT_THREADS,
                            new ThreadFactoryBuilder().setDaemon(true)
                                    .setNameFormat("astyanax-%d")
                                    .build()
                    ))
            )
            .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("Atlas")
                    .setPort(PORT)
                    .setMaxBlockedThreadsPerHost(CLIENT_THREADS)
                    .setMaxConnsPerHost(CLIENT_THREADS)
                    .setMaxConns(CLIENT_THREADS * 5)
                    .setConnectTimeout(CONNECTION_TIMEOUT)
                    .setSeeds(SEEDS)
            )
            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
            .buildKeyspace(ThriftFamilyFactory.getInstance());
}
 
开发者ID:atlasapi,项目名称:atlas-deer,代码行数:26,代码来源:CassandraHelper.java


示例16: CassandraStorage

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
public CassandraStorage(String keySpace) {
    context = new AstyanaxContext.Builder()
            .forKeyspace(keySpace)
            .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                    .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
            )
            .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
                    .setMaxConnsPerHost(1)
                    .setSeeds("127.0.0.1:9160")
            )
            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
            .buildKeyspace(ThriftFamilyFactory.getInstance());
}
 
开发者ID:datathings,项目名称:greycat,代码行数:14,代码来源:CassandraStorage.java


示例17: reconfigure

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
private void reconfigure() throws ConnectionException {

        String seeds = MultiValueConfigLoader.getConfig("CASSANDRA-" + getInstanceName() + ".seeds", "localhost");
        String clusterName = MultiValueConfigLoader.getConfig("CASSANDRA-" + getInstanceName() + ".clusterName", "Test Cluster");
        
        ConsistencyLevel readCL = ConsistencyLevel.CL_ONE;
        ConsistencyLevel writeCL = ConsistencyLevel.CL_ONE;
        if(config.containsKey(CassandraConstants.READ_CONSISTENCY)) {
            readCL = ConsistencyLevel.valueOf(config.get(CassandraConstants.READ_CONSISTENCY));
        }
        
        if(config.containsKey(CassandraConstants.WRITE_CONSISTENCY)) {
            writeCL = ConsistencyLevel.valueOf(config.get(CassandraConstants.WRITE_CONSISTENCY));
        }

        AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
                .forCluster(clusterName)
                .forKeyspace(blobKSName)
                .withAstyanaxConfiguration(
                        new AstyanaxConfigurationImpl().setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE).setDefaultReadConsistencyLevel(readCL).setDefaultWriteConsistencyLevel(writeCL))
                .withConnectionPoolConfiguration(
                        new ConnectionPoolConfigurationImpl("astyanaxConnectionPool").setPort(9160).setMaxConnsPerHost(1).setSeeds(seeds))
                .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()).buildKeyspace(ThriftFamilyFactory.getInstance());

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

        createSchema();

        chunkedProvider = new CassandraChunkedStorageProvider(keyspace, blobCF);
    }
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:32,代码来源:CassandraBlobStore.java


示例18: initConnection

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
private void initConnection(String clusterName, String seeds) {
    log.info(String.format("Connecting to Cassandra at %s:%s", clusterName, seeds));
    AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
            .forCluster(clusterName)
            .forKeyspace(keyspaceName)
            .withAstyanaxConfiguration(
                    new AstyanaxConfigurationImpl().setRetryPolicy(new ExponentialBackoff(retryDelay, numberOfRetries))
                            .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE).setDefaultReadConsistencyLevel(readCL)
                            .setDefaultWriteConsistencyLevel(writeCL))
            .withConnectionPoolConfiguration(
                    new ConnectionPoolConfigurationImpl("astyanaxConnectionPool").setPort(9160).setMaxConnsPerHost(connectionPoolSize).setSeeds(seeds))
            .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()).buildKeyspace(ThriftFamilyFactory.getInstance());
    context.start();
    keyspace = context.getClient();
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:16,代码来源:AstyanaxCassandraBase.java


示例19: setupCassandraKeySpace

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
public static void setupCassandraKeySpace(String cassandraConnectionString, String keySpaceName,
                                          String columnFamily) throws ConnectionException {

    try {
        AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
                .forCluster("ClusterName")
                .forKeyspace(keySpaceName)
                .withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
                                .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
                )
                .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
                                .setMaxConnsPerHost(1)
                                .setSeeds(cassandraConnectionString)
                )
                .withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
                .buildKeyspace(ThriftFamilyFactory.getInstance());

        context.start();
        Keyspace keyspace = context.getClient();

        // Using simple strategy
        keyspace.createKeyspace(ImmutableMap.<String, Object>builder()
                        .put("strategy_options", ImmutableMap.<String, Object>builder()
                                .put("replication_factor", "1")
                                .build())
                        .put("strategy_class", "SimpleStrategy")
                        .build()
        );

        ColumnFamily<String, String> CF_STANDARD1 = ColumnFamily.newColumnFamily(columnFamily,
                StringSerializer.get(), StringSerializer.get());

        keyspace.createColumnFamily(CF_STANDARD1, null);
        context.shutdown();
    } catch(BadRequestException e) {
        LOG.warn("could not setup cassandra keyspace , assuming keyspace already exists.", e);
    }
}
 
开发者ID:Parth-Brahmbhatt,项目名称:storm-smoke-test,代码行数:39,代码来源:SetupUtils.java


示例20: astyanaxConfiguration

import com.netflix.astyanax.connectionpool.NodeDiscoveryType; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(AstyanaxConfiguration.class)
@ConfigurationProperties("cassandra")
public AstyanaxConfiguration astyanaxConfiguration(@Qualifier("cassandraAsyncExecutor") ExecutorService cassandraAsyncExecutor) {
    return new AstyanaxConfigurationImpl()
            .setDefaultReadConsistencyLevel(ConsistencyLevel.CL_LOCAL_QUORUM)
            .setDefaultWriteConsistencyLevel(ConsistencyLevel.CL_LOCAL_QUORUM)
            .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE)
            .setConnectionPoolType(ConnectionPoolType.TOKEN_AWARE)
            .setCqlVersion("3.0.0")
            .setTargetCassandraVersion("2.0")
            .setAsyncExecutor(cassandraAsyncExecutor);
}
 
开发者ID:spinnaker,项目名称:kork,代码行数:14,代码来源:AstyanaxComponents.java



注:本文中的com.netflix.astyanax.connectionpool.NodeDiscoveryType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CanvasElement类代码示例发布时间:2022-05-21
下一篇:
Java ContentCachingRequestWrapper类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap