mirror of https://github.com/apache/lucene.git
allow splitting the data and conf locations for an embedded zk server
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1293525 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
20dd250457
commit
2e015271c5
|
@ -45,17 +45,21 @@ public class SolrZkServer {
|
|||
|
||||
String zkRun;
|
||||
String zkHost;
|
||||
String solrHome;
|
||||
|
||||
String solrPort;
|
||||
Properties props;
|
||||
SolrZkServerProps zkProps;
|
||||
|
||||
private Thread zkThread; // the thread running a zookeeper server, only if zkRun is set
|
||||
|
||||
public SolrZkServer(String zkRun, String zkHost, String solrHome, String solrPort) {
|
||||
private String dataHome;
|
||||
private String confHome;
|
||||
|
||||
public SolrZkServer(String zkRun, String zkHost, String dataHome, String confHome, String solrPort) {
|
||||
this.zkRun = zkRun;
|
||||
this.zkHost = zkHost;
|
||||
this.solrHome = solrHome;
|
||||
this.dataHome = dataHome;
|
||||
this.confHome = confHome;
|
||||
this.solrPort = solrPort;
|
||||
}
|
||||
|
||||
|
@ -74,13 +78,13 @@ public class SolrZkServer {
|
|||
zkProps = new SolrZkServerProps();
|
||||
// set default data dir
|
||||
// TODO: use something based on IP+port??? support ensemble all from same solr home?
|
||||
zkProps.setDataDir(solrHome + '/' + "zoo_data");
|
||||
zkProps.setDataDir(dataHome);
|
||||
zkProps.zkRun = zkRun;
|
||||
zkProps.solrPort = solrPort;
|
||||
}
|
||||
|
||||
try {
|
||||
props = SolrZkServerProps.getProperties(solrHome + '/' + "zoo.cfg");
|
||||
props = SolrZkServerProps.getProperties(confHome + '/' + "zoo.cfg");
|
||||
SolrZkServerProps.injectServers(props, zkRun, zkHost);
|
||||
zkProps.parseProperties(props);
|
||||
if (zkProps.getClientPortAddress() == null) {
|
||||
|
|
|
@ -130,7 +130,7 @@ public final class ZkController {
|
|||
}
|
||||
SolrZkServer zkServer = null;
|
||||
if (solrHome != null) {
|
||||
zkServer = new SolrZkServer("true", null, solrHome, solrPort);
|
||||
zkServer = new SolrZkServer("true", null, solrHome + "/zoo_data", solrHome, solrPort);
|
||||
zkServer.parseConfig();
|
||||
zkServer.start();
|
||||
}
|
||||
|
|
|
@ -173,8 +173,9 @@ public class CoreContainer
|
|||
System.setProperty("zookeeper.jmx.log4j.disable", "true");
|
||||
|
||||
if (zkRun != null) {
|
||||
String zkDataDir = System.getProperty("zkServerDataDir", solrHome);
|
||||
zkServer = new SolrZkServer(zkRun, zookeeperHost, zkDataDir, hostPort);
|
||||
String zkDataHome = System.getProperty("zkServerDataDir", solrHome + "zoo_data");
|
||||
String zkConfHome = System.getProperty("zkServerConfDir", solrHome);
|
||||
zkServer = new SolrZkServer(zkRun, zookeeperHost, zkDataHome, zkConfHome, hostPort);
|
||||
zkServer.parseConfig();
|
||||
zkServer.start();
|
||||
|
||||
|
|
Loading…
Reference in New Issue