Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Ensure no remote Solr is attached before "Shut Down and Re-Start Solr"
lucciomand92b19194241
diff --git a/htroot/IndexControlURLs_p.html b/htroot/IndexControlURLs_p.htmlindex e5b0ff38d..119f5e26c 100644--- a/htroot/IndexControlURLs_p.html+++ b/htroot/IndexControlURLs_p.html@@ -129,9 +129,10 @@ function updatepage(str) {<form action="IndexControlURLs_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8"><input type="hidden" name="transactionToken" value="#[transactionToken]#" /><fieldset><legend>Reboot Solr Core</legend>+ #(rebootSolrEnabled)#<div class="alert alert-info">This feature is available when using exclusively a local embedded Solr.</div>::#(/rebootSolrEnabled)#<dl><dt> </dt>- <dd><input type="submit" name="rebootsolr" value="Shut Down and Re-Start Solr" class="btn btn-primary" style="width:240px;"/>+ <dd><input type="submit" name="rebootsolr" value="Shut Down and Re-Start Solr" class="btn btn-primary" style="width:240px;" #(rebootSolrEnabled)#disabled="disabled"::#(/rebootSolrEnabled)#/></dd></dl></fieldset>diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.javaindex 42bbacfe8..42d475ec4 100644--- a/htroot/IndexControlURLs_p.java+++ b/htroot/IndexControlURLs_p.java@@ -44,6 +44,7 @@ import net.yacy.data.WorkTables;import net.yacy.kelondro.data.meta.URIMetadataNode;import net.yacy.kelondro.data.word.Word;import net.yacy.search.Switchboard;+import net.yacy.search.SwitchboardConstants;import net.yacy.search.index.Fulltext;import net.yacy.search.index.Segment;import net.yacy.search.schema.CollectionSchema;@@ -81,6 +82,11 @@ public class IndexControlURLs_p {List<File> dumpFiles = segment.fulltext().dumpFiles();prop.put("dumprestore_dumpfile", dumpFiles.size() == 0 ? "" : dumpFiles.get(dumpFiles.size() - 1).getAbsolutePath());prop.put("dumprestore_optimizemax", 10);+ prop.put("dumprestore_rebootSolrEnabled",+ sb.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT,+ SwitchboardConstants.CORE_SERVICE_FULLTEXT_DEFAULT)+ && !sb.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED,+ SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED_DEFAULT));prop.put("cleanup", ucount == 0 ? 0 : 1);prop.put("cleanupsolr", segment.fulltext().connectedRemoteSolr() ? 1 : 0);prop.put("cleanuprwi", segment.termIndex() != null && !segment.termIndex().isEmpty() ? 1 : 0);@@ -235,8 +241,14 @@ public class IndexControlURLs_p {/* Check the transaction is valid */TransactionManager.checkPostTransaction(header, post);- segment.fulltext().rebootSolr();- sb.tables.recordAPICall(post, "IndexControlURLs_p.html", WorkTables.TABLE_API_TYPE_STEERING, "solr reboot");+ if (sb.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT,+ SwitchboardConstants.CORE_SERVICE_FULLTEXT_DEFAULT)+ && !sb.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED,+ SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED_DEFAULT)) {+ /* This operation is designed only for an embdded local Solr with no mirroring to an external remote Solr server */+ segment.fulltext().rebootEmbeddedLocalSolr();+ sb.tables.recordAPICall(post, "IndexControlURLs_p.html", WorkTables.TABLE_API_TYPE_STEERING, "solr reboot");+ }}if (post.containsKey("deletedomain")) {diff --git a/htroot/IndexFederated_p.java b/htroot/IndexFederated_p.javaindex cdd99e289..b762c490a 100644--- a/htroot/IndexFederated_p.java+++ b/htroot/IndexFederated_p.java@@ -87,7 +87,8 @@ public class IndexFederated_p {TransactionManager.checkPostTransaction(header, post);boolean post_core_fulltext = post.getBoolean(SwitchboardConstants.CORE_SERVICE_FULLTEXT);- final boolean previous_core_fulltext = sb.index.fulltext().connectedLocalSolr() && env.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT, false);+ final boolean previous_core_fulltext = sb.index.fulltext().connectedLocalSolr() && env.getConfigBool(+ SwitchboardConstants.CORE_SERVICE_FULLTEXT, SwitchboardConstants.CORE_SERVICE_FULLTEXT_DEFAULT);env.setConfig(SwitchboardConstants.CORE_SERVICE_FULLTEXT, post_core_fulltext);if (previous_core_fulltext && !post_core_fulltext) {@@ -100,7 +101,9 @@ public class IndexFederated_p {}// solr- final boolean solrRemoteWasOn = sb.index.fulltext().connectedRemoteSolr() && env.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, true);+ final boolean solrRemoteWasOn = sb.index.fulltext().connectedRemoteSolr()+ && env.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED,+ SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED_DEFAULT);String solrurls = post.get("solr.indexing.url", env.getConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_URL, "http://127.0.0.1:8983/solr"));final boolean solrRemoteIsOnAfterwards = post.getBoolean("solr.indexing.solrremote") & solrurls.length() > 0;env.setConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, solrRemoteIsOnAfterwards);@@ -144,7 +147,10 @@ public class IndexFederated_p {if (solrRemoteIsOnAfterwards) try {if (solrRemoteWasOn) sb.index.fulltext().disconnectRemoteSolr();// switch on- final boolean usesolr = sb.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, false) & solrurls.length() > 0;+ final boolean usesolr = sb.getConfigBool(+ SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED,+ SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED_DEFAULT)+ & solrurls.length() > 0;final int solrtimeout = sb.getConfigInt(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_TIMEOUT, 10000);final boolean trustSelfSignedOnAuthenticatedServer = Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_AUTHENTICATED_ALLOW_SELF_SIGNED,@@ -193,11 +199,15 @@ public class IndexFederated_p {prop.put("table_list", size.length);}- prop.put(SwitchboardConstants.CORE_SERVICE_FULLTEXT + ".checked", env.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT, false) ? 1 : 0);+ prop.put(SwitchboardConstants.CORE_SERVICE_FULLTEXT + ".checked",+ env.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT,+ SwitchboardConstants.CORE_SERVICE_FULLTEXT_DEFAULT) ? 1 : 0);prop.put("core.service.rwi.checked", env.getConfigBool(SwitchboardConstants.CORE_SERVICE_RWI, false) ? 1 : 0);prop.put(SwitchboardConstants.CORE_SERVICE_CITATION + ".checked", env.getConfigBool(SwitchboardConstants.CORE_SERVICE_CITATION, false) ? 1 : 0);prop.put(SwitchboardConstants.CORE_SERVICE_WEBGRAPH + ".checked", env.getConfigBool(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, false) ? 1 : 0);- prop.put("solr.indexing.solrremote.checked", env.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, false) ? 1 : 0);+ prop.put("solr.indexing.solrremote.checked",+ env.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED,+ SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED_DEFAULT) ? 1 : 0);prop.put(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_AUTHENTICATED_ALLOW_SELF_SIGNED + ".checked",env.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_AUTHENTICATED_ALLOW_SELF_SIGNED,SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_AUTHENTICATED_ALLOW_SELF_SIGNED_DEFAULT));diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.javaindex bf8cf8b58..3cd616cac 100644--- a/source/net/yacy/search/Switchboard.java+++ b/source/net/yacy/search/Switchboard.java@@ -575,14 +575,16 @@ public final class Switchboard extends serverSwitch {if (this.getConfigBool(SwitchboardConstants.CORE_SERVICE_CITATION, true)) try {this.index.connectCitation(wordCacheMaxCount, fileSizeMax);} catch (final IOException e) {ConcurrentLog.logException(e);}- if (this.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT, true)) {+ if (this.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT,+ SwitchboardConstants.CORE_SERVICE_FULLTEXT_DEFAULT)) {try {this.index.fulltext().connectLocalSolr();} catch (final IOException e) {ConcurrentLog.logException(e);}}this.index.fulltext().setUseWebgraph(this.getConfigBool(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, false));// set up the solr interfacefinal String solrurls = getConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_URL, "http://127.0.0.1:8983/solr");- final boolean usesolr = getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, false) & solrurls.length() > 0;+ final boolean usesolr = getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED,+ SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED_DEFAULT) & solrurls.length() > 0;final int solrtimeout = getConfigInt(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_TIMEOUT, 60000);final boolean writeEnabled = getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_WRITEENABLED, true);final boolean trustSelfSignedOnAuthenticatedServer = Switchboard.getSwitchboard().getConfigBool(@@ -1479,14 +1481,16 @@ public final class Switchboard extends serverSwitch {this.index = new Segment(this.log, segmentsPath, archivePath, collectionConfiguration, webgraphConfiguration);if (this.getConfigBool(SwitchboardConstants.CORE_SERVICE_RWI, true)) this.index.connectRWI(wordCacheMaxCount, fileSizeMax);if (this.getConfigBool(SwitchboardConstants.CORE_SERVICE_CITATION, true)) this.index.connectCitation(wordCacheMaxCount, fileSizeMax);- if (this.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT, true)) {+ if (this.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT,+ SwitchboardConstants.CORE_SERVICE_FULLTEXT_DEFAULT)) {this.index.fulltext().connectLocalSolr();}this.index.fulltext().setUseWebgraph(this.getConfigBool(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, false));// set up the solr interfacefinal String solrurls = getConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_URL, "http://127.0.0.1:8983/solr");- final boolean usesolr = getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, false) & solrurls.length() > 0;+ final boolean usesolr = getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED,+ SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED_DEFAULT) & solrurls.length() > 0;final int solrtimeout = getConfigInt(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_TIMEOUT, 60000);final boolean writeEnabled = getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_WRITEENABLED, true);final boolean trustSelfSignedOnAuthenticatedServer = Switchboard.getSwitchboard().getConfigBool(diff --git a/source/net/yacy/search/SwitchboardConstants.java b/source/net/yacy/search/SwitchboardConstants.javaindex d0f254397..5f150fee6 100644--- a/source/net/yacy/search/SwitchboardConstants.java+++ b/source/net/yacy/search/SwitchboardConstants.java@@ -310,7 +310,12 @@ public final class SwitchboardConstants {/** Default configuration setting for remote Solr responses binary encoding */public static final boolean REMOTE_SOLR_BINARY_RESPONSE_ENABLED_DEFAULT = true;+ /** Key of the setting controlling whether to use or not remote Solr server(s) */public static final String FEDERATED_SERVICE_SOLR_INDEXING_ENABLED = "federated.service.solr.indexing.enabled";++ /** Default setting value controlling whether to use or not remote Solr server(s) */+ public static final boolean FEDERATED_SERVICE_SOLR_INDEXING_ENABLED_DEFAULT = false;+public static final String FEDERATED_SERVICE_SOLR_INDEXING_URL = "federated.service.solr.indexing.url";public static final String FEDERATED_SERVICE_SOLR_INDEXING_SHARDING = "federated.service.solr.indexing.sharding";public static final String FEDERATED_SERVICE_SOLR_INDEXING_LAZY = "federated.service.solr.indexing.lazy";@@ -324,7 +329,12 @@ public final class SwitchboardConstants {/** Default value controlling whether a self-signed certificate is acceptable from a remote Solr instance with authentication credentials. */public static final boolean FEDERATED_SERVICE_SOLR_INDEXING_AUTHENTICATED_ALLOW_SELF_SIGNED_DEFAULT = false;+ /** Key of the setting controlling wheter to use or not an embedded Solr instance */public static final String CORE_SERVICE_FULLTEXT = "core.service.fulltext";++ /** Default setting value controlling wheter to use or not an embedded Solr instance */+ public static final boolean CORE_SERVICE_FULLTEXT_DEFAULT = true;+public static final String CORE_SERVICE_RWI = "core.service.rwi.tmp";public static final String CORE_SERVICE_CITATION = "core.service.citation.tmp";public static final String CORE_SERVICE_WEBGRAPH = "core.service.webgraph.tmp";diff --git a/source/net/yacy/search/index/Fulltext.java b/source/net/yacy/search/index/Fulltext.javaindex 5f13eae98..e5ecf78a4 100644--- a/source/net/yacy/search/index/Fulltext.java+++ b/source/net/yacy/search/index/Fulltext.java@@ -641,9 +641,10 @@ public final class Fulltext {}/**- * reboot solr (experimental to check resource management)+ * Reboot the local embedded Solr (experimental to check resource management).+ * Please check before that the local embedded Solr is enabled and no external remote Solr is attached.*/- public void rebootSolr() {+ public void rebootEmbeddedLocalSolr() {synchronized (this.solrInstances) {this.disconnectLocalSolr();// this.solrInstances.close(); // moved to (InstanceMirror) sorlInstances.close()