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


Java SolrZkClient.makePath方法代码示例

本文整理汇总了Java中org.apache.solr.common.cloud.SolrZkClient.makePath方法的典型用法代码示例。如果您正苦于以下问题:Java SolrZkClient.makePath方法的具体用法?Java SolrZkClient.makePath怎么用?Java SolrZkClient.makePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.common.cloud.SolrZkClient的用法示例。


在下文中一共展示了SolrZkClient.makePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkChrootPath

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
/**
 * Validates if the chroot exists in zk (or if it is successfully created).
 * Optionally, if create is set to true this method will create the path in
 * case it doesn't exist
 * 
 * @return true if the path exists or is created false if the path doesn't
 *         exist and 'create' = false
 */
public static boolean checkChrootPath(String zkHost, boolean create)
    throws KeeperException, InterruptedException {
  if (!containsChroot(zkHost)) {
    return true;
  }
  log.info("zkHost includes chroot");
  String chrootPath = zkHost.substring(zkHost.indexOf("/"), zkHost.length());
  SolrZkClient tmpClient = new SolrZkClient(zkHost.substring(0,
      zkHost.indexOf("/")), 60 * 1000);
  boolean exists = tmpClient.exists(chrootPath, true);
  if (!exists && create) {
    tmpClient.makePath(chrootPath, false, true);
    exists = true;
  }
  tmpClient.close();
  return exists;
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:ZkController.java

示例2: setUp

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
  super.setUp();
  dataDir1 = createTempDir();
  dataDir2  = createTempDir();

  home = ExternalPaths.EXAMPLE_MULTICORE_HOME;
  System.setProperty("solr.solr.home", home);
  System.setProperty( "solr.core0.data.dir", dataDir1.getCanonicalPath() ); 
  System.setProperty( "solr.core1.data.dir", dataDir2.getCanonicalPath() ); 
  
  zkDir = dataDir1.getAbsolutePath() + File.separator
      + "zookeeper/server1/data";
  zkServer = new ZkTestServer(zkDir);
  zkServer.run();
  
  SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
  zkClient.makePath("/solr", false, true);
  zkClient.close();
  
  System.setProperty("zkHost", zkServer.getZkAddress());
}
 
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:TestMultiCoreConfBootstrap.java

示例3: setUp

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
  super.setUp();
  log.info("####SETUP_START " + getTestName());
  createTempDir();
  
  zkDir = dataDir.getAbsolutePath() + File.separator
      + "zookeeper/server1/data";
  log.info("ZooKeeper dataDir:" + zkDir);
  zkServer = new ZkTestServer(zkDir);
  zkServer.run();
  System.setProperty("zkHost", zkServer.getZkAddress());
  SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
  zkClient.makePath("/solr", false, true);
  zkClient.close();

  
  this.zkClient = new SolrZkClient(zkServer.getZkAddress(),
      AbstractZkTestCase.TIMEOUT);
  
  log.info("####SETUP_END " + getTestName());
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:23,代码来源:ZkCLITest.java

示例4: setUp

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
@Override
@Before
public void setUp() throws Exception {
  super.setUp();
  
  createTempDir();
  dataDir2 = new File(TEMP_DIR, getSimpleClassName() + "-core1-"
      + System.currentTimeMillis());
  dataDir2.mkdirs();

  home = ExternalPaths.EXAMPLE_MULTICORE_HOME;
  System.setProperty("solr.solr.home", home);
  System.setProperty( "solr.core0.data.dir", dataDir.getCanonicalPath() ); 
  System.setProperty( "solr.core1.data.dir", dataDir2.getCanonicalPath() ); 
  
  zkDir = dataDir.getAbsolutePath() + File.separator
      + "zookeeper/server1/data";
  zkServer = new ZkTestServer(zkDir);
  zkServer.run();
  
  SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
  zkClient.makePath("/solr", false, true);
  zkClient.close();
  
  System.setProperty("zkHost", zkServer.getZkAddress());
}
 
开发者ID:netboynb,项目名称:search-core,代码行数:27,代码来源:TestMultiCoreConfBootstrap.java

