org.apache.solr.cloud.ZkTestServer.getZkAddress()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(76)

本文整理了Java中org.apache.solr.cloud.ZkTestServer.getZkAddress()方法的一些代码示例,展示了ZkTestServer.getZkAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkTestServer.getZkAddress()方法的具体详情如下:
包路径:org.apache.solr.cloud.ZkTestServer
类名称:ZkTestServer
方法名:getZkAddress

ZkTestServer.getZkAddress介绍

[英]Get a connection string for this server with a given chroot
[中]获取具有给定chroot的此服务器的连接字符串

代码示例

代码示例来源:origin: org.apache.solr/solr-test-framework

public String getZkAddress() {
 return getZkAddress("/solr");
}

代码示例来源:origin: apache/atlas

public static String getZookeeperUrls() {
  return miniSolrCloudCluster.getZkServer().getZkAddress();
}

代码示例来源:origin: org.apache.solr/solr-test-framework

protected CloudSolrClient buildSolrClient() {
 return new Builder(Collections.singletonList(getZkServer().getZkAddress()), Optional.empty())
   .build();
}

代码示例来源:origin: org.apache.solr/solr-test-framework

@BeforeClass
public static void azt_beforeClass() throws Exception {
 zkDir = createTempDir("zkData").toFile().getAbsolutePath();
 zkServer = new ZkTestServer(zkDir);
 zkServer.run();
 
 System.setProperty("solrcloud.skip.autorecovery", "true");
 System.setProperty("zkHost", zkServer.getZkAddress());
 System.setProperty("jetty.port", "0000");
 System.setProperty(ZOOKEEPER_FORCE_SYNC, "false");
 
 buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(), SOLRHOME,
   "solrconfig.xml", "schema.xml");
 initCore("solrconfig.xml", "schema.xml");
}

代码示例来源:origin: org.apache.solr/solr-test-framework

protected CloudSolrClient createCloudClient(String defaultCollection) {
 CloudSolrClient client = getCloudSolrClient(zkServer.getZkAddress(), random().nextBoolean(), 30000, 60000);
 if (defaultCollection != null) client.setDefaultCollection(defaultCollection);
 return client;
}

代码示例来源:origin: org.apache.solr/solr-test-framework

@Override
public void distribSetUp() throws Exception {
 super.distribSetUp();
 
 String zkDir = testDir.getAbsolutePath() + File.separator
 + "zookeeper/server1/data";
 zkServer = new ZkTestServer(zkDir);
 zkServer.run();
 
 System.setProperty(ZK_HOST, zkServer.getZkAddress());
 System.setProperty(ENABLE_UPDATE_LOG, "true");
 System.setProperty(REMOVE_VERSION_FIELD, "true");
 System.setProperty(ZOOKEEPER_FORCE_SYNC, "false");
 System.setProperty(MockDirectoryFactory.SOLR_TESTS_ALLOW_READING_FILES_STILL_OPEN_FOR_WRITE, "true");
 String schema = getCloudSchemaFile();
 if (schema == null) schema = "schema.xml";
 AbstractZkTestCase.buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(), getCloudSolrConfig(), schema);
 // set some system properties for use by tests
 System.setProperty("solr.test.sys.prop1", "propone");
 System.setProperty("solr.test.sys.prop2", "proptwo");
}

代码示例来源:origin: org.apache.solr/solr-test-framework

public CloudSolrClientBuilder(MiniSolrCloudCluster cluster) {
 if (random().nextBoolean()) {
  this.zkHosts.add(cluster.getZkServer().getZkAddress());
 } else {
  populateSolrUrls(cluster);
 }
 
 randomizeCloudSolrClient();
}

代码示例来源:origin: org.apache.solr/solr-test-framework

/**
 * Upload a config set
 * @param configDir a path to the config set to upload
 * @param configName the name to give the configset
 */
public void uploadConfigSet(Path configDir, String configName) throws IOException, KeeperException, InterruptedException {
 try(SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(),
   AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT, null)) {
  ZkConfigManager manager = new ZkConfigManager(zkClient);
  manager.uploadConfigDir(configDir, configName);
 }
}

代码示例来源:origin: org.apache.solr/solr-test-framework

