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


Java MiniSolrCloudCluster类代码示例

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


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

示例1: startCluster

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
@BeforeClass
public static void startCluster() throws Exception {
  TEMP_DIR = Files.createTempDirectory("MiniSolrCloudCluster");

  JettyConfig.Builder jettyConfig = JettyConfig.builder();
  jettyConfig.waitForLoadingCoresToFinish(null);

  cluster = new MiniSolrCloudCluster(1, TEMP_DIR, jettyConfig.build());
  cloudSolrClient = cluster.getSolrClient();
  cloudSolrClient.connect();
  assertTrue(!cloudSolrClient.getZkStateReader().getClusterState().getLiveNodes().isEmpty());

  uploadDefaultConfigSet();
  createDefaultCollection();
  verifyCluster();
  log.info("Start Solr Cluster");
}
 
开发者ID:lucidworks,项目名称:solr-hadoop-common,代码行数:18,代码来源:SolrCloudClusterSupport.java

示例2: startCluster

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
@BeforeClass
public static void startCluster() throws Exception {
  File solrXml = new File("src/test/resources/solr.xml");

  tempDir = Files.createTempDirectory("MiniSolrCloudCluster");

  try {
    cluster = new MiniSolrCloudCluster(1, null, tempDir, MiniSolrCloudCluster.DEFAULT_CLOUD_SOLR_XML, null, null);
  } catch (Exception exc) {
    log.error("Failed to initialize a MiniSolrCloudCluster due to: " + exc, exc);
    throw exc;
  }

  cloudSolrClient = new CloudSolrClient(cluster.getZkServer().getZkAddress(), true);
  cloudSolrClient.connect();

  assertTrue(!cloudSolrClient.getZkStateReader().getClusterState().getLiveNodes().isEmpty());
}
 
开发者ID:lucidworks,项目名称:storm-solr,代码行数:19,代码来源:TestSolrCloudClusterSupport.java

示例3: start

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
@Override
public void start() throws UnableToStartException {
  try {
    File baseDir = Files.createTempDirectory("solrcomponent").toFile();
    baseDir.deleteOnExit();
    miniSolrCloudCluster = new MiniSolrCloudCluster(1, baseDir, new File(solrXmlPath), JettyConfig.builder().setPort(port).build());
    for(String name: collections.keySet()) {
      String configPath = collections.get(name);
      miniSolrCloudCluster.uploadConfigDir(new File(configPath), name);
    }
    miniSolrCloudCluster.createCollection("metron", 1, 1, "metron", new HashMap<String, String>());
    if (postStartCallback != null) postStartCallback.apply(this);
  } catch(Exception e) {
    throw new UnableToStartException(e.getMessage(), e);
  }
}
 
开发者ID:apache,项目名称:metron,代码行数:17,代码来源:SolrComponent.java