示例5: putConfig

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
public static void putConfig(String confName, SolrZkClient zkClient, File solrhome, final String srcName,
                             String destName) throws Exception {
    File file = new File(solrhome, "collection1" + File.separator + "conf" + File.separator + srcName);
    if (!file.exists()) {
        log.info("zk skipping " + file.getAbsolutePath() + " because it doesn't exist");
        return;
    }

    String destPath = "/configs/" + confName + "/" + destName;
    log.info("zk put " + file.getAbsolutePath() + " to " + destPath);
    zkClient.makePath(destPath, file, false, true);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:SolrCloudFixture.java

示例6: putConfig

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
public static void putConfig(String confName, SolrZkClient zkClient, File solrhome, final String srcName, String destName)
    throws Exception {
  File file = new File(solrhome, "collection1"
      + File.separator + "conf" + File.separator + srcName);
  if (!file.exists()) {
    log.info("skipping " + file.getAbsolutePath() + " because it doesn't exist");
    return;
  }

  String destPath = "/configs/" + confName + "/" + destName;
  log.info("put " + file.getAbsolutePath() + " to " + destPath);
  zkClient.makePath(destPath, file, false, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:14,代码来源:AbstractZkTestCase.java

示例7: putConfig

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
private static void putConfig(SolrZkClient zkClient, File solrhome, String srcName, String destName)
    throws Exception {
  
  File file = new File(solrhome, "conf" + File.separator + srcName);
  if (!file.exists()) {
    // LOG.info("skipping " + file.getAbsolutePath() +
    // " because it doesn't exist");
    return;
  }
  
  String destPath = "/configs/conf1/" + destName;
  // LOG.info("put " + file.getAbsolutePath() + " to " + destPath);
  zkClient.makePath(destPath, file, false, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:MorphlineGoLiveMiniMRTest.java

示例8: uploadToZK

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
public static void uploadToZK(SolrZkClient zkClient, File dir, String zkPath) throws IOException, KeeperException, InterruptedException {
  File[] files = dir.listFiles();
  if (files == null) {
    throw new IllegalArgumentException("Illegal directory: " + dir);
  }
  for(File file : files) {
    if (!file.getName().startsWith(".")) {
      if (!file.isDirectory()) {
        zkClient.makePath(zkPath + "/" + file.getName(), file, false, true);
      } else {
        uploadToZK(zkClient, file, zkPath + "/" + file.getName());
      }
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:ZkController.java

示例9: setUp

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
  super.setUp();
  log.info("####SETUP_START " + getTestName());
  
  boolean useNewSolrXml = random().nextBoolean();
  File tmpDir = createTempDir();
  if (useNewSolrXml) {
    solrHome = ExternalPaths.EXAMPLE_HOME;
  } else {
    File tmpSolrHome = new File(tmpDir, "tmp-solr-home");
    FileUtils.copyDirectory(new File(ExternalPaths.EXAMPLE_HOME), tmpSolrHome);
    FileUtils.copyFile(getFile("old-solr-example/solr.xml"), new File(tmpSolrHome, "solr.xml"));
    solrHome = tmpSolrHome.getAbsolutePath();
  }
  
  
  zkDir = tmpDir.getAbsolutePath() + File.separator
      + "zookeeper/server1/data";
  log.info("ZooKeeper dataDir:" + zkDir);
  zkServer = new ZkTestServer(zkDir);
  zkServer.run();
  System.setProperty("zkHost", zkServer.getZkAddress());
  SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
  zkClient.makePath("/solr", false, true);
  zkClient.close();

  
  this.zkClient = new SolrZkClient(zkServer.getZkAddress(),
      AbstractZkTestCase.TIMEOUT);
  
  log.info("####SETUP_END " + getTestName());
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:ZkCLITest.java

示例10: testClean

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
public void testClean() throws Exception {
  try (ZkConnection conn = new ZkConnection ()) {
    final SolrZkClient zkClient = conn.getClient();

    zkClient.makePath("/test/path/here", true);

    zkClient.makePath("/zz/path/here", true);

    zkClient.clean("/");

    assertFalse(zkClient.exists("/test", true));
    assertFalse(zkClient.exists("/zz", true));
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:ZkSolrClientTest.java

示例11: testMultipleWatchesAsync

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
public void testMultipleWatchesAsync() throws Exception {
  try (ZkConnection conn = new ZkConnection ()) {
    final SolrZkClient zkClient = conn.getClient();
    zkClient.makePath("/collections", true);

    final int numColls = random().nextInt(100);
    final CountDownLatch latch = new CountDownLatch(numColls);

    for (int i = 1; i <= numColls; i ++) {
      String collPath = "/collections/collection" + i;
      zkClient.makePath(collPath, true);
      zkClient.getChildren(collPath, new Watcher() {
        @Override
        public void process(WatchedEvent event) {
          latch.countDown();
          try {
            Thread.sleep(1000);
          }
          catch (InterruptedException e) {}
        }
      }, true);
    }

    for (int i = 1; i <= numColls; i ++) {
      String shardsPath = "/collections/collection" + i + "/shards";
      zkClient.makePath(shardsPath, true);
    }

    assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:32,代码来源:ZkSolrClientTest.java

示例12: MockZKController

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
public MockZKController(String zkAddress, String nodeName) throws InterruptedException, TimeoutException, IOException, KeeperException {
  this.nodeName = nodeName;
  zkClient = new SolrZkClient(zkAddress, TIMEOUT);
  zkStateReader = new ZkStateReader(zkClient);
  zkStateReader.createClusterStateWatchersAndUpdate();
  
  // live node
  final String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName;
  zkClient.makePath(nodePath, CreateMode.EPHEMERAL, true);
  elector = new LeaderElector(zkClient);
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:OverseerTest.java

示例13: MockZKController

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
public MockZKController(String zkAddress, String nodeName, String collection) throws InterruptedException, TimeoutException, IOException, KeeperException {
  this.nodeName = nodeName;
  this.collection = collection;
  zkClient = new SolrZkClient(zkAddress, TIMEOUT);
  zkStateReader = new ZkStateReader(zkClient);
  zkStateReader.createClusterStateWatchersAndUpdate();
  
  // live node
  final String nodePath = ZkStateReader.LIVE_NODES_ZKNODE + "/" + nodeName;
  zkClient.makePath(nodePath, CreateMode.EPHEMERAL, true);
  elector = new LeaderElector(zkClient);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:13,代码来源:OverseerTest.java

示例14: makeSolrZkNode

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
public static void makeSolrZkNode(String zkHost) throws Exception {
  SolrZkClient zkClient = new SolrZkClient(zkHost, TIMEOUT);
  zkClient.makePath("/solr", false, true);
  zkClient.close();
}
 
开发者ID:europeana,项目名称:search,代码行数:6,代码来源:AbstractZkTestCase.java

示例15: putConfig

import org.apache.solr.common.cloud.SolrZkClient; //导入方法依赖的package包/类
private void putConfig(SolrZkClient zkClient, String name) throws Exception {
  File file = new File(new File(SOLR_CONF_DIR, "conf"), name);    
  String destPath = "/configs/conf1/" + name;
  System.out.println("put " + file.getAbsolutePath() + " to " + destPath);
  zkClient.makePath(destPath, file, false, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:AbstractSolrMorphlineZkTestBase.java


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