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 zkRun;
|
||||||
String zkHost;
|
String zkHost;
|
||||||
String solrHome;
|
|
||||||
String solrPort;
|
String solrPort;
|
||||||
Properties props;
|
Properties props;
|
||||||
SolrZkServerProps zkProps;
|
SolrZkServerProps zkProps;
|
||||||
|
|
||||||
private Thread zkThread; // the thread running a zookeeper server, only if zkRun is set
|
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.zkRun = zkRun;
|
||||||
this.zkHost = zkHost;
|
this.zkHost = zkHost;
|
||||||
this.solrHome = solrHome;
|
this.dataHome = dataHome;
|
||||||
|
this.confHome = confHome;
|
||||||
this.solrPort = solrPort;
|
this.solrPort = solrPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,13 +78,13 @@ public class SolrZkServer {
|
||||||
zkProps = new SolrZkServerProps();
|
zkProps = new SolrZkServerProps();
|
||||||
// set default data dir
|
// set default data dir
|
||||||
// TODO: use something based on IP+port??? support ensemble all from same solr home?
|
// 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.zkRun = zkRun;
|
||||||
zkProps.solrPort = solrPort;
|
zkProps.solrPort = solrPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
props = SolrZkServerProps.getProperties(solrHome + '/' + "zoo.cfg");
|
props = SolrZkServerProps.getProperties(confHome + '/' + "zoo.cfg");
|
||||||
SolrZkServerProps.injectServers(props, zkRun, zkHost);
|
SolrZkServerProps.injectServers(props, zkRun, zkHost);
|
||||||
zkProps.parseProperties(props);
|
zkProps.parseProperties(props);
|
||||||
if (zkProps.getClientPortAddress() == null) {
|
if (zkProps.getClientPortAddress() == null) {
|
||||||
|
|
|
@ -130,7 +130,7 @@ public final class ZkController {
|
||||||
}
|
}
|
||||||
SolrZkServer zkServer = null;
|
SolrZkServer zkServer = null;
|
||||||
if (solrHome != null) {
|
if (solrHome != null) {
|
||||||
zkServer = new SolrZkServer("true", null, solrHome, solrPort);
|
zkServer = new SolrZkServer("true", null, solrHome + "/zoo_data", solrHome, solrPort);
|
||||||
zkServer.parseConfig();
|
zkServer.parseConfig();
|
||||||
zkServer.start();
|
zkServer.start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,8 +173,9 @@ public class CoreContainer
|
||||||
System.setProperty("zookeeper.jmx.log4j.disable", "true");
|
System.setProperty("zookeeper.jmx.log4j.disable", "true");
|
||||||
|
|
||||||
if (zkRun != null) {
|
if (zkRun != null) {
|
||||||
String zkDataDir = System.getProperty("zkServerDataDir", solrHome);
|
String zkDataHome = System.getProperty("zkServerDataDir", solrHome + "zoo_data");
|
||||||
zkServer = new SolrZkServer(zkRun, zookeeperHost, zkDataDir, hostPort);
|
String zkConfHome = System.getProperty("zkServerConfDir", solrHome);
|
||||||
|
zkServer = new SolrZkServer(zkRun, zookeeperHost, zkDataHome, zkConfHome, hostPort);
|
||||||
zkServer.parseConfig();
|
zkServer.parseConfig();
|
||||||
zkServer.start();
|
zkServer.start();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue