RANGER-500 - Change URL to Solr for audit Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/d04a9a2f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/d04a9a2f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/d04a9a2f
Branch: refs/heads/tag-policy Commit: d04a9a2fb3d0b7f64820d0db8476a08748ab15dd Parents: e9d9aed Author: Don Bosco Durai <[email protected]> Authored: Thu May 21 01:02:47 2015 -0700 Committer: Don Bosco Durai <[email protected]> Committed: Thu May 21 01:02:47 2015 -0700 ---------------------------------------------------------------------- .../java/org/apache/ranger/solr/SolrMgr.java | 25 ++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/d04a9a2f/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java b/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java index 599f1df..ee52992 100644 --- a/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java +++ b/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java @@ -58,8 +58,15 @@ public class SolrMgr { if (!initDone) { if (rangerBizUtil.getAuditDBType().equalsIgnoreCase("solr")) { String solrURL = PropertiesUtil - .getProperty("ranger.solr.url"); - if (solrURL == null || solrURL.isEmpty()) { + .getProperty("ranger.audit.solr.urls"); + + if (solrURL == null) { + //Let's try older property name + solrURL = PropertiesUtil + .getProperty("ranger.solr.url"); + } + if (solrURL == null || solrURL.isEmpty() + || solrURL.equalsIgnoreCase("none")) { logger.fatal("Solr URL for Audit is empty"); } else { try { @@ -70,18 +77,22 @@ public class SolrMgr { } else { if (solrClient instanceof HttpSolrClient) { HttpSolrClient httpSolrClient = (HttpSolrClient) solrClient; - httpSolrClient.setAllowCompression(true); - httpSolrClient.setConnectionTimeout(1000); + httpSolrClient + .setAllowCompression(true); + httpSolrClient + .setConnectionTimeout(1000); // httpSolrClient.setSoTimeout(10000); httpSolrClient.setMaxRetries(1); - httpSolrClient.setRequestWriter(new BinaryRequestWriter()); + httpSolrClient + .setRequestWriter(new BinaryRequestWriter()); } initDone = true; } } catch (Throwable t) { - logger.fatal("Can't connect to Solr server. URL=" - + solrURL, t); + logger.fatal( + "Can't connect to Solr server. URL=" + + solrURL, t); } } }