protected CloudSolrClient getCommonCloudSolrClient() {
 synchronized (this) {
  if (commonCloudSolrClient == null) {
   commonCloudSolrClient = getCloudSolrClient(zkServer.getZkAddress(),
     random().nextBoolean(), 5000, 120000);
   commonCloudSolrClient.setDefaultCollection(DEFAULT_COLLECTION);
   commonCloudSolrClient.connect();
   log.info("Created commonCloudSolrClient with updatesToLeaders={} and parallelUpdates={}",
     commonCloudSolrClient.isUpdatesToLeaders(), commonCloudSolrClient.isParallelUpdates());
  }
 }
 return commonCloudSolrClient;
}

代码示例来源:origin: org.apache.solr/solr-test-framework

System.setProperty("zkHost", zkServer.getZkAddress());

代码示例来源:origin: org.apache.solr/solr-test-framework

@Override
public void distribSetUp() throws Exception {
 super.distribSetUp();
 // ignoreException(".*");
 if (sliceCount > 0) {
  System.setProperty("numShards", Integer.toString(sliceCount));
 } else {
  System.clearProperty("numShards");
 }
 if (isSSLMode()) {
  System.clearProperty("urlScheme");
  try (ZkStateReader zkStateReader = new ZkStateReader(zkServer.getZkAddress(),
    AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT)) {
   try {
    zkStateReader.getZkClient().create(ZkStateReader.CLUSTER_PROPS,
      Utils.toJSON(Collections.singletonMap("urlScheme", "https")),
      CreateMode.PERSISTENT, true);
   } catch (KeeperException.NodeExistsException e) {
    ZkNodeProps props = ZkNodeProps.load(zkStateReader.getZkClient().getData(ZkStateReader.CLUSTER_PROPS,
      null, null, true));
    zkStateReader.getZkClient().setData(ZkStateReader.CLUSTER_PROPS, Utils.toJSON(props.plus("urlScheme", "https")), true);
   }
  }
 }
 if (useTlogReplicas()) {
  log.info("Will use {} replicas unless explicitly asked otherwise", Replica.Type.TLOG);
 } else {
  log.info("Will use {} replicas unless explicitly asked otherwise", Replica.Type.NRT);
 }
}

代码示例来源:origin: org.apache.solr/solr-test-framework

try (ZkStateReader zk = new ZkStateReader(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT,
  AbstractZkTestCase.TIMEOUT)) {
 zk.createClusterStateWatchersAndUpdate();

代码示例来源:origin: kite-sdk/kite

protected Command parse(String file, String collection) throws IOException {
 SolrLocator locator = new SolrLocator(createMorphlineContext());
 locator.setCollectionName(collection);
 locator.setZkHost(cluster.getZkServer().getZkAddress());
 //locator.setServerUrl(cloudJettys.get(0).url); // TODO: download IndexSchema from solrUrl not yet implemented
 //locator.setSolrHomeDir(SOLR_HOME_DIR.getPath());
 Config config = new Compiler().parse(new File(RESOURCES_DIR + "/" + file + ".conf"), locator.toConfig("SOLR_LOCATOR"));
 config = config.getConfigList("morphlines").get(0);
 return createMorphline(config);
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-io-solr

@Test
public void testBadCredentials() throws IOException {
 thrown.expect(SolrException.class);
 String zkAddress = cluster.getZkServer().getZkAddress();
 SolrIO.ConnectionConfiguration connectionConfiguration =
   SolrIO.ConnectionConfiguration.create(zkAddress)
     .withBasicCredentials("solr", "wrongpassword");
 try (AuthorizedSolrClient solrClient = connectionConfiguration.createClient()) {
  SolrIOTestUtils.insertTestDocuments(SOLR_COLLECTION, NUM_DOCS, solrClient);
 }
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-io-solr

.getZkClient()
  .setData("/security.json", securityJson.getBytes(Charset.defaultCharset()), true);
String zkAddress = cluster.getZkServer().getZkAddress();
connectionConfiguration =
  SolrIO.ConnectionConfiguration.create(zkAddress).withBasicCredentials("solr", password);

相关文章

ZkTestServer类方法