Fix for external ZK

This commit is contained in:
Eugene Livis 2020-04-25 09:10:25 -04:00
parent 9adbea8f9e
commit 06aed9122e
2 changed files with 7 additions and 7 deletions

View File

@ -150,7 +150,8 @@ public final class CoordinationService {
*/ */
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
int zooKeeperServerPort = Integer.valueOf(UserPreferences.getIndexingServerPort()) + PORT_OFFSET; int zooKeeperServerPort = Integer.valueOf(UserPreferences.getIndexingServerPort()) + PORT_OFFSET;
String connectString = UserPreferences.getIndexingServerHost() + ":" + zooKeeperServerPort; // ELTODO String connectString = UserPreferences.getIndexingServerHost() + ":" + zooKeeperServerPort;
String connectString = UserPreferences.getZkServerHost() + ":" + UserPreferences.getZkServerPort();
curator = CuratorFrameworkFactory.newClient(connectString, SESSION_TIMEOUT_MILLISECONDS, CONNECTION_TIMEOUT_MILLISECONDS, retryPolicy); curator = CuratorFrameworkFactory.newClient(connectString, SESSION_TIMEOUT_MILLISECONDS, CONNECTION_TIMEOUT_MILLISECONDS, retryPolicy);
curator.start(); curator.start();

View File

@ -41,7 +41,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
@ -878,6 +877,7 @@ public class Server {
}) })
private Collection openCore(Case theCase, Index index) throws KeywordSearchModuleException { private Collection openCore(Case theCase, Index index) throws KeywordSearchModuleException {
List<String> solrUrls = new ArrayList<>();
try { try {
if (theCase.getCaseType() == CaseType.SINGLE_USER_CASE) { if (theCase.getCaseType() == CaseType.SINGLE_USER_CASE) {
// ELTODO make embedded Solr work with localSolrServer // ELTODO make embedded Solr work with localSolrServer
@ -897,7 +897,6 @@ public class Server {
logger.log(Level.INFO, "Using Solr server: {0}", server); logger.log(Level.INFO, "Using Solr server: {0}", server);
}*/ }*/
// connect to the Solr server that was specified in MU options // connect to the Solr server that was specified in MU options
List<String> solrUrls = new ArrayList<>();
solrUrls.add("http://" + UserPreferences.getIndexingServerHost() + ":" + UserPreferences.getIndexingServerPort() + "/solr"); solrUrls.add("http://" + UserPreferences.getIndexingServerHost() + ":" + UserPreferences.getIndexingServerPort() + "/solr");
currentSolrServer = getCloudSolrClient(solrUrls); currentSolrServer = getCloudSolrClient(solrUrls);
@ -1013,7 +1012,7 @@ public class Server {
} }
} }
return new Collection(collectionName, theCase, index); return new Collection(collectionName, theCase, index, solrUrls);
} catch (Exception ex) { } catch (Exception ex) {
logger.log(Level.SEVERE, "Exception during Solr collection creation.", ex); //NON-NLS logger.log(Level.SEVERE, "Exception during Solr collection creation.", ex); //NON-NLS
@ -1862,7 +1861,7 @@ public class Server {
private final int QUERY_TIMEOUT_MILLISECONDS = 86400000; // 24 Hours = 86,400,000 Milliseconds private final int QUERY_TIMEOUT_MILLISECONDS = 86400000; // 24 Hours = 86,400,000 Milliseconds
private Collection(String name, Case theCase, Index index) throws TimeoutException, InterruptedException { private Collection(String name, Case theCase, Index index, List<String> solrUrls) throws TimeoutException, InterruptedException {
this.name = name; this.name = name;
this.caseType = theCase.getCaseType(); this.caseType = theCase.getCaseType();
this.textIndex = index; this.textIndex = index;
@ -1871,12 +1870,12 @@ public class Server {
//IndexingServerProperties properties = getMultiUserServerProperties(Case.getCurrentCase().getCaseDirectory()); //IndexingServerProperties properties = getMultiUserServerProperties(Case.getCurrentCase().getCaseDirectory());
//IndexingServerProperties properties = getMultiUserServerProperties(theCase.getCaseDirectory()); //IndexingServerProperties properties = getMultiUserServerProperties(theCase.getCaseDirectory());
List<String> solrUrls = new ArrayList<>(); /*List<String> solrUrls = new ArrayList<>();
List<String> solrServerList = UserPreferences.getAllIndexingServers(); List<String> solrServerList = UserPreferences.getAllIndexingServers();
for (String server : solrServerList) { for (String server : solrServerList) {
solrUrls.add("http://" + server + "/solr"); // ELTODO optimize this solrUrls.add("http://" + server + "/solr"); // ELTODO optimize this
logger.log(Level.INFO, "Using Solr server: {0}", server); logger.log(Level.INFO, "Using Solr server: {0}", server);
} }*/
solrClient = getCloudSolrClient(solrUrls); solrClient = getCloudSolrClient(solrUrls);
solrClient.setDefaultCollection(name); // ELTODO do we care that this solrClient instance gets reused? solrClient.setDefaultCollection(name); // ELTODO do we care that this solrClient instance gets reused?
// ELTODO solrClient.connect(10, TimeUnit.SECONDS); // ELTODO solrClient.connect(10, TimeUnit.SECONDS);