This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bigtop-manager.git


The following commit(s) were added to refs/heads/main by this push:
     new 7b54773  BIGTOP-4137: Add Solr component on Bigtop-3.3.0 stack  (#40)
7b54773 is described below

commit 7b547730354617ccd0b49cdc7bcc14627bcd0955
Author: lvkaihua <[email protected]>
AuthorDate: Wed Aug 21 17:16:38 2024 +0800

    BIGTOP-4137: Add Solr component on Bigtop-3.3.0 stack  (#40)
---
 .../3.3.0/services/solr/configuration/solr-env.xml | 307 +++++++++++++++++++++
 .../services/solr/configuration/solr-log4j.xml     | 103 +++++++
 .../3.3.0/services/solr/configuration/solr-xml.xml | 123 +++++++++
 .../stacks/bigtop/3.3.0/services/solr/metainfo.xml |  69 +++++
 .../stacks/bigtop/3.3.0/services/solr/order.json   |   3 +
 .../stack/bigtop/v3_3_0/solr/SolrClientScript.java |  43 +++
 .../stack/bigtop/v3_3_0/solr/SolrParams.java       |  95 +++++++
 .../stack/bigtop/v3_3_0/solr/SolrServerScript.java |  95 +++++++
 .../stack/bigtop/v3_3_0/solr/SolrSetup.java        |  88 ++++++
 9 files changed, 926 insertions(+)

diff --git 
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-env.xml
 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-env.xml
new file mode 100644
index 0000000..39657e6
--- /dev/null
+++ 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-env.xml
@@ -0,0 +1,307 @@
+<?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>solr_port</name>
+        <value>8983</value>
+        <description>Solr port</description>
+    </property>
+
+    <property>
+        <name>solr_jmx_port</name>
+        <value>18983</value>
+        <description>Solr JMX port</description>
+    </property>
+
+    <property>
+        <name>solr_pid_dir</name>
+        <value>/var/run/solr</value>
+        <description>Solr Process ID Directory</description>
+    </property>
+
+    <property>
+        <name>solr_log_dir</name>
+        <value>/var/log/solr</value>
+        <description>Directory for Solr logs</description>
+    </property>
+
+    <property>
+        <name>solr_user</name>
+        <value>solr</value>
+        <description>Solr user</description>
+    </property>
+
+    <property>
+        <name>solr_datadir</name>
+        <value>/var/lib/solr/data</value>
+        <description>Directory for storting Solr index. Make sure you have 
enough disk space</description>
+    </property>
+
+    <property>
+        <name>solr_ssl_enabled</name>
+        <value>false</value>
+        <description>Enable ssl to Solr</description>
+    </property>
+
+    <property>
+        <name>solr_truststore_location</name>
+        <value>/etc/security/serverKeys/infra.solr.trustStore.jks</value>
+        <description>Location of the trust store file. (default value is not 
generated)</description>
+    </property>
+
+    <property>
+        <name>solr_truststore_type</name>
+        <value>jks</value>
+        <description>Type of the trust store file.</description>
+    </property>
+
+    <property>
+        <name>solr_truststore_password</name>
+        <value>bigdata</value>
+        <description>Password to open the trust store file.</description>
+    </property>
+
+    <property>
+        <name>solr_keystore_location</name>
+        <value>/etc/security/serverKeys/infra.solr.keyStore.jks</value>
+    </property>
+
+    <property>
+        <name>solr_keystore_type</name>
+        <value>jks</value>
+    </property>
+
+    <property>
+        <name>solr_keystore_password</name>
+        <value>bigdata</value>
+        <description>Password to open the key store file.</description>
+    </property>
+
+    <property>
+        <name>solr_znode</name>
+        <value>/solr</value>
+        <description>Zookeeper znode, e.g: /solr</description>
+    </property>
+
+    <property>
+        <name>solr_minmem</name>
+        <value>1024</value>
+        <description>Solr minimum heap size e.g. 512m</description>
+    </property>
+
+    <property>
+        <name>solr_maxmem</name>
+        <value>2048</value>
+        <description>Solr maximum heap size e.g. 512m</description>
+    </property>
+
+    <property>
+        <name>solr_java_stack_size</name>
+        <value>1</value>
+        <description>Java Stack Size of Solr (-Xss) in MB.</description>
+    </property>
+
+    <property>
+        <name>solr_jmx_enabled</name>
+        <value>false</value>
+        <description>Set to true to activate the JMX RMI connector to allow 
remote JMX client applications to monitor
+            the JVM hosting Solr
+        </description>
+    </property>
+
+    <property>
+        <name>solr_kerberos_keytab</name>
+        <value>/etc/security/keytabs/solr.service.keytab</value>
+        <description>The path to the Kerberos Keytab file containing service 
principal of the Solr.</description>
+    </property>
+
+    <property>
+        <name>solr_kerberos_principal</name>
+        <value>solr</value>
+        <description>The service principal for Solr.</description>
+    </property>
+
+    <property>
+        <name>solr_web_kerberos_keytab</name>
+        <value>/etc/security/keytabs/spnego.service.keytab</value>
+        <description>The path to the Kerberos Keytab file containing service 
principal of the Solr.</description>
+    </property>
+
+    <property>
+        <name>solr_web_kerberos_principal</name>
+        <value>HTTP/[email protected]</value>
+        <description>The service principal for the Solr.</description>
+    </property>
+
+    <property>
+        <name>solr_zookeeper_quorum</name>
+        <value>
+            <![CDATA[<#if zookeeper_quorum?? ><#list zookeeper_quorum as 
host>${host}:2181<#sep>,</#sep></#list><#else>localhost:2181</#if>]]></value>
+        <description>Placeholder for Solr Zookeeper connection string. (Use 
the cluster one by default, you can override
+            this with a custom one if ZK needs to be external)
+        </description>
+    </property>
+    <property>
+        <name>solr_host</name>
+        <value>${host}</value>
+        <description>Placeholder for Solr Zookeeper connection string. (Use 
the cluster one by default, you can override
+            this with a custom one if ZK needs to be external)
+        </description>
+    </property>
+
+    <property>
+        <name>solr_zookeeper_external_principal</name>
+        <value>zookeeper/[email protected]</value>
+        <description>The kerberos service principal name for external 
ZooKeeper.</description>
+    </property>
+
+    <property>
+        <name>solr_zookeeper_external_enabled</name>
+        <value>false</value>
+        <description>Enable external ZooKeeper. If the Solr is secure, the 
external ZK should be secure as well.
+        </description>
+    </property>
+
+    <property>
+        <name>solr_kerberos_name_rules</name>
+        <value>DEFAULT</value>
+        <description>Kerberos name rules for Spnego</description>
+    </property>
+
+    <property>
+        <name>solr_user_nofile_limit</name>
+        <value>128000</value>
+        <description>Max open files limit setting for solr user.</description>
+    </property>
+
+    <property>
+        <name>solr_user_nproc_limit</name>
+        <value>65536</value>
+        <description>Max number of processes limit setting for solr 
user.</description>
+    </property>
+
+    <property>
+        <name>solr_extra_java_opts</name>
+        <value></value>
+        <description>Extra Solr java options (e.g.: -Dproperty=value), that 
will be added to SOLR_OPTS environment
+            variable
+        </description>
+    </property>
+
+    <property>
+        <name>solr_gc_log_opts</name>
+        <value></value>
+    </property>
+    <property>
+        <name>solr_gc_tune</name>
+        <value></value>
+    </property>
+    <property>
+        <name>solr_min_mem</name>
+        <value>1024</value>
+    </property>
+    <property>
+        <name>solr_max_mem</name>
+        <value>2048</value>
+    </property>
+    <property>
+        <name>security_enabled</name>
+        <value>false</value>
+    </property>
+
+    <!-- solr-env.sh -->
+    <property>
+        <name>content</name>
+        <display-name>solr-env template</display-name>
+        <description>This is the freemarker template for solr-env.sh 
file</description>
+        <attrs>
+            <type>longtext</type>
+        </attrs>
+        <value><![CDATA[
+# By default the script will use JAVA_HOME to determine which java
+# to use, but you can set a specific path for Solr to use without
+# affecting other Java applications on your server/workstation.
+SOLR_JAVA_HOME=${JAVA_HOME}
+
+# Increase Java Min/Max Heap as needed to support your indexing / query needs
+SOLR_JAVA_MEM="-Xms${solr_min_mem}m -Xmx${solr_max_mem}m"
+
+SOLR_JAVA_STACK_SIZE="-Xss${solr_java_stack_size}m"
+
+GC_LOG_OPTS="${solr_gc_log_opts} -Xloggc:${solr_log_dir}/solr_gc.log"
+
+GC_TUNE="${solr_gc_tune}"
+
+# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
+# e.g. host1:2181,host2:2181/chroot
+# Leave empty if not using SolrCloud
+ZK_HOST="${solr_zookeeper_quorum}${solr_znode}"
+
+# Set the ZooKeeper client timeout (for SolrCloud mode)
+ZK_CLIENT_TIMEOUT="60000"
+
+# By default the start script uses "localhost"; override the hostname here
+# for production SolrCloud environments to control the hostname exposed to 
cluster state
+SOLR_HOST="${solr_host}"
+
+# By default the start script uses UTC; override the timezone if needed
+#SOLR_TIMEZONE="UTC"
+
+# Set to true to activate the JMX RMI connector to allow remote JMX client 
applications
+# to monitor the JVM hosting Solr; set to "false" to disable that behavior
+# (false is recommended in production environments)
+ENABLE_REMOTE_JMX_OPTS="${solr_jmx_enabled}"
+
+# The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here
+RMI_PORT=${solr_jmx_port}
+
+# Anything you add to the SOLR_OPTS variable will be included in the java
+# start command line as-is, in ADDITION to other options. If you specify the
+# -a option on start script, those options will be appended as well. Examples:
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoSoftCommit.maxTime=3000"
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoCommit.maxTime=60000"
+#SOLR_OPTS="$SOLR_OPTS -Dsolr.clustering.enabled=true"
+SOLR_OPTS="$SOLR_OPTS -Djava.rmi.server.hostname=${solr_host}"
+SOLR_OPTS="$SOLR_OPTS ${solr_extra_java_opts}"
+
+
+# Location where the bin/solr script will save PID files for running instances
+# If not set, the script will create PID files in $SOLR_TIP/bin
+SOLR_PID_DIR=${solr_pid_dir}
+
+# Path to a directory where Solr creates index files, the specified directory
+# must contain a solr.xml; by default, Solr will use server/solr
+SOLR_HOME=${solr_datadir}
+
+# Solr provides a default Log4J configuration properties file in 
server/resources
+# however, you may want to customize the log settings and file appender 
location
+# so you can point the script to use a different log4j.properties file
+LOG4J_PROPS=/etc/solr/conf/log4j2.xml
+
+# Location where Solr should write logs to; should agree with the file appender
+# settings in server/resources/log4j.properties
+SOLR_LOGS_DIR=${solr_log_dir}
+
+# Sets the port Solr binds to, default is 8983
+SOLR_PORT=${solr_port}
+    ]]>
+        </value>
+    </property>
+</configuration>
diff --git 
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-log4j.xml
 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-log4j.xml
new file mode 100644
index 0000000..e8483c4
--- /dev/null
+++ 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-log4j.xml
@@ -0,0 +1,103 @@
+<?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>log_maxfilesize</name>
+        <value>10</value>
+        <description>The maximum size of backup file before the log is 
rotated</description>
+        <display-name>Solr Log: backup file size</display-name>
+    </property>
+
+    <property>
+        <name>log_maxbackupindex</name>
+        <value>9</value>
+        <description>The number of backup files</description>
+        <display-name>Solr Log: # of backup files</display-name>
+    </property>
+    <property>
+        <name>content</name>
+        <display-name>solr-log4j template</display-name>
+        <description>This is the freemarker template for 
log4j2.xml</description>
+        <attrs>
+            <type>longtext</type>
+        </attrs>
+        <value><![CDATA[
+<Configuration>
+  <Appenders>
+
+    <Console name="STDOUT" target="SYSTEM_OUT">
+      <PatternLayout>
+        <Pattern>
+          %d{ISO8601} [%t] %-5p [%X{collection} %X{shard} %X{replica} 
%X{core}] %C (%F:%L) - %m%n
+        </Pattern>
+      </PatternLayout>
+    </Console>
+
+    <RollingFile
+            name="RollingFile"
+            fileName="${solr_log_dir}/solr.log"
+            filePattern="${solr_log_dir}/solr.log.%i" >
+      <PatternLayout>
+        <Pattern>
+          %d{ISO8601} [%t] %-5p [%X{collection} %X{shard} %X{replica} 
%X{core}] %C (%F:%L) - %m%n
+        </Pattern>
+      </PatternLayout>
+      <Policies>
+        <OnStartupTriggeringPolicy />
+        <SizeBasedTriggeringPolicy size="${log_maxfilesize} MB"/>
+      </Policies>
+      <DefaultRolloverStrategy max="${log_maxbackupindex}"/>
+    </RollingFile>
+
+    <RollingFile
+            name="SlowFile"
+            fileName="${solr_log_dir}/solr_slow_requests.log"
+            filePattern="${solr_log_dir}/solr_slow_requests.log.%i" >
+      <PatternLayout>
+        <Pattern>
+          %d{ISO8601} [%t] %-5p [%X{collection} %X{shard} %X{replica} 
%X{core}] %C (%F:%L) - %m%n
+        </Pattern>
+      </PatternLayout>
+      <Policies>
+        <OnStartupTriggeringPolicy />
+        <SizeBasedTriggeringPolicy size="${log_maxfilesize} MB"/>
+      </Policies>
+      <DefaultRolloverStrategy max="${log_maxbackupindex}"/>
+    </RollingFile>
+
+  </Appenders>
+  <Loggers>
+    <Logger name="org.apache.hadoop" level="warn"/>
+    <Logger name="org.apache.solr.update.LoggingInfoStream" level="off"/>
+    <Logger name="org.apache.zookeeper" level="warn"/>
+    <Logger name="org.apache.solr.core.SolrCore.SlowRequest" level="warn" 
additivity="false">
+      <AppenderRef ref="SlowFile"/>
+    </Logger>
+
+    <Root level="warn">
+      <AppenderRef ref="RollingFile"/>
+      <!-- <AppenderRef ref="STDOUT"/> -->
+    </Root>
+  </Loggers>
+</Configuration>
+    ]]>
+        </value>
+    </property>
+</configuration>
diff --git 
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-xml.xml
 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-xml.xml
new file mode 100644
index 0000000..856ae58
--- /dev/null
+++ 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/configuration/solr-xml.xml
@@ -0,0 +1,123 @@
+<?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>maxBooleanClauses</name>
+        <value>${solr.max.booleanClauses:1024}</value>
+    </property>
+    <property>
+        <name>sharedLib</name>
+        <value>${solr.sharedLib:}</value>
+    </property>
+    <property>
+        <name>allowPaths</name>
+        <value>${solr.allowPaths:}</value>
+    </property>
+    <property>
+        <name>host</name>
+        <value>${host:}</value>
+    </property>
+    <property>
+        <name>hostPort</name>
+        <value>${solr.port.advertise:0}</value>
+    </property>
+    <property>
+        <name>hostContext</name>
+        <value>${hostContext:solr}</value>
+    </property>
+    <property>
+        <name>genericCoreNodeNames</name>
+        <value>${genericCoreNodeNames:true}</value>
+    </property>
+    <property>
+        <name>zkClientTimeout</name>
+        <value>${zkClientTimeout:30000}</value>
+    </property>
+    <property>
+        <name>distribUpdateSoTimeout</name>
+        <value>${distribUpdateSoTimeout:600000}</value>
+    </property>
+    <property>
+        <name>distribUpdateConnTimeout</name>
+        <value>${distribUpdateConnTimeout:60000}</value>
+    </property>
+    <property>
+        <name>zkCredentialsProvider</name>
+        
<value>${zkCredentialsProvider:org.apache.solr.common.cloud.DefaultZkCredentialsProvider}</value>
+    </property>
+    <property>
+        <name>zkCredentialsProvider</name>
+        
<value>${zkCredentialsProvider:org.apache.solr.common.cloud.DefaultZkCredentialsProvider}</value>
+    </property>
+    <property>
+        <name>zkACLProvider</name>
+        
<value>${zkACLProvider:org.apache.solr.common.cloud.DefaultZkACLProvider}</value>
+    </property>
+    <property>
+        <name>socketTimeout</name>
+        <value>${socketTimeout:600000}</value>
+    </property>
+    <property>
+        <name>connTimeout</name>
+        <value>${connTimeout:60000}</value>
+    </property>
+    <property>
+        <name>shardsWhitelist</name>
+        <value>${solr.shardsWhitelist:}</value>
+    </property>
+    <property>
+        <name>metricsenabled</name>
+        <value>{metricsEnabled:true</value>
+    </property>
+    <property>
+        <name>content</name>
+        <display-name>solr-xml template</display-name>
+        <description>This is the freemarker template for solr.xml 
file</description>
+        <attrs>
+            <type>longtext</type>
+        </attrs>
+        <value><![CDATA[
+<solr>
+  <int name="maxBooleanClauses">${maxBooleanClauses}</int>
+  <str name="sharedLib">${sharedLib}</str>
+  <str name="allowPaths">${allowPaths}</str>
+  <solrcloud>
+    <str name="host">${host}</str>
+    <int name="hostPort">${hostPort}</int>
+    <str name="hostContext">${hostContext}</str>
+    <bool name="genericCoreNodeNames">${genericCoreNodeNames}</bool>
+    <int name="zkClientTimeout">${zkClientTimeout}</int>
+    <int name="distribUpdateSoTimeout">${distribUpdateSoTimeout}</int>
+    <int name="distribUpdateConnTimeout">${distribUpdateConnTimeout}</int>
+    <str name="zkCredentialsProvider">${zkCredentialsProvider}</str>
+    <str name="zkACLProvider">${zkACLProvider}</str>
+  </solrcloud>
+  <shardHandlerFactory name="shardHandlerFactory"
+    class="HttpShardHandlerFactory">
+    <int name="socketTimeout">${socketTimeout}</int>
+    <int name="connTimeout">${connTimeout}</int>
+    <str name="shardsWhitelist">${shardsWhitelist}</str>
+  </shardHandlerFactory>
+  <metrics enabled="${metricsenabled}"/>
+</solr>
+      ]]>
+        </value>
+    </property>
+</configuration>
diff --git 
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml
 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml
new file mode 100644
index 0000000..15581b2
--- /dev/null
+++ 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml
@@ -0,0 +1,69 @@
+<?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
+  ~
+  ~    https://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>
+    <schema-version>2.0</schema-version>
+    <service>
+        <name>solr</name>
+        <display-name>Solr</display-name>
+        <desc>
+            Solr is the popular, blazing-fast, open source enterprise search 
platform built on Apache Lucene.
+        </desc>
+        <version>8.11.2-2</version>
+        <user>solr</user>
+        <components>
+            <component>
+                <name>solr_instance</name>
+                <display-name>Solr Instance</display-name>
+                <category>master</category>
+                <cardinality>1+</cardinality>
+                <command-script>
+                    
<script-id>org.apache.bigtop.manager.stack.bigtop.v3_3_0.solr.SolrServerScript</script-id>
+                    <script-type>java</script-type>
+                    <timeout>1200</timeout>
+                </command-script>
+                <quick-link>
+                    <display-name>Solr UI</display-name>
+                    <http-port-property>solr_port</http-port-property>
+                    <http-port-default>8983</http-port-default>
+                    <https-port-property>solr_port</https-port-property>
+                    <https-port-default>8983</https-port-default>
+                </quick-link>
+            </component>
+        </components>
+
+        <os-specifics>
+            <os-specific>
+                <operating-systems>
+                    <os>centos7</os>
+                    <os>rocky8</os>
+                </operating-systems>
+                <architectures>
+                    <arch>x86_64</arch>
+                </architectures>
+                <packages>
+                    <package>solr_3_3_0</package>
+                </packages>
+            </os-specific>
+        </os-specifics>
+        <required-services>
+            <service>zookeeper</service>
+        </required-services>
+    </service>
+</metainfo>
diff --git 
a/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/order.json
 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/order.json
new file mode 100644
index 0000000..bb25a4c
--- /dev/null
+++ 
b/bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/order.json
@@ -0,0 +1,3 @@
+{
+    "SOLR_INSTANCE-START" : ["ZOOKEEPER_SERVER-START"]
+}
\ No newline at end of file
diff --git 
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrClientScript.java
 
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrClientScript.java
new file mode 100644
index 0000000..23320fe
--- /dev/null
+++ 
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrClientScript.java
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
+ *    https://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.
+ */
+package org.apache.bigtop.manager.stack.bigtop.v3_3_0.solr;
+
+import org.apache.bigtop.manager.common.shell.ShellResult;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractClientScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+
+import com.google.auto.service.AutoService;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+@AutoService(Script.class)
+public class SolrClientScript extends AbstractClientScript {
+
+    @Override
+    public ShellResult install(Params params) {
+        return PackageUtils.install(params.getPackageList());
+    }
+
+    @Override
+    public ShellResult configure(Params params) {
+        return SolrSetup.config(params);
+    }
+}
diff --git 
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrParams.java
 
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrParams.java
new file mode 100644
index 0000000..2f5a9f1
--- /dev/null
+++ 
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrParams.java
@@ -0,0 +1,95 @@
+/*
+ * 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
+ *
+ *    https://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.
+ */
+package org.apache.bigtop.manager.stack.bigtop.v3_3_0.solr;
+
+import org.apache.bigtop.manager.common.message.entity.payload.CommandPayload;
+import org.apache.bigtop.manager.stack.core.annotations.GlobalParams;
+import org.apache.bigtop.manager.stack.core.param.BaseParams;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
+
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
+
+@Getter
+@Slf4j
+public class SolrParams extends BaseParams {
+
+    private String solrPort = "8983";
+    private String solrLogDir = "/var/log/solr";
+    private String solrPidDir = "/var/run/solr";
+    private String solrHomeDir = "/var/lib/solr";
+    private String solrDataDir = "/var/lib/solr/data";
+    private String solrPidFile = solrPidDir + "/solr-" + solrPort + ".pid";
+
+    public SolrParams(CommandPayload commandPayload) {
+        super(commandPayload);
+        globalParamsMap.put("java_home", "/usr/local/java");
+        globalParamsMap.put("solr_home", solrHomeDir);
+        globalParamsMap.put("security_enabled", false);
+        globalParamsMap.put("solr_pid_file", solrPidFile);
+        globalParamsMap.put("solr_user", "solr");
+        globalParamsMap.put("solr_group", "hadoop");
+    }
+
+    @GlobalParams
+    public Map<String, Object> solrXml() {
+        return LocalSettings.configurations(serviceName(), "solr-xml");
+    }
+
+    @GlobalParams
+    public Map<String, Object> solrLog4j() {
+        return LocalSettings.configurations(serviceName(), "solr-log4j");
+    }
+
+    public String getZnode() {
+        Map<String, Object> solrEnv = 
LocalSettings.configurations(serviceName(), "solr-env");
+        String znode = (String) solrEnv.get("solr_znode");
+        return znode;
+    }
+
+    public String getzkString() {
+        List<String> ZookeeperServerHosts = 
LocalSettings.hosts("zookeeper_server");
+        Map<String, Object> Zkport = LocalSettings.configurations("zookeeper", 
"zoo.cfg");
+        String clientPort = (String) Zkport.get("clientPort");
+        String solrzkString = MessageFormat.format("{0}:{1}", 
ZookeeperServerHosts.get(0), clientPort);
+        return solrzkString;
+    }
+
+    public String zkHost() {
+        String Znode = getZnode();
+        String SolrZkstring = getzkString();
+        String Zkconnect = MessageFormat.format("{0}{1}", SolrZkstring, Znode);
+        return Zkconnect;
+    }
+
+    @GlobalParams
+    public Map<String, Object> solrEnv() {
+        Map<String, Object> solrEnv = 
LocalSettings.configurations(serviceName(), "solr-env");
+        solrLogDir = (String) solrEnv.get("solr_log_dir");
+        solrPidDir = (String) solrEnv.get("solr_pid_dir");
+        solrDataDir = (String) solrEnv.get("solr_datadir");
+        solrPort = (String) solrEnv.get("SOLR_PORT");
+        solrPidFile = solrPidDir + "/solr-" + solrPort + ".pid";
+        return solrEnv;
+    }
+}
diff --git 
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrServerScript.java
 
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrServerScript.java
new file mode 100644
index 0000000..fdff7da
--- /dev/null
+++ 
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrServerScript.java
@@ -0,0 +1,95 @@
+/*
+ * 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
+ *
+ *    https://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.
+ */
+package org.apache.bigtop.manager.stack.bigtop.v3_3_0.solr;
+
+import org.apache.bigtop.manager.common.shell.ShellResult;
+import org.apache.bigtop.manager.stack.core.exception.StackException;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.spi.script.AbstractServerScript;
+import org.apache.bigtop.manager.stack.core.spi.script.Script;
+import org.apache.bigtop.manager.stack.core.utils.PackageUtils;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxOSUtils;
+
+import com.google.auto.service.AutoService;
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+@Slf4j
+@AutoService(Script.class)
+public class SolrServerScript extends AbstractServerScript {
+
+    @Override
+    public ShellResult install(Params params) {
+        return PackageUtils.install(params.getPackageList());
+    }
+
+    @Override
+    public ShellResult configure(Params params) {
+        return SolrSetup.config(params);
+    }
+
+    @Override
+    public ShellResult start(Params params) {
+        configure(params);
+        SolrParams solrParams = (SolrParams) params;
+        String confdir = MessageFormat.format("export 
SOLR_INCLUDE={0}/solr-env.sh", solrParams.confDir());
+        ShellResult shellResult = create_solr_znode(params);
+        String cmd = MessageFormat.format(
+                "{0} && {1}/bin/solr start -cloud -noprompt -s {2} -z {3}",
+                confdir, solrParams.serviceHome(), 
solrParams.getSolrDataDir(), solrParams.zkHost());
+        try {
+            return LinuxOSUtils.sudoExecCmd(cmd, solrParams.user());
+        } catch (IOException e) {
+            throw new StackException(e);
+        }
+    }
+
+    @Override
+    public ShellResult stop(Params params) {
+        SolrParams solrParams = (SolrParams) params;
+        String cmd = MessageFormat.format("{0}/bin/solr stop -all", 
solrParams.serviceHome());
+        try {
+            return LinuxOSUtils.sudoExecCmd(cmd, solrParams.user());
+        } catch (IOException e) {
+            throw new StackException(e);
+        }
+    }
+
+    @Override
+    public ShellResult status(Params params) {
+        SolrParams solrParams = (SolrParams) params;
+        return LinuxOSUtils.checkProcess(solrParams.getSolrPidFile());
+    }
+
+    public ShellResult create_solr_znode(Params params) {
+        configure(params);
+        SolrParams solrParams = (SolrParams) params;
+        String zNode = solrParams.getZnode();
+        String solrZkString = solrParams.getzkString();
+        String cmd = MessageFormat.format(
+                "{0}/bin/solr zk mkroot {1} -z {2} 2>&1", 
solrParams.serviceHome(), zNode, solrZkString);
+        try {
+            return LinuxOSUtils.sudoExecCmd(cmd, solrParams.user());
+        } catch (IOException e) {
+            throw new StackException(e);
+        }
+    }
+}
diff --git 
a/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrSetup.java
 
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrSetup.java
new file mode 100644
index 0000000..de48181
--- /dev/null
+++ 
b/bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/solr/SolrSetup.java
@@ -0,0 +1,88 @@
+/*
+ * 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
+ *
+ *    https://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.
+ */
+package org.apache.bigtop.manager.stack.bigtop.v3_3_0.solr;
+
+import org.apache.bigtop.manager.common.constants.Constants;
+import org.apache.bigtop.manager.common.shell.ShellResult;
+import org.apache.bigtop.manager.stack.core.param.Params;
+import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
+import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static 
org.apache.bigtop.manager.common.constants.Constants.PERMISSION_755;
+
+@Slf4j
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class SolrSetup {
+
+    public static ShellResult config(Params params) {
+        log.info("solrSetup config");
+        SolrParams solrParams = (SolrParams) params;
+
+        String confDir = solrParams.confDir();
+        String solrUser = solrParams.user();
+        String solrGroup = solrParams.group();
+        Map<String, Object> solrEnv = solrParams.solrEnv();
+
+        LinuxFileUtils.createDirectories(solrParams.getSolrHomeDir(), 
solrUser, solrGroup, PERMISSION_755, true);
+        LinuxFileUtils.createDirectories(solrParams.getSolrDataDir(), 
solrUser, solrGroup, PERMISSION_755, true);
+        LinuxFileUtils.createDirectories(solrParams.getSolrLogDir(), solrUser, 
solrGroup, PERMISSION_755, true);
+        LinuxFileUtils.createDirectories(solrParams.getSolrPidDir(), solrUser, 
solrGroup, PERMISSION_755, true);
+
+        // solr-env.xml
+        List<String> zookeeperServerHosts = 
LocalSettings.hosts("zookeeper_server");
+        Map<String, Object> paramMap = new HashMap<>();
+        paramMap.put("zookeeper_quorum", zookeeperServerHosts);
+        paramMap.put("host", solrParams.hostname());
+        LinuxFileUtils.toFileByTemplate(
+                solrEnv.get("content").toString(),
+                MessageFormat.format("{0}/solr-env.sh", confDir),
+                solrUser,
+                solrGroup,
+                Constants.PERMISSION_755,
+                solrParams.getGlobalParamsMap(),
+                paramMap);
+        // solr-log4j.xml
+        LinuxFileUtils.toFileByTemplate(
+                solrParams.solrLog4j().get("content").toString(),
+                MessageFormat.format("{0}/log4j2.xml", confDir),
+                solrUser,
+                solrGroup,
+                Constants.PERMISSION_755,
+                solrParams.getGlobalParamsMap());
+        // solr-xml.xml
+        LinuxFileUtils.toFileByTemplate(
+                solrParams.solrXml().get("content").toString(),
+                MessageFormat.format("{0}/solr.xml", 
solrParams.getSolrDataDir()),
+                solrUser,
+                solrGroup,
+                Constants.PERMISSION_755,
+                solrParams.getGlobalParamsMap());
+
+        return ShellResult.success("solr Server Configure success!");
+    }
+}


Reply via email to