ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject [2/2] ambari git commit: AMBARI-21487. Add SOLR to BigInsights 4.2.5 stack (oleewere)
Date Tue, 18 Jul 2017 18:11:56 GMT
AMBARI-21487. Add SOLR to BigInsights 4.2.5 stack (oleewere)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/512caee1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/512caee1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/512caee1

Branch: refs/heads/branch-2.5
Commit: 512caee1314ef49e7caa3169b78c125448f310bb
Parents: cf4888d
Author: oleewere <oleewere@gmail.com>
Authored: Mon Jul 17 13:58:01 2017 +0200
Committer: oleewere <oleewere@gmail.com>
Committed: Tue Jul 18 20:06:34 2017 +0200

----------------------------------------------------------------------
 .../BigInsights/4.2.5/services/SOLR/alerts.json |  37 +++
 .../SOLR/configuration/ranger-solr-audit.xml    | 127 +++++++
 .../ranger-solr-plugin-properties.xml           |  88 +++++
 .../configuration/ranger-solr-policymgr-ssl.xml |  66 ++++
 .../SOLR/configuration/ranger-solr-security.xml |  58 ++++
 .../SOLR/configuration/solr-client-log4j.xml    |  48 +++
 .../services/SOLR/configuration/solr-env.xml    | 262 +++++++++++++++
 .../services/SOLR/configuration/solr-log4j.xml  |  36 ++
 .../services/SOLR/configuration/solr-xml.xml    |  36 ++
 .../4.2.5/services/SOLR/kerberos.json           |  51 +++
 .../4.2.5/services/SOLR/metainfo.xml            | 124 +++++++
 .../services/SOLR/package/scripts/params.py     | 331 +++++++++++++++++++
 .../SOLR/package/scripts/service_check.py       |  48 +++
 .../SOLR/package/scripts/setup_ranger_solr.py   | 126 +++++++
 .../services/SOLR/package/scripts/setup_solr.py | 129 ++++++++
 .../4.2.5/services/SOLR/package/scripts/solr.py | 161 +++++++++
 .../SOLR/package/scripts/solr_client.py         |  51 +++
 .../SOLR/package/scripts/status_params.py       |  34 ++
 .../SOLR/package/templates/solr_jaas.conf.j2    |  26 ++
 .../properties/solr-client-log4j.properties.j2  |  38 +++
 .../services/SOLR/properties/solr-env.sh.j2     | 126 +++++++
 .../SOLR/properties/solr-log4j.properties.j2    |  40 +++
 .../4.2.5/services/SOLR/properties/solr.xml.j2  |  26 ++
 .../services/SOLR/quicklinks/quicklinks.json    |  37 +++
 .../4.2.5/services/SOLR/themes/theme.json       | 107 ++++++
 25 files changed, 2213 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/alerts.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/alerts.json b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/alerts.json
