mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)
84822: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud) 82523: Fix for ACE-1044 SOLR 4 - Back up and recovery - added baseUrl configuration - improved admin git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85181 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -81,7 +81,7 @@
|
||||
<value>solrHttpClientFactory</value>
|
||||
</property>
|
||||
<property name="baseUrl">
|
||||
<value>/solr/alfresco</value>
|
||||
<value>${solr.baseUrl}/alfresco</value>
|
||||
</property>
|
||||
<property name="protocol">
|
||||
<value>workspace</value>
|
||||
@@ -98,7 +98,7 @@
|
||||
<value>solrHttpClientFactory</value>
|
||||
</property>
|
||||
<property name="baseUrl">
|
||||
<value>/solr/archive</value>
|
||||
<value>${solr.baseUrl}/archive</value>
|
||||
</property>
|
||||
<property name="protocol">
|
||||
<value>archive</value>
|
||||
@@ -133,6 +133,7 @@
|
||||
<property name="solrPingCronExpression" value="${solr.solrPingCronExpression}"/>
|
||||
<property name="solrConnectTimeout" value="${solr.solrConnectTimeout}"/>
|
||||
<property name="httpClientFactory" ref="solrHttpClientFactory"/>
|
||||
<property name="baseUrl" value="${solr.baseUrl}"/>
|
||||
<property name="scheduler">
|
||||
<ref bean="searchSchedulerFactory" />
|
||||
</property>
|
||||
@@ -141,6 +142,7 @@
|
||||
|
||||
<bean id="search.solrAdminHTTPCLient" class="org.alfresco.repo.search.impl.solr.SolrAdminHTTPClient" init-method="init">
|
||||
<property name="httpClientFactory" ref="solrHttpClientFactory"/>
|
||||
<property name="baseUrl" value="${solr.baseUrl}"/>
|
||||
</bean>
|
||||
|
||||
|
||||
|
@@ -3,3 +3,4 @@ solr.port=8080
|
||||
solr.port.ssl=8443
|
||||
solr.query.includeGroupsForRoleAdmin=false
|
||||
solr.query.maximumResultsFromUnlimitedQuery=${system.acl.maxPermissionChecks}
|
||||
solr.baseUrl=/solr
|
||||
|
@@ -49,6 +49,9 @@
|
||||
<property name="solrAdminClient">
|
||||
<ref bean="solrAdminClient" />
|
||||
</property>
|
||||
<property name="fixNumberToKeepOffByOneError">
|
||||
<value>true</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- archive://SpacesStore - archive -->
|
||||
|
@@ -1,7 +1,7 @@
|
||||
solr.backup.alfresco.cronExpression=0 0 2 * * ?
|
||||
solr.backup.archive.cronExpression=0 0 4 * * ?
|
||||
solr.backup.alfresco.remoteBackupLocation=${dir.root}/solrBackup/alfresco
|
||||
solr.backup.archive.remoteBackupLocation=${dir.root}/solrBackup/archive
|
||||
solr.backup.alfresco.remoteBackupLocation=${dir.root}/solr4Backup/alfresco
|
||||
solr.backup.archive.remoteBackupLocation=${dir.root}/solr4Backup/archive
|
||||
solr.backup.alfresco.numberToKeep=3
|
||||
solr.backup.archive.numberToKeep=3
|
||||
|
||||
|
@@ -81,7 +81,7 @@
|
||||
<value>solrHttpClientFactory</value>
|
||||
</property>
|
||||
<property name="baseUrl">
|
||||
<value>/solr4/alfresco</value>
|
||||
<value>${solr.baseUrl}/alfresco</value>
|
||||
</property>
|
||||
<property name="protocol">
|
||||
<value>workspace</value>
|
||||
@@ -98,7 +98,7 @@
|
||||
<value>solrHttpClientFactory</value>
|
||||
</property>
|
||||
<property name="baseUrl">
|
||||
<value>/solr4/archive</value>
|
||||
<value>${solr.baseUrl}/archive</value>
|
||||
</property>
|
||||
<property name="protocol">
|
||||
<value>archive</value>
|
||||
@@ -133,6 +133,7 @@
|
||||
<property name="solrPingCronExpression" value="${solr.solrPingCronExpression}"/>
|
||||
<property name="solrConnectTimeout" value="${solr.solrConnectTimeout}"/>
|
||||
<property name="httpClientFactory" ref="solrHttpClientFactory"/>
|
||||
<property name="baseUrl" value="${solr.baseUrl}"/>
|
||||
<property name="scheduler">
|
||||
<ref bean="searchSchedulerFactory" />
|
||||
</property>
|
||||
@@ -141,6 +142,7 @@
|
||||
|
||||
<bean id="search.solrAdminHTTPCLient" class="org.alfresco.repo.search.impl.solr.SolrAdminHTTPClient" init-method="init">
|
||||
<property name="httpClientFactory" ref="solrHttpClientFactory"/>
|
||||
<property name="baseUrl" value="${solr.baseUrl}"/>
|
||||
</bean>
|
||||
|
||||
|
||||
|
@@ -3,3 +3,4 @@ solr.port=8083
|
||||
solr.port.ssl=8446
|
||||
solr.query.includeGroupsForRoleAdmin=false
|
||||
solr.query.maximumResultsFromUnlimitedQuery=${system.acl.maxPermissionChecks}
|
||||
solr.baseUrl=/solr4
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -42,6 +42,7 @@ import org.alfresco.service.cmr.search.SearchParameters.FieldFacetMethod;
|
||||
import org.alfresco.service.cmr.search.SearchParameters.FieldFacetSort;
|
||||
import org.alfresco.service.cmr.search.SearchParameters.SortDefinition;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.apache.commons.codec.net.URLCodec;
|
||||
import org.apache.commons.httpclient.Header;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
@@ -51,6 +52,7 @@ import org.apache.commons.httpclient.URI;
|
||||
import org.apache.commons.httpclient.UsernamePasswordCredentials;
|
||||
import org.apache.commons.httpclient.auth.AuthScope;
|
||||
import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.params.HttpClientParams;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -68,6 +70,8 @@ public class SolrAdminHTTPClient
|
||||
{
|
||||
static Log s_logger = LogFactory.getLog(SolrAdminHTTPClient.class);
|
||||
|
||||
private String adminUrl;
|
||||
|
||||
private String baseUrl;
|
||||
|
||||
private HttpClient httpClient;
|
||||
@@ -77,11 +81,19 @@ public class SolrAdminHTTPClient
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void setBaseUrl(String baseUrl)
|
||||
{
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
ParameterCheck.mandatory("baseUrl", baseUrl);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("/solr/admin/cores");
|
||||
this.baseUrl = sb.toString();
|
||||
sb.append(baseUrl + "/admin/cores");
|
||||
this.adminUrl = sb.toString();
|
||||
|
||||
httpClient = httpClientFactory.getHttpClient();
|
||||
HttpClientParams params = httpClient.getParams();
|
||||
@@ -106,7 +118,7 @@ public class SolrAdminHTTPClient
|
||||
String value = args.get(key);
|
||||
if(url.length() == 0)
|
||||
{
|
||||
url.append(baseUrl);
|
||||
url.append(adminUrl);
|
||||
url.append("?");
|
||||
url.append(encoder.encode(key, "UTF-8"));
|
||||
url.append("=");
|
||||
@@ -122,36 +134,37 @@ public class SolrAdminHTTPClient
|
||||
|
||||
}
|
||||
|
||||
PostMethod post = new PostMethod(url.toString());
|
||||
//PostMethod post = new PostMethod(url.toString());
|
||||
GetMethod get = new GetMethod(url.toString());
|
||||
|
||||
try
|
||||
{
|
||||
httpClient.executeMethod(post);
|
||||
httpClient.executeMethod(get);
|
||||
|
||||
if(post.getStatusCode() == HttpStatus.SC_MOVED_PERMANENTLY || post.getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY)
|
||||
if(get.getStatusCode() == HttpStatus.SC_MOVED_PERMANENTLY || get.getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY)
|
||||
{
|
||||
Header locationHeader = post.getResponseHeader("location");
|
||||
Header locationHeader = get.getResponseHeader("location");
|
||||
if (locationHeader != null)
|
||||
{
|
||||
String redirectLocation = locationHeader.getValue();
|
||||
post.setURI(new URI(redirectLocation, true));
|
||||
httpClient.executeMethod(post);
|
||||
get.setURI(new URI(redirectLocation, true));
|
||||
httpClient.executeMethod(get);
|
||||
}
|
||||
}
|
||||
|
||||
if (post.getStatusCode() != HttpServletResponse.SC_OK)
|
||||
if (get.getStatusCode() != HttpServletResponse.SC_OK)
|
||||
{
|
||||
throw new LuceneQueryParserException("Request failed " + post.getStatusCode() + " " + url.toString());
|
||||
throw new LuceneQueryParserException("Request failed " + get.getStatusCode() + " " + url.toString());
|
||||
}
|
||||
|
||||
Reader reader = new BufferedReader(new InputStreamReader(post.getResponseBodyAsStream()));
|
||||
Reader reader = new BufferedReader(new InputStreamReader(get.getResponseBodyAsStream()));
|
||||
// TODO - replace with streaming-based solution e.g. SimpleJSON ContentHandler
|
||||
JSONObject json = new JSONObject(new JSONTokener(reader));
|
||||
return json;
|
||||
}
|
||||
finally
|
||||
{
|
||||
post.releaseConnection();
|
||||
get.releaseConnection();
|
||||
}
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -52,9 +52,21 @@ public class SolrBackupClient implements InitializingBean
|
||||
|
||||
private String core;
|
||||
|
||||
private boolean fixNumberToKeepOffByOneError = false;
|
||||
|
||||
private SOLRAdminClient solrAdminClient;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param fixNumberToKeepOffByOneError the fixNumberToKeepOffByOneError to set
|
||||
*/
|
||||
public void setFixNumberToKeepOffByOneError(boolean fixNumberToKeepOffByOneError)
|
||||
{
|
||||
this.fixNumberToKeepOffByOneError = fixNumberToKeepOffByOneError;
|
||||
}
|
||||
|
||||
public void setSolrAdminClient(SOLRAdminClient solrAdminClient)
|
||||
{
|
||||
this.solrAdminClient = solrAdminClient;
|
||||
@@ -142,7 +154,14 @@ public class SolrBackupClient implements InitializingBean
|
||||
params.set("qt", "/"+core+"/replication");
|
||||
params.set("command", "backup");
|
||||
params.set("location", remoteBackupLocation);
|
||||
if(fixNumberToKeepOffByOneError)
|
||||
{
|
||||
params.set("numberToKeep", numberToKeep > 1 ? (numberToKeep + 1) : numberToKeep);
|
||||
}
|
||||
else
|
||||
{
|
||||
params.set("numberToKeep", numberToKeep);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -114,26 +114,26 @@ public class SolrChildApplicationContextFactory extends ChildApplicationContextF
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
JSONObject alfresco = summary.getJSONObject("alfresco");
|
||||
String alfrescoLag = alfresco.getString("TX Lag");
|
||||
String alfrescoActive = alfresco.getString("Active");
|
||||
String alfrescoDuration = alfresco.getString("TX Duration");
|
||||
String alfrescoLastIndexedTxn = alfresco.getString("Id for last TX in index");
|
||||
String alfrescoApproxTxnsReminaing = alfresco.getString("Approx transactions remaining");
|
||||
String alfrescoApproxIndexingTimeReminaing = alfresco.getString("Approx transaction indexing time remaining");
|
||||
String alfrescoDisk = alfresco.getString("On disk (GB)");
|
||||
String alfrescoMemory = alfresco.getString("Total Searcher Cache (GB)");
|
||||
JSONObject alfresco = summary.has("alfresco") ? summary.getJSONObject("alfresco") : null;
|
||||
String alfrescoLag = alfresco == null ? "Unavailable" : alfresco.getString("TX Lag");
|
||||
String alfrescoActive = alfresco == null ? "false" : alfresco.getString("Active");
|
||||
String alfrescoDuration = alfresco == null ? "Unavailable" : alfresco.getString("TX Duration");
|
||||
String alfrescoLastIndexedTxn = alfresco == null ? "Unavailable" : alfresco.getString("Id for last TX in index");
|
||||
String alfrescoApproxTxnsReminaing = alfresco == null ? "Unavailable" : alfresco.getString("Approx transactions remaining");
|
||||
String alfrescoApproxIndexingTimeReminaing = alfresco == null ? "Unavailable" : alfresco.getString("Approx transaction indexing time remaining");
|
||||
String alfrescoDisk = alfresco == null ? "Unavailable" : alfresco.getString("On disk (GB)");
|
||||
String alfrescoMemory = alfresco == null ? "Unavailable" : alfresco.getString("Total Searcher Cache (GB)");
|
||||
|
||||
|
||||
JSONObject archive = summary.getJSONObject("archive");
|
||||
String archiveLag = archive.getString("TX Lag");
|
||||
String archiveActive = archive.getString("Active");
|
||||
String archiveDuration = archive.getString("TX Duration");
|
||||
String archiveLastIndexedTxn = archive.getString("Id for last TX in index");
|
||||
String archiveApproxTxnsReminaing = archive.getString("Approx transactions remaining");
|
||||
String archiveApproxIndexingTimeReminaing = archive.getString("Approx transaction indexing time remaining");
|
||||
String archiveDisk = archive.getString("On disk (GB)");
|
||||
String archiveMemory = archive.getString("Total Searcher Cache (GB)");
|
||||
JSONObject archive = summary.has("archive") ? summary.getJSONObject("archive") : null;
|
||||
String archiveLag = archive == null ? "Unavailable" : archive.getString("TX Lag");
|
||||
String archiveActive = archive == null ? "false" : archive.getString("Active");
|
||||
String archiveDuration = archive == null ? "Unavailable" : archive.getString("TX Duration");
|
||||
String archiveLastIndexedTxn = archive == null ? "Unavailable" : archive.getString("Id for last TX in index");
|
||||
String archiveApproxTxnsReminaing = archive == null ? "Unavailable" : archive.getString("Approx transactions remaining");
|
||||
String archiveApproxIndexingTimeReminaing = archive == null ? "Unavailable" : archive.getString("Approx transaction indexing time remaining");
|
||||
String archiveDisk = archive == null ? "Unavailable" : archive.getString("On disk (GB)");
|
||||
String archiveMemory = archive == null ? "Unavailable" : archive.getString("Total Searcher Cache (GB)");
|
||||
|
||||
if (name.equals(SolrChildApplicationContextFactory.ALFRESCO_ACTIVE))
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
@@ -65,6 +65,7 @@ public class SOLRAdminClient implements ApplicationEventPublisherAware, Disposab
|
||||
private String solrUser;
|
||||
private String solrPassword;
|
||||
private String solrPingCronExpression;
|
||||
private String baseUrl;
|
||||
private CommonsHttpSolrServer server;
|
||||
private int solrConnectTimeout = 30000; // ms
|
||||
|
||||
@@ -124,6 +125,11 @@ public class SOLRAdminClient implements ApplicationEventPublisherAware, Disposab
|
||||
this.httpClientFactory = httpClientFactory;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl)
|
||||
{
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param scheduler the scheduler to set
|
||||
*/
|
||||
@@ -148,7 +154,7 @@ public class SOLRAdminClient implements ApplicationEventPublisherAware, Disposab
|
||||
sb.append(solrHost);
|
||||
sb.append(":");
|
||||
sb.append(httpClientFactory.isSSL() ? solrSSLPort: solrPort);
|
||||
sb.append("/solr");
|
||||
sb.append(baseUrl);
|
||||
this.solrUrl = sb.toString();
|
||||
HttpClient httpClient = httpClientFactory.getHttpClient();
|
||||
|
||||
|
Reference in New Issue
Block a user