当前位置: 首页>>代码示例>>Java>>正文


Java NodeDiscoveryType类代码示例

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


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


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