DIY cloud support

This commit is contained in:
Eugene Livis 2020-05-29 15:09:29 -04:00
parent cf50848d60
commit cc9138637f
2 changed files with 16 additions and 18 deletions

View File

@ -264,7 +264,7 @@ public final class KeywordSearchIngestModule implements FileIngestModule {
} else { } else {
// for single-user cases need to verify connection to local SOLR service // for single-user cases need to verify connection to local SOLR service
try { try {
if (!server.isEmbeddedSolrRunning()) { if (!server.isLocalSolrRunning()) {
throw new IngestModuleException(Bundle.KeywordSearchIngestModule_init_tryStopSolrMsg(Bundle.KeywordSearchIngestModule_init_badInitMsg())); throw new IngestModuleException(Bundle.KeywordSearchIngestModule_init_tryStopSolrMsg(Bundle.KeywordSearchIngestModule_init_badInitMsg()));
} }
} catch (KeywordSearchModuleException ex) { } catch (KeywordSearchModuleException ex) {

View File

@ -242,7 +242,7 @@ public class Server {
// A reference to the locally running Solr instance. // A reference to the locally running Solr instance.
private final ConcurrentUpdateSolrClient localSolrServer; private final ConcurrentUpdateSolrClient localSolrServer;
private SOLR_VERSION localServerVersion = SOLR_VERSION.SOLR8; // start embedded Solr 8 by default private SOLR_VERSION localServerVersion = SOLR_VERSION.SOLR8; // start local Solr 8 by default
// A reference to the Solr server we are currently connected to for the Case. // A reference to the Solr server we are currently connected to for the Case.
// This could be a local or remote server. // This could be a local or remote server.
@ -571,7 +571,7 @@ public class Server {
"Server.status.failed.msg=Local Solr server did not respond to status request. This may be because the server failed to start or is taking too long to initialize.",}) "Server.status.failed.msg=Local Solr server did not respond to status request. This may be because the server failed to start or is taking too long to initialize.",})
void startSolr(SOLR_VERSION version) throws KeywordSearchModuleException, SolrServerNoPortException { void startSolr(SOLR_VERSION version) throws KeywordSearchModuleException, SolrServerNoPortException {
if (isEmbeddedSolrRunning()) { if (isLocalSolrRunning()) {
if (localServerVersion == version) { if (localServerVersion == version) {
// this version of local server is already running // this version of local server is already running
return; return;
@ -581,7 +581,7 @@ public class Server {
} }
} }
// set which version of embedded server is currently running // set which version of local server is currently running
localServerVersion = version; localServerVersion = version;
if (!isPortAvailable(currentSolrServerPort)) { if (!isPortAvailable(currentSolrServerPort)) {
@ -629,7 +629,7 @@ public class Server {
// Wait for the Solr server to start and respond to a statusRequest request. // Wait for the Solr server to start and respond to a statusRequest request.
for (int numRetries = 0; numRetries < 6; numRetries++) { for (int numRetries = 0; numRetries < 6; numRetries++) {
if (isEmbeddedSolrRunning()) { if (isLocalSolrRunning()) {
final List<Long> pids = this.getSolrPIDs(); final List<Long> pids = this.getSolrPIDs();
logger.log(Level.INFO, "New Solr process PID: {0}", pids); //NON-NLS logger.log(Level.INFO, "New Solr process PID: {0}", pids); //NON-NLS
return; return;
@ -778,7 +778,7 @@ public class Server {
* @return false if the request failed with a connection error, otherwise * @return false if the request failed with a connection error, otherwise
* true * true
*/ */
synchronized boolean isEmbeddedSolrRunning() throws KeywordSearchModuleException { synchronized boolean isLocalSolrRunning() throws KeywordSearchModuleException {
try { try {
if (isPortAvailable(currentSolrServerPort)) { if (isPortAvailable(currentSolrServerPort)) {
@ -960,19 +960,19 @@ public class Server {
try { try {
if (theCase.getCaseType() == CaseType.SINGLE_USER_CASE) { if (theCase.getCaseType() == CaseType.SINGLE_USER_CASE) {
// makes sure the proper embedded Solr server is running // makes sure the proper local Solr server is running
startLocalSolrServer(index); startLocalSolrServer(index);
currentSolrServer = this.localSolrServer; currentSolrServer = this.localSolrServer;
// check if the embedded Solr server is running // check if the local Solr server is running
if (!this.isEmbeddedSolrRunning()) { if (!this.isLocalSolrRunning()) {
logger.log(Level.SEVERE, "Embedded Solr server is not running"); //NON-NLS logger.log(Level.SEVERE, "Local Solr server is not running"); //NON-NLS
throw new KeywordSearchModuleException(NbBundle.getMessage(this.getClass(), "Server.openCore.exception.msg")); throw new KeywordSearchModuleException(NbBundle.getMessage(this.getClass(), "Server.openCore.exception.msg"));
} }
} else { } else {
// connect to the Solr server that was specified in MU options IndexingServerProperties properties = getMultiUserServerProperties(theCase.getCaseDirectory());
String solrUrl = "http://" + UserPreferences.getIndexingServerHost() + ":" + UserPreferences.getIndexingServerPort() + "/solr"; String solrUrl = "http://" + properties.getHost() + ":" + properties.getPort() + "/solr";
currentSolrServer = getSolrClient(solrUrl); currentSolrServer = getSolrClient(solrUrl);
// get list of all live Solr servers in the cluster // get list of all live Solr servers in the cluster
@ -1673,7 +1673,7 @@ public class Server {
} }
/** /**
* Attempts to connect to the embedded Solr server, which is NOT running in SolrCloud mode. * Attempts to connect to the local Solr server, which is NOT running in SolrCloud mode.
* *
* @param solrServer * @param solrServer
* *
@ -1688,7 +1688,7 @@ public class Server {
/** /**
* Attempts to connect to the given Solr server, which is running in SoulrCloud mode. This API does not work * Attempts to connect to the given Solr server, which is running in SoulrCloud mode. This API does not work
* for the embedded Solr which is NOT running in SolrCloud mode. * for the local Solr which is NOT running in SolrCloud mode.
* *
* @param solrServer * @param solrServer
* *
@ -1792,14 +1792,12 @@ public class Server {
this.caseType = theCase.getCaseType(); this.caseType = theCase.getCaseType();
this.textIndex = index; this.textIndex = index;
// ELTODO get this from some configuration or UI
//IndexingServerProperties properties = getMultiUserServerProperties(Case.getCurrentCase().getCaseDirectory());
String solrUrl; String solrUrl;
if (caseType == CaseType.SINGLE_USER_CASE) { if (caseType == CaseType.SINGLE_USER_CASE) {
solrUrl = "http://localhost:" + currentSolrServerPort + "/solr/" + name; solrUrl = "http://localhost:" + currentSolrServerPort + "/solr/" + name;
} else { } else {
solrUrl = "http://" + UserPreferences.getIndexingServerHost() + ":" + UserPreferences.getIndexingServerPort() + "/solr/" + name; IndexingServerProperties properties = getMultiUserServerProperties(theCase.getCaseDirectory());
solrUrl = "http://" + properties.getHost() + ":" + properties.getPort() + "/solr/" + name;
} }
solrClient = getSolrClient(solrUrl); solrClient = getSolrClient(solrUrl);
} }