new file mode 100644
index 0000000..30a59fb
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/alerts.json
@@ -0,0 +1,37 @@
+{
+  "SOLR": {
+    "SOLR": [
+      {
+        "name": "solr",
+        "label": "Solr Web UI",
+        "description": "This host-level alert is triggered if the Solr Cloud Instance is unreachable.",
+        "interval": 1,
+        "scope": "ANY",
+        "source": {
+          "type": "WEB",
+          "uri": {
+            "http": "{{solr-env/solr_port}}",
+            "https": "{{solr-env/solr_port}}",
+            "https_property": "{{solr-env/solr_ssl_enabled}}",
+            "https_property_value": "true",
+            "connection_timeout": 5.0,
+            "kerberos_keytab": "{{solr-env/solr_web_kerberos_keytab}}",
+            "kerberos_principal": "{{solr-env/solr_web_kerberos_principal}}",
+            "default_port": 8983
+          },
+          "reporting": {
+            "ok": {
+              "text": "HTTP {0} response in {2:.3f}s"
+            },
+            "warning": {
+              "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
+            },
+            "critical": {
+              "text": "Connection failed to {1} ({3})"
+            }
+          }
+        }
+      }
+    ]
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-audit.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-audit.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-audit.xml
new file mode 100644
index 0000000..9fe7af8
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-audit.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+  <property>
+    <name>xasecure.audit.is.enabled</name>
+    <value>true</value>
+    <description>Is Audit enabled?</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.credential.provider.file</name>
+    <value>jceks://file{{credential_file}}</value>
+    <description>Credential file store</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.destination.hdfs</name>
+    <value>true</value>
+    <display-name>Audit to HDFS</display-name>
+    <description>Is Audit to HDFS enabled?</description>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+    <depends-on>
+      <property>
+        <type>ranger-env</type>
+        <name>xasecure.audit.destination.hdfs</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.destination.hdfs.dir</name>
+    <value>hdfs://NAMENODE_HOSTNAME:8020/ranger/audit</value>
+    <description>HDFS folder to write audit to, make sure the service user has requried permissions</description>
+    <depends-on>
+      <property>
+        <type>ranger-env</type>
+        <name>xasecure.audit.destination.hdfs.dir</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.destination.hdfs.batch.filespool.dir</name>
+    <value>/var/log/solr/audit/hdfs/spool</value>
+    <description>/var/log/solr/audit/hdfs/spool</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.destination.solr</name>
+    <value>false</value>
+    <display-name>Audit to SOLR</display-name>
+    <description>Is Solr audit enabled?</description>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+    <depends-on>
+      <property>
+        <type>ranger-env</type>
+        <name>xasecure.audit.destination.solr</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.destination.solr.urls</name>
+    <value/>
+    <description>Solr URL</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <depends-on>
+      <property>
+        <type>ranger-admin-site</type>
+        <name>ranger.audit.solr.urls</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.destination.solr.zookeepers</name>
+    <value>NONE</value>
+    <description>Solr Zookeeper string</description>
+    <depends-on>
+      <property>
+        <type>ranger-admin-site</type>
+        <name>ranger.audit.solr.zookeepers</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.destination.solr.batch.filespool.dir</name>
+    <value>/var/log/solr/audit/solr/spool</value>
+    <description>/var/log/solr/audit/solr/spool</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.audit.provider.summary.enabled</name>
+    <value>true</value>
+    <display-name>Audit provider summary enabled</display-name>
+    <description>Enable Summary audit?</description>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-plugin-properties.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-plugin-properties.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-plugin-properties.xml
new file mode 100644
index 0000000..77a3219
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-plugin-properties.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration supports_final="true">
+  <property>
+    <name>policy_user</name>
+    <value>ambari-qa</value>
+    <display-name>Policy user for SOLR</display-name>
+    <description>This user must be system user and also present at Ranger admin portal</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>hadoop.rpc.protection</name>
+    <value/>
+    <description>Used for repository creation on ranger admin</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>common.name.for.certificate</name>
+    <value/>
+    <description>Common name for certificate, this value should match what is specified in repo within ranger admin</description>
+    <value-attributes>
+      <empty-value-valid>true</empty-value-valid>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr.url</name>
+    <value>localhost:8983</value>
+    <description>Used for repository creation on ranger admin</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>ranger-solr-plugin-enabled</name>
+    <value>No</value>
+    <display-name>Enable Ranger for SOLR</display-name>
+    <description>Enable ranger solr plugin</description>
+    <depends-on>
+      <property>
+        <type>ranger-env</type>
+        <name>ranger-solr-plugin-enabled</name>
+      </property>
+    </depends-on>
+    <value-attributes>
+      <type>boolean</type>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>REPOSITORY_CONFIG_USERNAME</name>
+    <value>solr</value>
+    <display-name>Ranger repository config user</display-name>
+    <description>Used for repository creation on ranger admin</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>REPOSITORY_CONFIG_PASSWORD</name>
+    <value>solr</value>
+    <property-type>PASSWORD</property-type>
+    <display-name>Ranger repository config password</display-name>
+    <description>Used for repository creation on ranger admin</description>
+    <value-attributes>
+      <type>password</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-policymgr-ssl.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-policymgr-ssl.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-policymgr-ssl.xml
new file mode 100644
index 0000000..f656364
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-policymgr-ssl.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+  <property>
+    <name>xasecure.policymgr.clientssl.keystore</name>
+    <value>solrdev-clientcert.jks</value>
+    <description>Java Keystore files</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.policymgr.clientssl.keystore.password</name>
+    <value>myKeyFilePassword</value>
+    <property-type>PASSWORD</property-type>
+    <description>password for keystore</description>
+    <value-attributes>
+      <type>password</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.policymgr.clientssl.truststore</name>
+    <value>cacerts-xasecure.jks</value>
+    <description>java truststore file</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.policymgr.clientssl.truststore.password</name>
+    <value>changeit</value>
+    <property-type>PASSWORD</property-type>
+    <description>java truststore password</description>
+    <value-attributes>
+      <type>password</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.policymgr.clientssl.keystore.credential.file</name>
+    <value>jceks://file/{{credential_file}}</value>
+    <description>java keystore credential file</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>xasecure.policymgr.clientssl.truststore.credential.file</name>
+    <value>jceks://file/{{credential_file}}</value>
+    <description>java truststore credential file</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-security.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-security.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-security.xml
new file mode 100644
index 0000000..e3d4cea
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/ranger-solr-security.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+  <property>
+    <name>ranger.plugin.solr.service.name</name>
+    <value>{{repo_name}}</value>
+    <description>Name of the Ranger service containing policies for this Solr instance</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>ranger.plugin.solr.policy.source.impl</name>
+    <value>org.apache.ranger.admin.client.RangerAdminRESTClient</value>
+    <description>Class to retrieve policies from the source</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>ranger.plugin.solr.policy.rest.url</name>
+    <value>{{policymgr_mgr_url}}</value>
+    <description>URL to Ranger Admin</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>ranger.plugin.solr.policy.rest.ssl.config.file</name>
+    <value>/etc/solr/conf/ranger-policymgr-ssl.xml</value>
+    <description>Path to the file containing SSL details to contact Ranger Admin</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>ranger.plugin.solr.policy.pollIntervalMs</name>
+    <value>30000</value>
+    <description>How often to poll for changes in policies?</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>ranger.plugin.solr.policy.cache.dir</name>
+    <value>/etc/ranger/{{repo_name}}/policycache</value>
+    <description>Directory where Ranger policies are cached after successful retrieval from the source</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-client-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-client-log4j.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-client-log4j.xml
new file mode 100644
index 0000000..1257901
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-client-log4j.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<!-- This is a special config file for properties used to monitor status of the service -->
+<configuration supports_adding_forbidden="true">
+  <!-- log4j.xml -->
+  <property>
+    <name>solr_client_log_dir</name>
+    <value>/var/log/solr-client</value>
+    <description>Directory for Solr client logs</description>
+    <display-name>Solr Client log dir</display-name>
+    <value-attributes>
+      <type>directory</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>content</name>
+    <display-name>log4j template</display-name>
+    <description>This is the jinja template for log4j.properties file for solr client</description>
+    <value/>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <property-file-name>solr-client-log4j.properties.j2</property-file-name>
+      <property-file-type>text</property-file-type>
+      <type>content</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-env.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-env.xml
new file mode 100644
index 0000000..4d47cf1
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-env.xml
@@ -0,0 +1,262 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<!-- This is a special config file for properties used to monitor status of the service -->
+<configuration supports_adding_forbidden="true">
+  <property>
+    <name>solr_port</name>
+    <value>8983</value>
+    <description>Solr port</description>
+    <display-name>Solr port</display-name>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_jmx_port</name>
+    <value>18983</value>
+    <description>Solr JMX port</description>
+    <display-name>Solr JMX port</display-name>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_pid_dir</name>
+    <value>/var/run/solr</value>
+    <description>Solr Process ID Directory</description>
+    <display-name>Solr pid dir</display-name>
+    <value-attributes>
+      <type>directory</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_log_dir</name>
+    <value>/var/log/solr</value>
+    <description>Directory for Solr logs</description>
+    <display-name>Solr log dir</display-name>
+    <value-attributes>
+      <type>directory</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_user</name>
+    <value>solr</value>
+    <property-type>USER</property-type>
+    <description>Solr user</description>
+    <display-name>Solr User</display-name>
+    <value-attributes>
+      <type>user</type>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_datadir</name>
+    <value>/opt/solr/data</value>
+    <display-name>Solr data dir</display-name>
+    <description>Directory for storing Solr index. Make sure you have enough disk space</description>
+    <value-attributes>
+      <type>directory</type>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_hdfs_home_dir</name>
+    <value>/apps/solr/data</value>
+    <description>A root location in HDFS for Solr to write collection data to. Rather than specifying an HDFS location for the data directory or update log directory, use this to specify one root location and have everything automatically created within this HDFS</description>
+  </property>
+  <property>
+    <name>solr_ssl_enabled</name>
+    <value>false</value>
+    <display-name>Enable SSL to Solr</display-name>
+    <description>Enable ssl to Solr</description>
+    <value-attributes>
+      <type>boolean</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_truststore_location</name>
+    <value>/etc/security/serverKeys/solr.trustStore.jks</value>
+    <display-name>Solr trust store location</display-name>
+    <description>Location of the trust store file. (default value is not generated)</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_truststore_type</name>
+    <value>jks</value>
+    <display-name>Solr trust store type</display-name>
+    <description>Type of the trust store file.</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_truststore_password</name>
+    <value>bigdata</value>
+    <property-type>PASSWORD</property-type>
+    <display-name>Solr trust store password</display-name>
+    <description>Password to open the trust store file.</description>
+    <value-attributes>
+      <type>password</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_keystore_location</name>
+    <value>/etc/security/serverKeys/solr.keyStore.jks</value>
+    <display-name>Solr key store location</display-name>
+    <description>Location of the key store file. (default value is not generated)</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_keystore_type</name>
+    <value>jks</value>
+    <display-name>Solr key store type</display-name>
+    <description>Type of the key store file.</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_keystore_password</name>
+    <value>bigdata</value>
+    <display-name>Solr key store password</display-name>
+    <property-type>PASSWORD</property-type>
+    <description>Password to open the key store file.</description>
+    <value-attributes>
+      <type>password</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_znode</name>
+    <value>/solr</value>
+    <description>Zookeeper znode, e.g: /solr</description>
+    <display-name>Solr ZNode</display-name>
+    <value-attributes>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_minmem</name>
+    <value>1024</value>
+    <display-name>Solr Minimum Heap Size</display-name>
+    <description>Solr minimum heap size e.g. 512m</description>
+    <value-attributes>
+      <type>int</type>
+      <minimum>512</minimum>
+      <maximum>32768</maximum>
+      <unit>MB</unit>
+      <increment-step>256</increment-step>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>solr_maxmem</name>
+    <value>2048</value>
+    <display-name>Solr Maximum Heap Size</display-name>
+    <description>Solr maximum heap size e.g. 512m</description>
+    <value-attributes>
+      <type>int</type>
+      <minimum>512</minimum>
+      <maximum>32768</maximum>
+      <unit>MB</unit>
+      <increment-step>256</increment-step>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>solr_kerberos_keytab</name>
+    <value>/etc/security/keytabs/solr.service.keytab</value>
+    <display-name>Solr keytab</display-name>
+    <description>The path to the Kerberos Keytab file containing service principal of Solr.</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>solr_kerberos_principal</name>
+    <value>solr/_HOST@EXAMPLE.COM</value>
+    <display-name>Solr principal</display-name>
+    <description>The service principal for Solr.</description>
+    <property-type>KERBEROS_PRINCIPAL</property-type>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>solr_web_kerberos_keytab</name>
+    <value>/etc/security/keytabs/spnego.service.keytab</value>
+    <display-name>Solr Http keytab</display-name>
+    <description>The path to the Kerberos Keytab file containing service principal of Solr.</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>solr_web_kerberos_principal</name>
+    <value>HTTP/_HOST@EXAMPLE.COM</value>
+    <display-name>Solr Http principal</display-name>
+    <description>The service principal for the Solr.</description>
+    <property-type>KERBEROS_PRINCIPAL</property-type>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <property>
+    <name>solr_kerberos_name_rules</name>
+    <value>DEFAULT</value>
+    <display-name>Solr Kerberos name rules</display-name>
+    <description>Kerberos name rules for Spnego</description>
+    <value-attributes>
+      <overridable>false</overridable>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+
+  <!-- solr-env.sh -->
+  <property>
+    <name>content</name>
+    <display-name>solr-env template</display-name>
+    <description>This is the jinja template for solr-env.sh file</description>
+    <value/>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <property-file-name>solr-env.sh.j2</property-file-name>
+      <property-file-type>text</property-file-type>
+      <type>content</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+  <property>
+    <name>is_supported_solr_ranger</name>
+    <value>true</value>
+    <on-ambari-upgrade add="true"/>
+  </property>
+  <property>
+    <name>authorizer.class.name</name>
+    <description>
+      Solr authorizer class
+    </description>
+    <depends-on>
+      <property>
+        <type>ranger-solr-plugin-properties</type>
+        <name>ranger-solr-plugin-enabled</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="true"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-log4j.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-log4j.xml
new file mode 100644
index 0000000..5fe54ff
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-log4j.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration supports_adding_forbidden="true">
+  <property>
+    <name>content</name>
+    <display-name>solr-log4j template</display-name>
+    <description>This is the jinja template for log4j.properties</description>
+    <value/>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <property-file-name>solr-log4j.properties.j2</property-file-name>
+      <property-file-type>text</property-file-type>
+      <type>content</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-xml.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-xml.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-xml.xml
new file mode 100644
index 0000000..469c2b5
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/configuration/solr-xml.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration supports_adding_forbidden="true">
+  <property>
+    <name>content</name>
+    <display-name>solr-xml template</display-name>
+    <description>This is the jinja template for Solr's solr.xml file</description>
+    <value/>
+    <property-type>VALUE_FROM_PROPERTY_FILE</property-type>
+    <value-attributes>
+      <property-file-name>solr.xml.j2</property-file-name>
+      <property-file-type>xml</property-file-type>
+      <type>content</type>
+    </value-attributes>
+    <on-ambari-upgrade add="false"/>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/kerberos.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/kerberos.json b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/kerberos.json
new file mode 100644
index 0000000..84d7fc3
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/kerberos.json
@@ -0,0 +1,51 @@
+{
+  "services": [
+    {
+      "name": "SOLR",
+      "identities": [
+        {
+          "name": "/smokeuser"
+        },
+        {
+          "name": "/spnego",
+          "principal": {
+            "configuration": "solr-env/solr_web_kerberos_principal"
+          },
+          "keytab": {
+            "configuration": "solr-env/solr_web_kerberos_keytab"
+          }
+        }
+      ],
+      "components": [
+        {
+          "name": "SOLR",
+          "identities": [
+            {
+              "name": "solr",
+              "principal": {
+                "value": "${solr-env/solr_user}/_HOST@${realm}",
+                "type": "service",
+                "configuration": "solr-env/solr_kerberos_principal"
+              },
+              "keytab": {
+                "file": "${keytab_dir}/solr.service.keytab",
+                "owner": {
+                  "name": "${solr-env/solr_user}",
+                  "access": "r"
+                },
+                "group": {
+                  "name": "${cluster-env/user_group}",
+                  "access": ""
+                },
+                "configuration": "solr-env/solr_kerberos_keytab"
+              }
+            }
+          ]
+        },
+        {
+          "name": "SOLR_CLIENT"
+        }
+      ]
+    }
+  ]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/metainfo.xml b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/metainfo.xml
new file mode 100644
index 0000000..9fac8a8
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/metainfo.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>SOLR</name>
+      <displayName>Solr</displayName>
+      <comment>Solr is the popular, blazing fast open source enterprise search platform from the Apache Lucene project</comment>
+      <version>6.3.0</version>
+      <components>
+        <component>
+          <name>SOLR</name>
+          <timelineAppid>solr</timelineAppid>
+          <displayName>Solr</displayName>
+          <category>MASTER</category>
+          <cardinality>1+</cardinality>
+          <versionAdvertised>false</versionAdvertised>
+          <commandScript>
+            <script>scripts/solr.py</script>
+            <scriptType>PYTHON</scriptType>
+          </commandScript>
+          <logs>
+            <log>
+              <logId>solr</logId>
+              <primary>true</primary>
+            </log>
+          </logs>
+          <dependencies>
+
+            <dependency>
+              <name>ZOOKEEPER/ZOOKEEPER_SERVER</name>
+              <scope>cluster</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+
+          </dependencies>
+          <configuration-dependencies>
+            <config-type>solr-env</config-type>
+            <config-type>solr-xml</config-type>
+            <config-type>solr-log4j</config-type>
+            <config-type>ranger-solr-plugin-properties</config-type>
+            <config-type>ranger-solr-audit</config-type>
+            <config-type>ranger-solr-policymgr-ssl</config-type>
+            <config-type>ranger-solr-security</config-type>
+          </configuration-dependencies>
+        </component>
+
+      </components>
+
+      <osSpecifics>
+        <osSpecific>
+          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <packages>
+            <package>
+              <name>solr_4_2_5_*</name>
+            </package>
+            <package>
+              <name>ambari-infra-solr-client-*</name>
+            </package>
+          </packages>
+        </osSpecific>
+        <osSpecific>
+          <osFamily>ubuntu12</osFamily>
+          <packages>
+            <package>
+              <name>solr_4_2_5_*</name>
+            </package>
+            <package>
+              <name>ambari-infra-solr-client-*</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
+
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <requiredServices>
+        <service>ZOOKEEPER</service>
+        <service>HDFS</service>
+      </requiredServices>
+
+      <themes>
+        <theme>
+          <fileName>theme.json</fileName>
+          <default>true</default>
+        </theme>
+      </themes>
+
+      <quickLinksConfigurations>
+        <quickLinksConfiguration>
+          <fileName>quicklinks.json</fileName>
+          <default>true</default>
+        </quickLinksConfiguration>
+      </quickLinksConfigurations>
+
+      <configuration-dependencies>
+        <config-type>ranger-env</config-type>
+      </configuration-dependencies>
+
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/params.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/params.py
new file mode 100644
index 0000000..b708026
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/params.py
@@ -0,0 +1,331 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from ambari_commons.constants import AMBARI_SUDO_BINARY
+from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions.is_empty import is_empty
+from resource_management.libraries.script.script import Script
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions import Direction
+from resource_management.libraries.functions import stack_select
+from resource_management.libraries.resources import HdfsResource
+from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions.stack_features import get_stack_feature_version
+from resource_management.libraries.functions.get_stack_version import get_stack_version
+
+import os
+import status_params
+
+def get_port_from_url(address):
+  if not is_empty(address):
+    return address.split(':')[-1]
+  else:
+    return address
+
+# config object that holds the configurations declared in the -site.xml file
+config = Script.get_config()
+tmp_dir = Script.get_tmp_dir()
+stack_root = Script.get_stack_root()
+stack_name = default("/hostLevelParams/stack_name", None)
+retryAble = default("/commandParams/command_retry_enabled", False)
+version = default("/commandParams/version", None)
+
+
+current_version = default("/hostLevelParams/current_version", None)
+upgrade_direction = default("/commandParams/upgrade_direction", None)
+stack_version = default("/commandParams/version", None)
+sudo = AMBARI_SUDO_BINARY
+security_enabled = status_params.security_enabled
+fs_root = config['configurations']['core-site']['fs.defaultFS']
+solr_conf = "/etc/solr/conf"
+
+solr_port = status_params.solr_port
+solr_piddir = status_params.solr_piddir
+solr_pidfile = status_params.solr_pidfile
+
+user_group = config['configurations']['cluster-env']['user_group']
+fetch_nonlocal_groups = config['configurations']['cluster-env']["fetch_nonlocal_groups"]
+
+# shared configs
+java64_home = config['hostLevelParams']['java_home']
+zookeeper_hosts_list = config['clusterHostInfo']['zookeeper_hosts']
+zookeeper_hosts_list.sort()
+# get comma separated list of zookeeper hosts from clusterHostInfo
+zookeeper_hosts = ",".join(zookeeper_hosts_list)
+
+#####################################
+# Solr configs
+#####################################
+
+# Only supporting SolrCloud mode - so hardcode those options
+solr_cloudmode = 'true'
+solr_dir = '/usr/iop/current/solr-server'
+solr_client_dir = '/usr/iop/current/solr-client'
+solr_bindir = solr_dir + '/bin'
+cloud_scripts = solr_dir + '/server/scripts/cloud-scripts'
+
+if "solr-env" in config['configurations']:
+  solr_hosts = config['clusterHostInfo']['solr_hosts']
+  solr_znode = default('/configurations/solr-env/solr_znode', '/solr')
+  solr_min_mem = default('/configurations/solr-env/solr_minmem', 1024)
+  solr_max_mem = default('/configurations/solr-env/solr_maxmem', 2048)
+  solr_instance_count = len(config['clusterHostInfo']['solr_hosts'])
+  solr_datadir = default('/configurations/solr-env/solr_datadir', '/opt/solr/data')
+  solr_data_resources_dir = os.path.join(solr_datadir, 'resources')
+  solr_jmx_port = default('/configurations/solr-env/solr_jmx_port', 18983)
+  solr_ssl_enabled = default('configurations/solr-env/solr_ssl_enabled', False)
+  solr_keystore_location = config['configurations']['solr-env']['solr_keystore_location']
+  solr_keystore_password = config['configurations']['solr-env']['solr_keystore_password']
+  solr_keystore_type = config['configurations']['solr-env']['solr_keystore_type']
+  solr_truststore_location = config['configurations']['solr-env']['solr_truststore_location']
+  solr_truststore_password = config['configurations']['solr-env']['solr_truststore_password']
+  solr_truststore_type = config['configurations']['solr-env']['solr_truststore_type']
+  solr_user = config['configurations']['solr-env']['solr_user']
+  solr_log_dir = config['configurations']['solr-env']['solr_log_dir']
+  solr_log = format("{solr_log_dir}/solr-install.log")
+  solr_env_content = config['configurations']['solr-env']['content']
+  solr_hdfs_home_dir = config['configurations']['solr-env']['solr_hdfs_home_dir']
+
+if upgrade_direction is not None and upgrade_direction == Direction.UPGRADE:
+  old_lib_dir=default("/configurations/solr-env/solr_lib_dir", None)
+
+zookeeper_port = default('/configurations/zoo.cfg/clientPort', None)
+# get comma separated list of zookeeper hosts from clusterHostInfo
+index = 0
+zookeeper_quorum = ""
+for host in config['clusterHostInfo']['zookeeper_hosts']:
+  zookeeper_quorum += host + ":" + str(zookeeper_port)
+  index += 1
+  if index < len(config['clusterHostInfo']['zookeeper_hosts']):
+    zookeeper_quorum += ","
+
+solr_jaas_file = None
+
+if security_enabled:
+  _hostname_lowercase = config['hostname'].lower()
+  solr_jaas_file = solr_conf + '/solr_jaas.conf'
+  solr_kerberos_keytab = default('/configurations/solr-env/solr_kerberos_keytab', None)
+  if not solr_kerberos_keytab: #Maybe against older configurations during a downgrade operation. Look for the old property
+    solr_keytab=config['configurations']['solr-site']['solr.hdfs.security.kerberos.keytabfile']
+    solr_kerberos_keytab = solr_keytab
+
+  solr_kerberos_principal = default('/configurations/solr-env/solr_kerberos_principal', None)
+  if solr_kerberos_principal:
+    solr_kerberos_principal = solr_kerberos_principal.replace('_HOST',_hostname_lowercase)
+  else: #Maybe against older configurations during a downgrade operation. Look for the old property
+    solr_site = dict(config['configurations']['solr-site'])
+    solr_principal = solr_site['solr.hdfs.security.kerberos.principal']
+    solr_principal = solr_principal.replace('_HOST', _hostname_lowercase)
+    solr_site['solr.hdfs.security.kerberos.principal']=solr_principal
+    solr_kerberos_principal = solr_principal
+
+  solr_web_kerberos_keytab = config['configurations']['solr-env']['solr_web_kerberos_keytab']
+  solr_web_kerberos_principal = default('/configurations/solr-env/solr_web_kerberos_principal', None)
+  if solr_web_kerberos_principal:
+    solr_web_kerberos_principal = solr_web_kerberos_principal.replace('_HOST',_hostname_lowercase)
+  solr_kerberos_name_rules = config['configurations']['solr-env']['solr_kerberos_name_rules']
+
+solr_xml_content = default('configurations/solr-xml/content', None)
+solr_log4j_content = default('configurations/solr-log4j/content', None)
+
+solr_client_custom_log4j = "solr-client-log4j" in config['configurations']
+
+restart_during_downgrade = False
+upgrade_direction = default("/commandParams/upgrade_direction", None)
+restart_during_downgrade = (upgrade_direction == Direction.DOWNGRADE)
+
+# ***********************  RANGER PLUGIN CHANGES ***********************
+# ranger host
+# **********************************************************************
+
+# get the correct version to use for checking stack features
+version_for_stack_feature_checks = get_stack_feature_version(config)
+
+stack_supports_ranger_kerberos = check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, version_for_stack_feature_checks)
+stack_supports_ranger_audit_db = check_stack_feature(StackFeature.RANGER_AUDIT_DB_SUPPORT, version_for_stack_feature_checks)
+
+ranger_admin_hosts = default("/clusterHostInfo/ranger_admin_hosts", [])
+has_ranger_admin = not len(ranger_admin_hosts) == 0
+xml_configurations_supported = config['configurations']['ranger-env']['xml_configurations_supported']
+ambari_server_hostname = config['clusterHostInfo']['ambari_server_host'][0]
+
+ranger_admin_log_dir = default("/configurations/ranger-env/ranger_admin_log_dir","/var/log/ranger/admin")
+
+#need to set the defaut to false to satisfy downgrade from 4.2,5 to 4.2 or 4.1
+is_supported_solr_ranger = default('/configurations/solr-env/is_supported_solr_ranger', False)
+
+#ranger solr properties
+if has_ranger_admin and is_supported_solr_ranger:
+
+  enable_ranger_solr = config['configurations']['ranger-solr-plugin-properties']['ranger-solr-plugin-enabled']
+  enable_ranger_solr = not is_empty(enable_ranger_solr) and enable_ranger_solr.lower() == 'yes'
+  policymgr_mgr_url = config['configurations']['admin-properties']['policymgr_external_url']
+  if 'admin-properties' in config['configurations'] and 'policymgr_external_url' in config['configurations']['admin-properties'] and policymgr_mgr_url.endswith('/'):
+    policymgr_mgr_url = policymgr_mgr_url.rstrip('/')
+  xa_audit_db_flavor = config['configurations']['admin-properties']['DB_FLAVOR']
+  xa_audit_db_flavor = xa_audit_db_flavor.lower() if xa_audit_db_flavor else None
+  xa_audit_db_name = default('/configurations/admin-properties/audit_db_name', 'ranger_audits')
+  xa_audit_db_user = default('/configurations/admin-properties/audit_db_user', 'rangerlogger')
+  xa_audit_db_password = ''
+  if not is_empty(config['configurations']['admin-properties']['audit_db_password']) and stack_supports_ranger_audit_db:
+    xa_audit_db_password = unicode(config['configurations']['admin-properties']['audit_db_password'])
+  xa_db_host = config['configurations']['admin-properties']['db_host']
+  repo_name = str(config['clusterName']) + '_solr'
+
+  ranger_env = config['configurations']['ranger-env']
+  ranger_plugin_properties = config['configurations']['ranger-solr-plugin-properties']
+
+  ranger_solr_audit = config['configurations']['ranger-solr-audit']
+  ranger_solr_audit_attrs = config['configuration_attributes']['ranger-solr-audit']
+  ranger_solr_security = config['configurations']['ranger-solr-security']
+  ranger_solr_security_attrs = config['configuration_attributes']['ranger-solr-security']
+  ranger_solr_policymgr_ssl = config['configurations']['ranger-solr-policymgr-ssl']
+  ranger_solr_policymgr_ssl_attrs = config['configuration_attributes']['ranger-solr-policymgr-ssl']
+
+  policy_user = config['configurations']['ranger-solr-plugin-properties']['policy_user']
+
+  ranger_plugin_config = {
+    'username' : config['configurations']['ranger-solr-plugin-properties']['REPOSITORY_CONFIG_USERNAME'],
+    'password' : unicode(config['configurations']['ranger-solr-plugin-properties']['REPOSITORY_CONFIG_PASSWORD']),
+    'solr.url' : config['configurations']['ranger-solr-plugin-properties']['solr.url'],
+    'commonNameForCertificate' : config['configurations']['ranger-solr-plugin-properties']['common.name.for.certificate']
+  }
+
+  solr_ranger_plugin_repo = {
+    'isEnabled': 'true',
+    'configs': ranger_plugin_config,
+    'description': 'solr repo',
+    'name': repo_name,
+    'repositoryType': 'solr',
+    'type': 'solr',
+    'assetType': '1'
+  }
+
+  if stack_supports_ranger_kerberos and security_enabled:
+    ranger_plugin_config['policy.download.auth.users'] = solr_user
+    ranger_plugin_config['tag.download.auth.users'] = solr_user
+    ranger_plugin_config['ambari.service.check.user'] = policy_user
+
+  #For curl command in ranger plugin to get db connector
+  jdk_location = config['hostLevelParams']['jdk_location']
+  java_share_dir = '/usr/share/java'
+  previous_jdbc_jar_name = None
+
+  if stack_supports_ranger_audit_db:
+    if xa_audit_db_flavor and xa_audit_db_flavor == 'mysql':
+      jdbc_jar_name = default("/hostLevelParams/custom_mysql_jdbc_name", None)
+      previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_mysql_jdbc_name", None)
+      audit_jdbc_url = format('jdbc:mysql://{xa_db_host}/{xa_audit_db_name}')
+      jdbc_driver = "com.mysql.jdbc.Driver"
+    elif xa_audit_db_flavor and xa_audit_db_flavor == 'oracle':
+      jdbc_jar_name = default("/hostLevelParams/custom_oracle_jdbc_name", None)
+      previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_oracle_jdbc_name", None)
+      colon_count = xa_db_host.count(':')
+      if colon_count == 2 or colon_count == 0:
+        audit_jdbc_url = format('jdbc:oracle:thin:@{xa_db_host}')
+      else:
+        audit_jdbc_url = format('jdbc:oracle:thin:@//{xa_db_host}')
+      jdbc_driver = "oracle.jdbc.OracleDriver"
+    elif xa_audit_db_flavor and xa_audit_db_flavor == 'postgres':
+      jdbc_jar_name = default("/hostLevelParams/custom_postgres_jdbc_name", None)
+      previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_postgres_jdbc_name", None)
+      audit_jdbc_url = format('jdbc:postgresql://{xa_db_host}/{xa_audit_db_name}')
+      jdbc_driver = "org.postgresql.Driver"
+    elif xa_audit_db_flavor and xa_audit_db_flavor == 'mssql':
+      jdbc_jar_name = default("/hostLevelParams/custom_mssql_jdbc_name", None)
+      previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_mssql_jdbc_name", None)
+      audit_jdbc_url = format('jdbc:sqlserver://{xa_db_host};databaseName={xa_audit_db_name}')
+      jdbc_driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
+    elif xa_audit_db_flavor and xa_audit_db_flavor == 'sqla':
+      jdbc_jar_name = default("/hostLevelParams/custom_sqlanywhere_jdbc_name", None)
+      previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name", None)
+      audit_jdbc_url = format('jdbc:sqlanywhere:database={xa_audit_db_name};host={xa_db_host}')
+      jdbc_driver = "sap.jdbc4.sqlanywhere.IDriver"
+
+  downloaded_custom_connector = format("{tmp_dir}/{jdbc_jar_name}") if stack_supports_ranger_audit_db else None
+  driver_curl_source = format("{jdk_location}/{jdbc_jar_name}") if stack_supports_ranger_audit_db else None
+  driver_curl_target = format("{solr_home}/libs/{jdbc_jar_name}") if stack_supports_ranger_audit_db else None
+  previous_jdbc_jar = format("{solr_home}/libs/{previous_jdbc_jar_name}") if stack_supports_ranger_audit_db else None
+
+  xa_audit_db_is_enabled = False
+  ranger_audit_solr_urls = config['configurations']['ranger-admin-site']['ranger.audit.solr.urls']
+  if xml_configurations_supported and stack_supports_ranger_audit_db:
+    xa_audit_db_is_enabled = config['configurations']['ranger-solr-audit']['xasecure.audit.destination.db']
+  xa_audit_hdfs_is_enabled = default('/configurations/ranger-solr-audit/xasecure.audit.destination.hdfs', False)
+  ssl_keystore_password = unicode(config['configurations']['ranger-solr-policymgr-ssl']['xasecure.policymgr.clientssl.keystore.password']) if xml_configurations_supported else None
+  ssl_truststore_password = unicode(config['configurations']['ranger-solr-policymgr-ssl']['xasecure.policymgr.clientssl.truststore.password']) if xml_configurations_supported else None
+  credential_file = format('/etc/ranger/{repo_name}/cred.jceks') if xml_configurations_supported else None
+
+  stack_version = get_stack_version('solr-server')
+  setup_ranger_env_sh_source = format('{stack_root}/{stack_version}/ranger-solr-plugin/install/conf.templates/enable/solr-ranger-env.sh')
+  setup_ranger_env_sh_target = format("{solr_conf}/solr-ranger-env.sh")
+
+  #For SQLA explicitly disable audit to DB for Ranger
+  if xa_audit_db_flavor == 'sqla':
+    xa_audit_db_is_enabled = False
+
+  namenode_hosts = default("/clusterHostInfo/namenode_host", [])
+  has_namenode = not len(namenode_hosts) == 0
+
+
+# *********************** end RANGER PLUGIN CHANGES ****************
+smokeuser = config['configurations']['cluster-env']['smokeuser']
+smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
+smokeuser_principal = config['configurations']['cluster-env']['smokeuser_principal_name']
+
+hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
+hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+hdfs_site = config['configurations']['hdfs-site']
+default_fs = config['configurations']['core-site']['fs.defaultFS']
+hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
+hdfs_principal_name = config['configurations']['hadoop-env']['hdfs_principal_name']
+kinit_path_local = status_params.kinit_path_local
+
+if 'ranger-env' in config['configurations']:
+  stack_root = Script.get_stack_root()
+  ranger_home = format('{stack_root}/current/ranger-admin')
+  audit_solr_enabled = default('/configurations/ranger-env/xasecure.audit.destination.solr', False)
+  ranger_solr_config_set = config['configurations']['ranger-env']['ranger_solr_config_set']
+  ranger_solr_collection_name = config['configurations']['ranger-env']['ranger_solr_collection_name']
+  ranger_solr_shards = config['configurations']['ranger-env']['ranger_solr_shards']
+  replication_factor = config['configurations']['ranger-env']['ranger_solr_replication_factor']
+  ranger_solr_conf = format('{solr_dir}/server/solr/configsets/ranger_audit_configs/conf')
+  is_solrCloud_enabled = default('/configurations/ranger-env/is_solrCloud_enabled', False)
+  is_external_solrCloud_enabled = default('/configurations/ranger-env/is_external_solrCloud_enabled', False)
+  stack_supports_ranger_kerberos = check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT, version_for_stack_feature_checks)
+
+
+import functools
+#create partial functions with common arguments for every HdfsDirectory call
+#to create hdfs directory we need to call params.HdfsDirectory in code
+HdfsResource = functools.partial(
+  HdfsResource,
+  user=hdfs_user,
+  security_enabled = security_enabled,
+  keytab = hdfs_user_keytab,
+  kinit_path_local = kinit_path_local,
+  hadoop_bin_dir = hadoop_bin_dir,
+  hadoop_conf_dir = hadoop_conf_dir,
+  principal_name = hdfs_principal_name,
+  hdfs_site = hdfs_site,
+  default_fs = default_fs
+)

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/service_check.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/service_check.py
new file mode 100644
index 0000000..9fc458a
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/service_check.py
@@ -0,0 +1,48 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management.core.logger import Logger
+from resource_management.core.resources.system import Execute
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.script.script import Script
+
+class ServiceCheck(Script):
+  def service_check(self, env):
+    import params
+    env.set_params(params)
+
+    Logger.info('Solr Service Check ...')
+    if "solr-env" in params.config['configurations'] \
+      and params.solr_hosts is not None \
+      and len(params.solr_hosts) > 0:
+      solr_protocol = "https" if params.solr_ssl_enabled else "http"
+      solr_host = params.solr_hosts[0] # choose the first solr host
+      solr_port = params.solr_port
+      solr_url = format("{solr_protocol}://{solr_host}:{solr_port}/solr/#/")
+
+      smokeuser_kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal};") if params.security_enabled else ""
+      smoke_solr_cmd = format("{smokeuser_kinit_cmd} curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k {solr_url} | grep 200")
+      Execute(smoke_solr_cmd,
+              tries = 40,
+              try_sleep=3,
+              user=params.smokeuser,
+              logoutput=True)
+
+if __name__ == "__main__":
+  ServiceCheck().execute()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/setup_ranger_solr.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/setup_ranger_solr.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/setup_ranger_solr.py
new file mode 100644
index 0000000..e5f0b69
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/setup_ranger_solr.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+    http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+import os
+
+from resource_management.core.logger import Logger
+from resource_management.core.resources import File, Execute
+from resource_management.core.source import StaticFile
+from resource_management.libraries.functions.format import format
+from resource_management.core.resources.system import Directory
+
+
+def setup_ranger_solr():
+  import params
+
+  if params.has_ranger_admin and params.security_enabled:
+
+    from resource_management.libraries.functions.setup_ranger_plugin_xml import setup_ranger_plugin
+
+    if params.retryAble:
+      Logger.info("Solr: Setup ranger: command retry enables thus retrying if ranger admin is down !")
+    else:
+      Logger.info("Solr: Setup ranger: command retry not enabled thus skipping if ranger admin is down !")
+
+    if params.xml_configurations_supported and params.enable_ranger_solr and params.xa_audit_hdfs_is_enabled:
+      if params.has_namenode:
+        params.HdfsResource("/ranger/audit",
+                           type="directory",
+                           action="create_on_execute",
+                           owner=params.hdfs_user,
+                           group=params.hdfs_user,
+                           mode=0755,
+                           recursive_chmod=True
+        )
+        params.HdfsResource("/ranger/audit/solr",
+                           type="directory",
+                           action="create_on_execute",
+                           owner=params.solr_user,
+                           group=params.solr_user,
+                           mode=0700,
+                           recursive_chmod=True
+        )
+        params.HdfsResource(None, action="execute")
+
+
+    File(os.path.join(params.stack_root, params.stack_version, "ranger-solr-plugin", "ranger_credential_helper.py"),
+            mode=0755)
+
+    jar_files = os.listdir(os.path.join(params.stack_root, params.stack_version, "ranger-solr-plugin/lib"))
+
+    for jar_file in jar_files:
+        plugin_dir = os.path.join(params.stack_root, params.stack_version, "ranger-solr-plugin/lib", jar_file)
+
+        Execute(('ln','-sf', plugin_dir,
+            os.path.join(params.stack_root, params.stack_version, "solr/server/solr-webapp/webapp/WEB-INF/lib", jar_file)),
+            only_if=format('ls {plugin_dir}'),
+            sudo=True)
+
+
+    setup_ranger_plugin('solr-server', 'solr', params.previous_jdbc_jar,
+                        params.downloaded_custom_connector, params.driver_curl_source,
+                        params.driver_curl_target, params.java64_home,
+                        params.repo_name, params.solr_ranger_plugin_repo,
+                        params.ranger_env, params.ranger_plugin_properties,
+                        params.policy_user, params.policymgr_mgr_url,
+                        params.enable_ranger_solr, conf_dict=params.solr_conf,
+                        component_user=params.solr_user, component_group=params.user_group, cache_service_list=['solr'],
+                        plugin_audit_properties=params.ranger_solr_audit, plugin_audit_attributes=params.ranger_solr_audit_attrs,
+                        plugin_security_properties=params.ranger_solr_security, plugin_security_attributes=params.ranger_solr_security_attrs,
+                        plugin_policymgr_ssl_properties=params.ranger_solr_policymgr_ssl, plugin_policymgr_ssl_attributes=params.ranger_solr_policymgr_ssl_attrs,
+                        component_list=['solr'], audit_db_is_enabled=params.xa_audit_db_is_enabled,
+                        credential_file=params.credential_file, xa_audit_db_password=params.xa_audit_db_password, 
+                        ssl_truststore_password=params.ssl_truststore_password, ssl_keystore_password=params.ssl_keystore_password,
+                        api_version = 'v2', skip_if_rangeradmin_down= not params.retryAble,
+                        is_security_enabled = params.security_enabled,
+                        is_stack_supports_ranger_kerberos = params.stack_supports_ranger_kerberos,
+                        component_user_principal=params.solr_kerberos_principal if params.security_enabled else None,
+                        component_user_keytab=params.solr_kerberos_keytab if params.security_enabled else None)
+
+    properties_files = os.listdir(format('/etc/solr/conf'))
+
+    if params.security_enabled and params.enable_ranger_solr:
+      solr_classes_dir =  os.path.join(params.stack_root, params.stack_version, "solr/server/solr-webapp/webapp/WEB-INF/classes")
+      Directory(solr_classes_dir,
+                    owner=params.solr_user,
+                    group=params.user_group,
+                    ignore_failures=True
+                    )
+
+
+      Execute(format('mkdir {solr_classes_dir}'),
+              not_if=format('ls {solr_classes_dir}'))
+
+      for properties_file in properties_files:
+        Execute(('ln','-sf',format('/etc/solr/conf/{properties_file}'),
+              os.path.join(params.stack_root, params.stack_version, "solr/server/solr-webapp/webapp/WEB-INF/classes", properties_file)),
+              only_if=format('ls /etc/solr/conf/{properties_file}'),
+              sudo=True)
+
+    zk_port = ":" + params.zookeeper_port + ","
+
+    if params.enable_ranger_solr:
+      zookeeper_hosts_ip = zk_port.join(params.zookeeper_hosts_list) + ":" + params.zookeeper_port
+      zookeeper_script = os.path.join(params.stack_root, params.stack_version, "solr/server/scripts/cloud-scripts/zkcli.sh")
+
+      set_solr_ranger_authorizer = format('{zookeeper_script} -zkhost {zookeeper_hosts_ip} ' +
+                      '-cmd put /solr/security.json \'{{\"authentication":{{\"class\":\"org.apache.solr.security.KerberosPlugin\"}},\"authorization\":{{\"class\": '+
+                      '\"org.apache.ranger.authorization.solr.authorizer.RangerSolrAuthorizer\"}}}}\'')
+
+      Execute(set_solr_ranger_authorizer)
+
+  else:
+    Logger.info('Ranger admin not installed')

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/setup_solr.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/setup_solr.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/setup_solr.py
new file mode 100644
index 0000000..c20623f
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/setup_solr.py
@@ -0,0 +1,129 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management.core.exceptions import Fail
+from resource_management.core.source import InlineTemplate, Template, StaticFile
+from resource_management.core.resources.system import Directory, File
+from resource_management.libraries.functions.decorator import retry
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions import solr_cloud_util
+from resource_management.libraries.functions.default import default
+
+def setup_solr(name = None):
+  import params
+
+  if name == 'server':
+    params.HdfsResource(params.solr_hdfs_home_dir,
+                         type="directory",
+                         action="create_on_execute",
+                         owner=params.solr_user,
+                         mode=0755
+                        )
+
+    params.HdfsResource(None, action="execute")
+
+    Directory([params.solr_log_dir, params.solr_piddir,
+               params.solr_datadir, params.solr_data_resources_dir],
+              mode=0755,
+              cd_access='a',
+              create_parents=True,
+              owner=params.solr_user,
+              group=params.user_group
+              )
+
+    Directory([params.solr_dir],
+              mode=0755,
+              cd_access='a',
+              create_parents=True,
+              recursive_ownership=True
+              )
+
+    Directory([params.solr_conf],
+              mode=0755,
+              cd_access='a',
+              owner=params.solr_user,
+              group=params.user_group,
+              create_parents=True,
+              recursive_ownership=True
+              )
+
+    File(params.solr_log,
+         mode=0644,
+         owner=params.solr_user,
+         group=params.user_group,
+         content=''
+         )
+
+    File(format("{solr_conf}/solr-env.sh"),
+         content=InlineTemplate(params.solr_env_content),
+         mode=0755,
+         owner=params.solr_user,
+         group=params.user_group
+         )
+
+    if params.solr_xml_content:
+      File(format("{solr_datadir}/solr.xml"),
+           content=InlineTemplate(params.solr_xml_content),
+           owner=params.solr_user,
+           group=params.user_group
+           )
+
+    File(format("{solr_conf}/log4j.properties"),
+         content=InlineTemplate(params.solr_log4j_content),
+         owner=params.solr_user,
+         group=params.user_group
+         )
+
+    jaas_file = params.solr_jaas_file if params.security_enabled else None
+    url_scheme = 'https' if params.solr_ssl_enabled else 'http'
+
+    create_solr_znode()
+
+    if params.security_enabled:
+      File(format("{solr_jaas_file}"),
+           content=Template("solr_jaas.conf.j2"),
+           owner=params.solr_user)
+
+    solr_cloud_util.set_cluster_prop(
+      zookeeper_quorum=params.zookeeper_quorum,
+      solr_znode=params.solr_znode,
+      java64_home=params.java64_home,
+      prop_name="urlScheme",
+      prop_value=url_scheme,
+      jaas_file=jaas_file
+    )
+
+    solr_cloud_util.setup_kerberos_plugin(
+      zookeeper_quorum=params.zookeeper_quorum,
+      solr_znode=params.solr_znode,
+      jaas_file=jaas_file,
+      java64_home=params.java64_home,
+      secure=params.security_enabled
+    )
+
+  else :
+    raise Fail('Neither client, nor server were selected to install.')
+
+@retry(times=30, sleep_time=5, err_class=Fail)
+def create_solr_znode():
+  import params
+  solr_cloud_util.create_znode(
+    zookeeper_quorum=params.zookeeper_quorum,
+    solr_znode=params.solr_znode,
+    java64_home=params.java64_home)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/solr.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/solr.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/solr.py
new file mode 100644
index 0000000..7331cfd
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/solr.py
@@ -0,0 +1,161 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+import os
+import sys
+
+from resource_management.core.resources.system import Execute, File
+from resource_management.core.logger import Logger
+from resource_management.libraries.script.script import Script
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions.check_process_status import check_process_status
+from resource_management.libraries.functions.get_user_call_output import get_user_call_output
+from resource_management.libraries.functions.show_logs import show_logs
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions.version import compare_versions
+from resource_management.libraries.functions.version import format_stack_version
+from setup_solr import setup_solr
+from setup_ranger_solr import setup_ranger_solr
+from resource_management.libraries.functions import solr_cloud_util
+
+
+class Solr(Script):
+  def install(self, env):
+    import params
+    env.set_params(params)
+    self.install_packages(env)
+
+  def configure(self, env, upgrade_type=None):
+    import params
+    env.set_params(params)
+
+    setup_solr(name = 'server')
+
+  def start(self, env, upgrade_type=None):
+    import params
+    env.set_params(params)
+    self.configure(env)
+
+    if params.security_enabled:
+      solr_kinit_cmd = format("{kinit_path_local} -kt {solr_kerberos_keytab} {solr_kerberos_principal}; ")
+      Execute(solr_kinit_cmd, user=params.solr_user)
+
+    if params.is_supported_solr_ranger:
+       setup_ranger_solr() #Ranger Solr Plugin related call
+
+    if params.restart_during_downgrade:
+      solr_env = {'SOLR_INCLUDE': format('{solr_conf}/solr.in.sh')}
+    else:
+      solr_env = {'SOLR_INCLUDE': format('{solr_conf}/solr-env.sh')}
+    Execute(
+      format('{solr_bindir}/solr start -cloud -noprompt -s {solr_datadir} >> {solr_log} 2>&1'),
+      environment=solr_env,
+      user=params.solr_user
+    )
+
+    if 'ranger-env' in params.config['configurations'] and params.audit_solr_enabled:
+      solr_cloud_util.upload_configuration_to_zk(
+        zookeeper_quorum=params.zookeeper_quorum,
+        solr_znode=params.solr_znode,
+        config_set=params.ranger_solr_config_set,
+        config_set_dir=params.ranger_solr_conf,
+        tmp_dir=params.tmp_dir,
+        java64_home=params.java64_home,
+        jaas_file=params.solr_jaas_file,
+        retry=30, interval=5)
+
+      solr_cloud_util.create_collection(
+        zookeeper_quorum=params.zookeeper_quorum,
+        solr_znode=params.solr_znode,
+        collection=params.ranger_solr_collection_name,
+        config_set=params.ranger_solr_config_set,
+        java64_home=params.java64_home,
+        shards=params.ranger_solr_shards,
+        replication_factor=int(params.replication_factor),
+        jaas_file=params.solr_jaas_file)
+
+
+  def stop(self, env, upgrade_type=None):
+    import params
+    env.set_params(params)
+
+    try:
+      env = format('{solr_conf}/solr-env.sh')
+      if not os.path.exists(env):
+        old_env = format('{solr_conf}/solr.in.sh')
+        if os.path.exists(old_env):
+          env = old_env
+        else:
+          self.configure(env)
+
+      no_op_test = format("! ((`SOLR_INCLUDE={env} {solr_bindir}/solr status | grep process | wc -l`))")
+      Execute(format('{solr_bindir}/solr stop -all >> {solr_log}'),
+              environment={'SOLR_INCLUDE': env},
+              user=params.solr_user,
+              not_if=no_op_test
+              )
+
+      File(params.solr_pidfile,
+           action="delete"
+           )
+    except:
+      Logger.warning("Could not stop solr:" + str(sys.exc_info()[1]) + "\n Trying to kill it")
+      self.kill_process(params.solr_pidfile, params.solr_user, params.solr_log_dir)
+
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+
+    check_process_status(status_params.solr_pidfile)
+
+  def kill_process(self, pid_file, user, log_dir):
+    import params
+    """
+    Kill the process by pid file, then check the process is running or not. If the process is still running after the kill
+    command, it will try to kill with -9 option (hard kill)
+    """
+    pid = get_user_call_output(format("cat {pid_file}"), user=user, is_checked_call=False)[1]
+    process_id_exists_command = format("ls {pid_file} >/dev/null 2>&1 && ps -p {pid} >/dev/null 2>&1")
+
+    kill_cmd = format("{sudo} kill {pid}")
+    Execute(kill_cmd,
+          not_if=format("! ({process_id_exists_command})"))
+    wait_time = 5
+
+    hard_kill_cmd = format("{sudo} kill -9 {pid}")
+    Execute(hard_kill_cmd,
+          not_if=format("! ({process_id_exists_command}) || ( sleep {wait_time} && ! ({process_id_exists_command}) )"),
+          ignore_failures=True)
+    try:
+      Execute(format("! ({process_id_exists_command})"),
+            tries=20,
+            try_sleep=3,
+            )
+    except:
+      show_logs(log_dir, user)
+      raise
+
+    File(pid_file,
+       action="delete"
+       )
+
+
+if __name__ == "__main__":
+  Solr().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/solr_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/solr_client.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/solr_client.py
new file mode 100644
index 0000000..3a75e8d
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/solr_client.py
@@ -0,0 +1,51 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management.core.exceptions import ClientComponentHasNoStatus
+from resource_management.libraries.script.script import Script
+from setup_solr import setup_solr
+
+class SolrClient(Script):
+
+  def install(self, env):
+    import params
+    env.set_params(params)
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env, upgrade_type=None):
+    import params
+    env.set_params(params)
+    setup_solr(name ='client')
+
+  def start(self, env, upgrade_type=None):
+    import params
+    env.set_params(params)
+    self.configure(env)
+
+  def stop(self, env, upgrade_type=None):
+    import params
+    env.set_params(params)
+
+  def status(self, env):
+    raise ClientComponentHasNoStatus()
+
+
+if __name__ == "__main__":
+  SolrClient().execute()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/status_params.py b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/status_params.py
new file mode 100644
index 0000000..a740242
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/scripts/status_params.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management.libraries.functions import get_kinit_path
+from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.script.script import Script
+
+config = Script.get_config()
+
+solr_port = default('configurations/solr-env/solr_port', '8983')
+solr_piddir = default('configurations/solr-env/solr_pid_dir', '/var/run/solr')
+solr_pidfile = format("{solr_piddir}/solr-{solr_port}.pid")
+
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))

http://git-wip-us.apache.org/repos/asf/ambari/blob/512caee1/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/templates/solr_jaas.conf.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/templates/solr_jaas.conf.j2 b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/templates/solr_jaas.conf.j2
new file mode 100644
index 0000000..24df10f
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/BigInsights/4.2.5/services/SOLR/package/templates/solr_jaas.conf.j2
@@ -0,0 +1,26 @@
+{#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#}
+
+Client {
+ com.sun.security.auth.module.Krb5LoginModule required
+ useKeyTab=true
+ storeKey=true
+ useTicketCache=false
+ keyTab="{{solr_kerberos_keytab}}"
+ principal="{{solr_kerberos_principal}}";
+};
\ No newline at end of file


Mime
View raw message