List of usage examples for org.apache.solr.common.cloud ZkConfigManager ZkConfigManager
public ZkConfigManager(SolrZkClient zkClient)
From source file:fr.jetoile.hadoopunit.component.SolrCloudBootstrap.java
License:Apache License
private void populateZkWithCollectionInfo() { System.setProperty("zkHost", zkHostString); try {//w ww . java 2 s.c om URI solrDirectoryFile = solrServer.getClass().getClassLoader() .getResource(solrDirectory + "/collection1/conf").toURI(); try (SolrZkClient zkClient = new SolrZkClient(zkHostString, TIMEOUT, 45000, null)) { ZkConfigManager manager = new ZkConfigManager(zkClient); manager.uploadConfigDir(Paths.get(solrDirectoryFile), solrCollectionName); } // CuratorFramework client = CuratorFrameworkFactory.newClient(zkHostString, new RetryOneTime(300)); // client.start(); // File schema = new File(solrServer.getClass().getClassLoader().getResource(solrDirectory + "/collection1/conf/schema.xml").toURI()); // File solrConfig = new File(solrServer.getClass().getClassLoader().getResource(solrDirectory + "/collection1/conf/solrconfig.xml").toURI()); // File stopwords = new File(solrServer.getClass().getClassLoader().getResource(solrDirectory + "/collection1/conf/stopwords.txt").toURI()); // File synonyms = new File(solrServer.getClass().getClassLoader().getResource(solrDirectory + "/collection1/conf/synonyms.txt").toURI()); // File stopwords_en = new File(solrServer.getClass().getClassLoader().getResource(solrDirectory + "/collection1/conf/lang/stopwords_en.txt").toURI()); // File protwords = new File(solrServer.getClass().getClassLoader().getResource(solrDirectory + "/collection1/conf/protwords.txt").toURI()); // File currency = new File(solrServer.getClass().getClassLoader().getResource(solrDirectory + "/collection1/conf/currency.xml").toURI()); // // byte[] schemaContent = Files.readAllBytes(schema.toPath()); // byte[] solrConfigContent = Files.readAllBytes(solrConfig.toPath()); // byte[] stopwordsContent = Files.readAllBytes(stopwords.toPath()); // byte[] synonymsContent = Files.readAllBytes(synonyms.toPath()); // byte[] stopwordsEnContent = Files.readAllBytes(stopwords_en.toPath()); // byte[] protwordsContent = Files.readAllBytes(protwords.toPath()); // byte[] currencyContent = Files.readAllBytes(currency.toPath()); // // client.create().forPath("/configs"); // client.create().forPath("/configs/collection1"); // client.create().forPath("/configs/collection1/lang"); // client.create().forPath("/configs/collection1/solrconfig.xml", solrConfigContent); // client.create().forPath("/configs/collection1/schema.xml", schemaContent); // client.create().forPath("/configs/collection1/stopwords.txt", stopwordsContent); // client.create().forPath("/configs/collection1/synonyms.txt", synonymsContent); // client.create().forPath("/configs/collection1/lang/stopwords_en.txt", stopwordsEnContent); // client.create().forPath("/configs/collection1/protwords.txt", protwordsContent); // client.create().forPath("/configs/collection1/currency.xml", currencyContent); // // client.close(); } catch (URISyntaxException | IOException e) { LOGGER.error("unable to populate zookeeper", e); } }