use of org.apache.solr.common.cloud.SolrZkClient in project lucene-solr by apache.
the class TestDelegationWithHadoopAuth method testZNodePaths.
@Test
public void testZNodePaths() throws Exception {
getDelegationToken(null, USER_1, primarySolrClient);
SolrZkClient zkClient = new SolrZkClient(cluster.getZkServer().getZkAddress(), 1000);
try {
assertTrue(zkClient.exists("/security/zkdtsm", true));
assertTrue(zkClient.exists("/security/token", true));
} finally {
zkClient.close();
}
}
use of org.apache.solr.common.cloud.SolrZkClient in project lucene-solr by apache.
the class SolrXmlInZkTest method setUpZkAndDiskXml.
private void setUpZkAndDiskXml(boolean toZk, boolean leaveOnLocal) throws Exception {
Path tmpDir = createTempDir();
Path solrHome = tmpDir.resolve("home");
copyMinConf(new File(solrHome.toFile(), "myCollect"));
if (leaveOnLocal) {
FileUtils.copyFile(new File(SolrTestCaseJ4.TEST_HOME(), "solr-stress-new.xml"), new File(solrHome.toFile(), "solr.xml"));
}
ignoreException("No UpdateLog found - cannot sync");
ignoreException("No UpdateLog found - cannot recover");
System.setProperty("zkClientTimeout", "8000");
zkDir = tmpDir.resolve("zookeeper" + System.nanoTime()).resolve("server1").resolve("data").toString();
zkServer = new ZkTestServer(zkDir);
zkServer.run();
System.setProperty("zkHost", zkServer.getZkAddress());
AbstractZkTestCase.buildZooKeeper(zkServer.getZkHost(), zkServer.getZkAddress(), "solrconfig.xml", "schema.xml");
zkClient = new SolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT);
if (toZk) {
zkClient.makePath("solr.xml", XML_FOR_ZK.getBytes(StandardCharsets.UTF_8), true);
}
zkClient.close();
log.info("####SETUP_START " + getTestName());
// set some system properties for use by tests
Properties props = new Properties();
props.setProperty("solr.test.sys.prop1", "propone");
props.setProperty("solr.test.sys.prop2", "proptwo");
cfg = SolrDispatchFilter.loadNodeConfig(solrHome, props);
log.info("####SETUP_END " + getTestName());
}
use of org.apache.solr.common.cloud.SolrZkClient in project lucene-solr by apache.
the class SolrCLIZkUtilsTest method setupCluster.
@BeforeClass
public static void setupCluster() throws Exception {
configureCluster(1).addConfig("conf1", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf")).configure();
zkAddr = cluster.getZkServer().getZkAddress();
zkClient = new SolrZkClient(zkAddr, 30000);
}
use of org.apache.solr.common.cloud.SolrZkClient in project lucene-solr by apache.
the class OverseerTest method electNewOverseer.
private SolrZkClient electNewOverseer(String address) throws InterruptedException, TimeoutException, IOException, KeeperException, ParserConfigurationException, SAXException {
SolrZkClient zkClient = new SolrZkClient(address, TIMEOUT);
ZkStateReader reader = new ZkStateReader(zkClient);
readers.add(reader);
LeaderElector overseerElector = new LeaderElector(zkClient);
if (overseers.size() > 0) {
overseers.get(overseers.size() - 1).close();
overseers.get(overseers.size() - 1).getZkStateReader().getZkClient().close();
}
UpdateShardHandler updateShardHandler = new UpdateShardHandler(UpdateShardHandlerConfig.DEFAULT);
updateShardHandlers.add(updateShardHandler);
HttpShardHandlerFactory httpShardHandlerFactory = new HttpShardHandlerFactory();
httpShardHandlerFactorys.add(httpShardHandlerFactory);
Overseer overseer = new Overseer(httpShardHandlerFactory.getShardHandler(), updateShardHandler, "/admin/cores", reader, null, new CloudConfig.CloudConfigBuilder("127.0.0.1", 8983, "").build());
overseers.add(overseer);
ElectionContext ec = new OverseerElectionContext(zkClient, overseer, address.replaceAll("/", "_"));
overseerElector.setup(ec);
overseerElector.joinElection(ec, false);
return zkClient;
}
use of org.apache.solr.common.cloud.SolrZkClient in project lucene-solr by apache.
the class SaslZkACLProviderTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
log.info("####SETUP_START " + getTestName());
createTempDir();
String zkDir = createTempDir() + File.separator + "zookeeper/server1/data";
log.info("ZooKeeper dataDir:" + zkDir);
zkServer = new SaslZkTestServer(zkDir, createTempDir() + File.separator + "miniKdc");
zkServer.run();
System.setProperty("zkHost", zkServer.getZkAddress());
SolrZkClient zkClient = new SolrZkClientWithACLs(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
try {
zkClient.makePath("/solr", false, true);
} finally {
zkClient.close();
}
setupZNodes();
log.info("####SETUP_END " + getTestName());
}
Aggregations