示例4: SolrCloudFixture

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
public SolrCloudFixture(String solrHome) throws Exception {
    String xml = IOHelper.loadText(new FileInputStream(new File(solrHome, "solr-no-core.xml")));
    miniCluster = new MiniSolrCloudCluster(1, "/solr", new File("target/tmp").toPath(), xml, null, null);
    String zkAddr = miniCluster.getZkServer().getZkAddress();
    String zkHost = miniCluster.getZkServer().getZkHost();

    buildZooKeeper(zkHost, zkAddr, new File(solrHome), "solrconfig.xml", "schema.xml");
    List<JettySolrRunner> jettys = miniCluster.getJettySolrRunners();
    for (JettySolrRunner jetty : jettys) {
        if (!jetty.isRunning()) {
            log.warn("JETTY NOT RUNNING!");
        } else {
            log.info("JETTY RUNNING AT " + jetty.getBaseUrl() + " PORT " + jetty.getLocalPort());
        }
    }

    solrClient = new CloudSolrClient(zkAddr, true);
    solrClient.connect();

    createCollection(solrClient, "collection1", 1, 1, "conf1");
    Thread.sleep(1000); // takes some time to setup the collection...
                        // otherwise you'll get no live solr servers
    solrClient.setDefaultCollection("collection1");

    SolrInputDocument doc = new SolrInputDocument();
    doc.setField("id", "1");

    solrClient.add(doc);
    solrClient.commit();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:31,代码来源:SolrCloudFixture.java

示例5: setUpBeforeClass

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception{
  // Set up a MiniSolrCloudCluster
  String testHome = SolrTestCaseJ4.TEST_HOME();
  miniCluster = new MiniSolrCloudCluster(1, null, new File(testHome, "solr-no-core.xml"),null, null);
  assertNotNull(miniCluster.getZkServer());
  miniCluster.getZkServer().setTheTickTime(5000);
  assertNotNull(miniCluster.getZkServer());

  // create collection
  System.setProperty("solr.tests.mergePolicy", "org.apache.lucene.index.TieredMergePolicy");
  uploadConfigToZk(SolrTestCaseJ4.TEST_HOME() + File.separator + "collection1" + File.separator + "conf", CONFIG_NAME);
  createCollection(COLLECTION_NAME, NUM_SHARDS, REPLICATION_FACTOR, CONFIG_NAME);

  //insert documents into the collection
  insertDocs();

  // Set up the HIVE directory structure
  FileUtils.forceMkdir(HIVE_BASE_DIR);
  FileUtils.forceMkdir(HIVE_SCRATCH_DIR);
  FileUtils.forceMkdir(HIVE_LOCAL_SCRATCH_DIR);
  FileUtils.forceMkdir(HIVE_LOGS_DIR);
  FileUtils.forceMkdir(HIVE_TMP_DIR);
  FileUtils.forceMkdir(HIVE_WAREHOUSE_DIR);
  FileUtils.forceMkdir(HIVE_HADOOP_TMP_DIR);
  FileUtils.forceMkdir(HIVE_TESTDATA_DIR);

  // Set up the HIVE property in the environment
  System.setProperty("tickTime", "5000");
  System.setProperty("hive.metastore.warehouse.dir",  HIVE_WAREHOUSE_DIR.getAbsolutePath());
  System.setProperty("hive.exec.scratchdir",  HIVE_SCRATCH_DIR.getAbsolutePath());
  System.setProperty("hive.exec.local.scratchdir", HIVE_LOCAL_SCRATCH_DIR.getAbsolutePath());
  System.setProperty("hive.metastore.metadb.dir", HIVE_METADB_DIR.getAbsolutePath());
  System.setProperty("test.log.dir", HIVE_LOGS_DIR.getAbsolutePath());
  System.setProperty("hive.querylog.location", HIVE_TMP_DIR.getAbsolutePath());
  System.setProperty("hadoop.tmp.dir", HIVE_HADOOP_TMP_DIR.getAbsolutePath());
  System.setProperty("derby.stream.error.file",HIVE_BASE_DIR.getAbsolutePath() + "/derby.log");
}
 
开发者ID:amitjaspal,项目名称:solr-storagehandler,代码行数:39,代码来源:TestSolrStorageHandler.java

示例6: beforeTestSimpleSolrEndToEnd

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
@BeforeClass
public static void beforeTestSimpleSolrEndToEnd() throws Exception {
  dfsCluster = HdfsTestUtil.setupClass(new File(Files.createTempDir(),
    AbstractSolrSentryTestBase.class.getName() + "_"
      + System.currentTimeMillis()).getAbsolutePath());
  File sentrySite = setupSentry();
  System.setProperty("solr.authorization.sentry.site", sentrySite.toURI().toURL().toString().substring("file:".length()));
  System.setProperty("solr.hdfs.home", dfsCluster.getURI().toString() + "/solr");
  extraRequestFilters = new TreeMap<Class, String>(new Comparator<Class>() {
    // There's only one class, make this as simple as possible
    public int compare(Class o1, Class o2) {
      return 0;
    }

    public int hashCode() {
      return 17;
    }

    public boolean equals(Object obj) {
      return true;
    }
  });
  extraRequestFilters.put(ModifiableUserAuthenticationFilter.class, "*");
  File solrXml = new File(RESOURCES_DIR, "solr-no-core.xml");
  miniSolrCloudCluster = new MiniSolrCloudCluster(NUM_SERVERS, null, solrXml,
    null, extraRequestFilters);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:28,代码来源:AbstractSolrSentryTestBase.java

示例7: getMiniCluster

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
public static MiniSolrCloudCluster getMiniCluster() {
    return miniSolrCloudCluster;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:4,代码来源:SolrRunner.java

示例8: getMiniSolrCloudCluster

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
public MiniSolrCloudCluster getMiniSolrCloudCluster() {
  return this.miniSolrCloudCluster;
}
 
开发者ID:apache,项目名称:metron,代码行数:4,代码来源:SolrComponent.java

示例9: startSolrWithDbProvider

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
public static void startSolrWithDbProvider() throws Exception {
  LOGGER.info("starting Solr authorization via Sentry Service");
  configureWithSolr();
  miniSolrCloudCluster = new MiniSolrCloudCluster(NUM_SERVERS, null,
      new File(RESOURCES_DIR, "solr-no-core.xml"), null, extraRequestFilters);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:7,代码来源:AbstractSolrSentryTestWithDbProvider.java

示例10: setTrackingQueue

import org.apache.solr.cloud.MiniSolrCloudCluster; //导入依赖的package包/类
/**
 * Sets the tracking queue for all nodes participating in this cluster. Once this method returns,
 * all search and core admin requests distributed to shards will be submitted to the given queue.
 * <p>
 * This is equivalent to calling:
 * <code>TrackingShardHandlerFactory.setTrackingQueue(cluster.getJettySolrRunners(), queue)</code>
 *
 * @see org.apache.solr.handler.component.TrackingShardHandlerFactory#setTrackingQueue(java.util.List, java.util.Queue)
 */
public static void setTrackingQueue(MiniSolrCloudCluster cluster, Queue<ShardRequestAndParams> queue) {
  setTrackingQueue(cluster.getJettySolrRunners(), queue);
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:TrackingShardHandlerFactory.java


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