BIGTOP-2869: Bump solr to v6.6.0 Change-Id: I0b0f21e749d3638b69f9dcb9e0439cd9646ce804 Signed-off-by: Jun He <[email protected]> Signed-off-by: Olaf Flebbe <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/b7306931 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/b7306931 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/b7306931 Branch: refs/heads/master Commit: b730693150a4a075539961de444d8d367713f8d8 Parents: 925749d Author: Jun He <[email protected]> Authored: Mon Aug 14 07:22:44 2017 +0000 Committer: Olaf Flebbe <[email protected]> Committed: Sun Nov 26 17:33:32 2017 +0100 ---------------------------------------------------------------------- .../src/common/solr/do-component-build | 1 - bigtop-packages/src/common/solr/install_solr.sh | 171 +-- bigtop-packages/src/common/solr/server.xml | 150 --- .../src/common/solr/solr-server.init.debian | 265 ++-- bigtop-packages/src/common/solr/solr.default | 143 +- bigtop-packages/src/common/solr/solrctl.sh | 72 +- bigtop-packages/src/common/solr/solrd | 126 ++ .../src/common/solr/tomcat-deployment.sh | 37 - bigtop-packages/src/common/solr/web.xml | 1226 ------------------ bigtop-packages/src/deb/solr/control | 14 +- bigtop-packages/src/deb/solr/solr.install | 4 +- bigtop-packages/src/deb/solr/solr.postinst | 1 - bigtop-packages/src/deb/solr/solr.prerm | 1 - .../src/rpm/solr/SOURCES/solr-server.init | 266 ++-- bigtop-packages/src/rpm/solr/SPECS/solr.spec | 19 +- bigtop.bom | 2 +- 16 files changed, 605 insertions(+), 1893 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/b7306931/bigtop-packages/src/common/solr/do-component-build ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/solr/do-component-build b/bigtop-packages/src/common/solr/do-component-build index 9e2ad28..e0c60b3 100755 --- a/bigtop-packages/src/common/solr/do-component-build +++ b/bigtop-packages/src/common/solr/do-component-build @@ -26,7 +26,6 @@ BUILD_OPTS="-Dversion=${FULL_VERSION} -Dhadoop.version=${HADOOP_VERSION} \ -Dreactor.repo=file://${HOME}/.m2/repository" # FIXME: the following really needs to be made flexible at the product level -sed -i -e '/ENTITY.*hadoop.version/s#"[^"]*"#"'${HADOOP_VERSION}'"#' ./solr/test-framework/ivy.xml ./solr/core/ivy.xml sed -i -e '/<dependency org="org.mortbay.jetty" name="jetty"/s#/ *>#>#' solr/core/ivy.xml sed -i -e '/<dependency org="org.mortbay.jetty" name="jetty"/a<artifact name="jetty" ext="jar"/></dependency>' solr/core/ivy.xml http://git-wip-us.apache.org/repos/asf/bigtop/blob/b7306931/bigtop-packages/src/common/solr/install_solr.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/solr/install_solr.sh b/bigtop-packages/src/common/solr/install_solr.sh index 5735d9a..e0a842c 100644 --- a/bigtop-packages/src/common/solr/install_solr.sh +++ b/bigtop-packages/src/common/solr/install_solr.sh @@ -109,46 +109,27 @@ DEFAULT_DIR=${ETC_DIR:-/etc/default} VAR_DIR=$PREFIX/var install -d -m 0755 $PREFIX/$LIB_DIR -cp -ra ${BUILD_DIR}/dist/*.*ar $PREFIX/$LIB_DIR -cp -ra ${BUILD_DIR}/dist/solrj-lib $PREFIX/$LIB_DIR/lib -cp -ra ${BUILD_DIR}/example/solr/collection1/conf $PREFIX/$LIB_DIR/coreconfig-template -cp -fa $DISTRO_DIR/solrconfig.xml $PREFIX/$LIB_DIR/coreconfig-template -cp -fa $DISTRO_DIR/schema.xml $PREFIX/$LIB_DIR/coreconfig-template +cp -ra ${BUILD_DIR}/dist $PREFIX/$LIB_DIR/lib +# create symlink as configsets and post script reference 'dist' dir +ln -s $LIB_DIR/lib $PREFIX/$LIB_DIR/dist install -d -m 0755 $PREFIX/$LIB_DIR/contrib -cp -ra ${BUILD_DIR}/contrib/velocity $PREFIX/$LIB_DIR/contrib -cp -ra ${BUILD_DIR}/contrib/map-reduce $PREFIX/$LIB_DIR/contrib -cp -ra ${BUILD_DIR}/example/scripts/map-reduce $PREFIX/$LIB_DIR/contrib -cp -ra ${BUILD_DIR}/contrib/morphlines* $PREFIX/$LIB_DIR/contrib +cp -ra ${BUILD_DIR}/contrib/* $PREFIX/$LIB_DIR/contrib -install -d -m 0755 $PREFIX/$LIB_DIR/server/webapps/solr -(cd $PREFIX/$LIB_DIR/server/webapps/solr ; jar xf ../../../*.war) -ln -s /var/lib/solr $PREFIX/$LIB_DIR/server/work -cp ${BUILD_DIR}/example/lib/ext/*.jar $PREFIX/$LIB_DIR/server/webapps/solr/WEB-INF/lib/ - -install -d -m 0755 $PREFIX/$LIB_DIR/server/webapps/ROOT -cat > $PREFIX/$LIB_DIR/server/webapps/ROOT/index.html <<__EOT__ -<html><head><meta http-equiv="refresh" content="0;url=./solr"></head><body><a href="/solr">Solr Console</a></body></html> -__EOT__ - -install -m 0755 ${DISTRO_DIR}/tomcat-deployment.sh ${PREFIX}/${LIB_DIR}/tomcat-deployment.sh - -install -d -m 0755 $PREFIX/etc/solr/tomcat-conf.dist/conf -cp $DISTRO_DIR/web.xml $PREFIX/etc/solr/tomcat-conf.dist/conf -cp $DISTRO_DIR/server.xml $PREFIX/etc/solr/tomcat-conf.dist/conf -cp $DISTRO_DIR/logging.properties $PREFIX/etc/solr/tomcat-conf.dist/conf - -install -d -m 0755 $PREFIX/etc/solr/tomcat-conf.dist/WEB-INF -mv $PREFIX/$LIB_DIR/webapps/solr/WEB-INF/*.xml $PREFIX/etc/solr/tomcat-conf.dist/WEB-INF/ || : - -cp -ra ${BUILD_DIR}/dist/*.*ar $PREFIX/$LIB_DIR -cp -ra ${BUILD_DIR}/dist/solrj-lib $PREFIX/$LIB_DIR/lib +install -d -m 0755 $PREFIX/$LIB_DIR/server +cp -ra ${BUILD_DIR}/server/* $PREFIX/$LIB_DIR/server install -d -m 0755 $PREFIX/$LIB_DIR/bin -cp -a ${BUILD_DIR}/example/scripts/cloud-scripts/*.sh $PREFIX/$LIB_DIR/bin -sed -i -e 's#/../solr-webapp/webapp/WEB-INF/lib/#/../webapps/solr/WEB-INF/lib/#' $PREFIX/$LIB_DIR/bin/zkcli.sh +cp -a ${BUILD_DIR}/bin/solr $PREFIX/$LIB_DIR/bin +cp -a ${BUILD_DIR}/bin/post $PREFIX/$LIB_DIR/bin +cp -a ${BUILD_DIR}/bin/oom_solr.sh $PREFIX/$LIB_DIR/bin +#cp -a ${BUILD_DIR}/server/scripts/cloud-scripts/*.sh $PREFIX/$LIB_DIR/bin +#cp -a $DISTRO_DIR/zkcli.sh $PREFIX/$LIB_DIR/bin chmod 755 $PREFIX/$LIB_DIR/bin/* +install -d -m 0755 $PREFIX/$LIB_DIR/licenses +cp -a ${BUILD_DIR}/licenses/* $PREFIX/$LIB_DIR/licenses + install -d -m 0755 $PREFIX/$DOC_DIR cp -a ${BUILD_DIR}/*.txt $PREFIX/$DOC_DIR cp -ra ${BUILD_DIR}/docs/* $PREFIX/$DOC_DIR @@ -157,131 +138,11 @@ cp -ra ${BUILD_DIR}/example/ $PREFIX/$DOC_DIR/ # Copy in the configuration files install -d -m 0755 $PREFIX/$DEFAULT_DIR cp $DISTRO_DIR/solr.default $PREFIX/$DEFAULT_DIR/solr - install -d -m 0755 $PREFIX/${CONF_DIR}.dist -cp ${BUILD_DIR}/example/resources/log4j.properties $PREFIX/${CONF_DIR}.dist +cp -a ${BUILD_DIR}/server/resources/log4j.properties $PREFIX/${CONF_DIR}.dist # Copy in the wrapper -cat > $PREFIX/$LIB_DIR/bin/solrd <<'EOF' -#!/bin/bash - -BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default} -[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/solr ] && . ${BIGTOP_DEFAULTS_DIR}/solr - -# Autodetect JAVA_HOME if not defined -. /usr/lib/bigtop-utils/bigtop-detect-javahome - -# resolve links - $0 may be a softlink -PRG="${BASH_SOURCE[0]}" - -while [ -h "${PRG}" ]; do - ls=`ls -ld "${PRG}"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "${PRG}"`/"$link" - fi -done - -BASEDIR=`dirname ${PRG}` -BASEDIR=`cd ${BASEDIR}/..;pwd` - -SOLR_PORT=${SOLR_PORT:-8983} -SOLR_ADMIN_PORT=${SOLR_ADMIN_PORT:-8984} -SOLR_LOG=${SOLR_LOG:-/var/log/solr} -SOLR_HOME=${SOLR_HOME:-/var/lib/solr} -SOLR_LOG4J_CONFIG=${SOLR_LOG4J_CONFIG:-/etc/solr/conf/log4j.properties} - -export CATALINA_TMPDIR=${SOLR_DATA:-/var/lib/solr/} -export CATALINA_PID=${SOLR_RUN:-/var/run/solr}/solr.pid -export CATALINA_OUT=${SOLR_LOG:-/var/log/solr}/solr.out - -export CATALINA_HOME=${CATALINA_HOME:-$BASEDIR/../bigtop-tomcat} -export CATALINA_BASE=${CATALINA_BASE:-$CATALINA_TMPDIR/tomcat-deployment} - - -die() { - echo "$@" >&2 - exit 1 -} - -# Preflight checks: -# 1. We are only supporting SolrCloud mode -if [ -z "$SOLR_ZK_ENSEMBLE" ] ; then - die "Error: SOLR_ZK_ENSEMBLE is not set in /etc/default/solr" -fi - -CATALINA_OPTS="${CATALINA_OPTS} -DzkHost=${SOLR_ZK_ENSEMBLE} -Dsolr.solrxml.location=zookeeper" - -if [ -n "$SOLR_HDFS_HOME" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.hdfs.home=${SOLR_HDFS_HOME}" -fi - -if [ -n "$SOLR_HDFS_CONFIG" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.hdfs.confdir=${SOLR_HDFS_CONFIG}" -fi - -if [ "$SOLR_KERBEROS_ENABLED" == "true" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.hdfs.security.kerberos.enabled=${SOLR_KERBEROS_ENABLED}" -fi - -if [ -n "$SOLR_KERBEROS_KEYTAB" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.hdfs.security.kerberos.keytabfile=${SOLR_KERBEROS_KEYTAB}" -fi - -if [ -n "$SOLR_KERBEROS_PRINCIPAL" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.hdfs.security.kerberos.principal=${SOLR_KERBEROS_PRINCIPAL}" -fi - -if [ -n "$SOLR_AUTHENTICATION_TYPE" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.authentication.type=${SOLR_AUTHENTICATION_TYPE}" -fi - -if [ -n "$SOLR_AUTHENTICATION_KERBEROS_KEYTAB" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.authentication.kerberos.keytab=${SOLR_AUTHENTICATION_KERBEROS_KEYTAB}" -fi - -if [ -n "$SOLR_AUTHENTICATION_KERBEROS_PRINCIPAL" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.authentication.kerberos.principal=${SOLR_AUTHENTICATION_KERBEROS_PRINCIPAL}" -fi - -if [ -n "$SOLR_AUTHENTICATION_KERBEROS_NAME_RULES" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.authentication.kerberos.name.rules=${SOLR_AUTHENTICATION_KERBEROS_NAME_RULES}" -fi - -if [ -n "$SOLR_AUTHENTICATION_SIMPLE_ALLOW_ANON" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.authentication.simple.anonymous.allowed=${SOLR_AUTHENTICATION_SIMPLE_ALLOW_ANON}" -fi - -if [ -n "$SOLR_AUTHENTICATION_JAAS_CONF" ] ; then - CATALINA_OPTS="${CATALINA_OPTS} -Djava.security.auth.login.config=${SOLR_AUTHENTICATION_JAAS_CONF}" -fi - -# FIXME: we need to set this because of the jetty-centric default solr.xml -CATALINA_OPTS="${CATALINA_OPTS} -Dhost=$HOSTNAME -Djetty.port=$SOLR_PORT" - -export CATALINA_OPTS="${CATALINA_OPTS} -Dsolr.host=$HOSTNAME - -Dsolr.port=$SOLR_PORT - -Dlog4j.configuration=file://$SOLR_LOG4J_CONFIG - -Dsolr.log=$SOLR_LOG - -Dsolr.admin.port=$SOLR_ADMIN_PORT - -Dsolr.solr.home=$SOLR_HOME" - -# catalina doesn't use CATALINA_OPTS for stop action so we need to -# set JAVA_OPTS to include the admin port -if [ $1 = "stop" ] ; then - export JAVA_OPTS="$CATALINA_OPTS" -fi - -if [ -x /usr/lib/bigtop-utils/bigtop-monitor-service ]; then -if ([ "$1" = "start" -o "$1" = "run" ]) && [ -n "$SOLRD_WATCHDOG_TIMEOUT" ] ; then - /usr/lib/bigtop-utils/bigtop-monitor-service $SOLRD_WATCHDOG_TIMEOUT $$ http://127.0.0.1:8983/solr -fi -fi - -exec ${CATALINA_HOME}/bin/catalina.sh "$@" -EOF +cp -a ${DISTRO_DIR}/solrd $PREFIX/$LIB_DIR/bin/solrd chmod 755 $PREFIX/$LIB_DIR/bin/solrd # installing the only script that goes into /usr/bin http://git-wip-us.apache.org/repos/asf/bigtop/blob/b7306931/bigtop-packages/src/common/solr/server.xml ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/solr/server.xml b/bigtop-packages/src/common/solr/server.xml deleted file mode 100644 index 70b1a84..0000000 --- a/bigtop-packages/src/common/solr/server.xml +++ /dev/null @@ -1,150 +0,0 @@ -<?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. ---> -<!-- Note: A "Server" is not itself a "Container", so you may not - define subcomponents such as "Valves" at this level. - Documentation at /docs/config/server.html - --> -<Server port="${solr.admin.port}" shutdown="SHUTDOWN"> - - <!--APR library loader. Documentation at /docs/apr.html --> - <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> - <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> - <Listener className="org.apache.catalina.core.JasperListener" /> - <!-- Prevent memory leaks due to use of particular java/javax APIs--> - <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> - <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html --> - <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> - <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> - - <!-- Global JNDI resources - Documentation at /docs/jndi-resources-howto.html - --> - <GlobalNamingResources> - <!-- Editable user database that can also be used by - UserDatabaseRealm to authenticate users - --> - <Resource name="UserDatabase" auth="Container" - type="org.apache.catalina.UserDatabase" - description="User database that can be updated and saved" - factory="org.apache.catalina.users.MemoryUserDatabaseFactory" - pathname="conf/tomcat-users.xml" /> - </GlobalNamingResources> - - <!-- A "Service" is a collection of one or more "Connectors" that share - a single "Container" Note: A "Service" is not itself a "Container", - so you may not define subcomponents such as "Valves" at this level. - Documentation at /docs/config/service.html - --> - <Service name="Catalina"> - - <!--The connectors can use a shared executor, you can define one or more named thread pools--> - <!-- - <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" - maxThreads="150" minSpareThreads="4"/> - --> - - - <!-- A "Connector" represents an endpoint by which requests are received - and responses are returned. Documentation at : - Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) - Java AJP Connector: /docs/config/ajp.html - APR (HTTP/AJP) Connector: /docs/apr.html - Define a non-SSL HTTP/1.1 Connector on port 8080 - --> - <Connector port="${solr.port}" protocol="HTTP/1.1" - connectionTimeout="20000" - redirectPort="8443" /> - <!-- A "Connector" using the shared thread pool--> - <!-- - <Connector executor="tomcatThreadPool" - port="8080" protocol="HTTP/1.1" - connectionTimeout="20000" - redirectPort="8443" /> - --> - <!-- Define a SSL HTTP/1.1 Connector on port 8443 - This connector uses the JSSE configuration, when using APR, the - connector should be using the OpenSSL style configuration - described in the APR documentation --> - <!-- - <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" - maxThreads="150" scheme="https" secure="true" - clientAuth="false" sslProtocol="TLS" /> - --> - - <!-- Define an AJP 1.3 Connector on port 8009 --> - <!-- - <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> - --> - - - <!-- An Engine represents the entry point (within Catalina) that processes - every request. The Engine implementation for Tomcat stand alone - analyzes the HTTP headers included with the request, and passes them - on to the appropriate Host (virtual host). - Documentation at /docs/config/engine.html --> - - <!-- You should set jvmRoute to support load-balancing via AJP ie : - <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> - --> - <Engine name="Catalina" defaultHost="localhost"> - - <!--For clustering, please take a look at documentation at: - /docs/cluster-howto.html (simple how to) - /docs/config/cluster.html (reference documentation) --> - <!-- - <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> - --> - - <!-- The request dumper valve dumps useful debugging information about - the request and response data received and sent by Tomcat. - Documentation at: /docs/config/valve.html --> - <!-- - <Valve className="org.apache.catalina.valves.RequestDumperValve"/> - --> - - <!-- This Realm uses the UserDatabase configured in the global JNDI - resources under the key "UserDatabase". Any edits - that are performed against this UserDatabase are immediately - available for use by the Realm. --> - <Realm className="org.apache.catalina.realm.UserDatabaseRealm" - resourceName="UserDatabase"/> - - <!-- Define the default virtual host - Note: XML Schema validation will not work with Xerces 2.2. - --> - <Host name="localhost" appBase="webapps" - unpackWARs="true" autoDeploy="true" - xmlValidation="false" xmlNamespaceAware="false"> - - <!-- SingleSignOn valve, share authentication between web applications - Documentation at: /docs/config/valve.html --> - <!-- - <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> - --> - - <!-- Access log processes all example. - Documentation at: /docs/config/valve.html --> - <!-- - <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" - prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> - --> - - </Host> - </Engine> - </Service> -</Server> http://git-wip-us.apache.org/repos/asf/bigtop/blob/b7306931/bigtop-packages/src/common/solr/solr-server.init.debian ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/solr/solr-server.init.debian b/bigtop-packages/src/common/solr/solr-server.init.debian index 0684032..58ccc80 100644 --- a/bigtop-packages/src/common/solr/solr-server.init.debian +++ b/bigtop-packages/src/common/solr/solr-server.init.debian @@ -1,5 +1,4 @@ -#!/bin/bash -# +#! /bin/sh # 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. @@ -14,145 +13,175 @@ # 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. -# -# Starts a Solr server -# -# chkconfig: 2345 90 10 -# description: Solr server -# + ### BEGIN INIT INFO -# Provides: solr-server -# Required-Start: $remote_fs -# Should-Start: -# Required-Stop: $remote_fs -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Solr server +# Provides: solr-server +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Apache Solr as a Service ### END INIT INFO -. /lib/lsb/init-functions - STATUS_RUNNING=0 STATUS_DEAD=1 STATUS_DEAD_AND_LOCK=2 STATUS_NOT_RUNNING=3 -ERROR_PROGRAM_NOT_INSTALLED=5 - -SOLR_RUN_DIR=/var/run/solr -SOLR_HOME=/usr/lib/solr -SOLR_USER=solr - -SOLR_LOCK_DIR="/var/lock/subsys/" -LOCKFILE="${SOLR_LOCK_DIR}/solr" -desc="Solr server daemon" - -EXEC_PATH=". $SOLR_HOME/bin/solrd" - -BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default} -[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/solr ] && \ - EXEC_PATH=". ${BIGTOP_DEFAULTS_DIR}/solr ; ${EXEC_PATH}" - -SOLR_PID_FILE=${SOLR_RUN_DIR}/solr.pid - -# These directories may be tmpfs and may or may not exist -# depending on the OS (ex: /var/lock/subsys does not exist on debian/ubuntu) -for dir in "$SOLR_RUN_DIR" "$SOLR_LOCK_DIR"; do - [ -d "${dir}" ] || install -d -m 0755 -o $SOLR_USER -g $SOLR_USER ${dir} -done - -SOLR_SHUTDOWN_TIMEOUT=${SOLR_SHUTDOWN_TIMEOUT:-60} - -start() { - [ -x $exec ] || exit $ERROR_PROGRAM_NOT_INSTALLED +SERVICE_DESC="Apache Solr server" +SOLR_INSTALL_DIR="/usr/lib/solr" + +if [ ! -d "$SOLR_INSTALL_DIR" ]; then + echo "$SOLR_INSTALL_DIR not found! Please check the SOLR_INSTALL_DIR setting in your $0 script." + exit 1 +fi + +# Path to an include file that defines environment specific settings to override default +# variables used by the bin/solr script. It's highly recommended to define this script so +# that you can keep the Solr binary files separated from live files (pid, logs, index data, etc) +# see bin/solr.in.sh for an example +SOLR_ENV="/etc/default/solr" + +if [ ! -f "$SOLR_ENV" ]; then + echo "$SOLR_ENV not found! Please check the SOLR_ENV setting in your $0 script." + exit 1 +fi +. $SOLR_ENV +[ "$SOLR_HOME" = "" ] && SOLR_HOME="/var/lib/solr" +[ "$SOLR_PORT" = "" ] && SOLR_PORT="8983" +[ "$SOLR_PID_DIR" = "" ] && SOLR_PID_DIR="/var/run/solr" +SOLR_PID_FILE="$SOLR_PID_DIR/solr-$SOLR_PORT.pid" - checkstatus > /dev/null 2>&1 - status=$? - if [ "$status" -eq "$STATUS_RUNNING" ]; then - exit 0 - fi - - log_success_msg "Starting $desc: " - . /usr/lib/solr/tomcat-deployment.sh - /bin/su -s /bin/bash -c "${EXEC_PATH} start" $SOLR_USER - RETVAL=$? - [ $RETVAL -eq 0 ] && touch $LOCKFILE - return $RETVAL -} - -stop() { - if [ ! -e $SOLR_PID_FILE ]; then - log_success_msg "$desc is not running" - return 0 - fi - - log_success_msg "Stopping ${desc}: " - - /bin/su -s /bin/bash -c "${EXEC_PATH} stop $SOLR_SHUTDOWN_TIMEOUT -force" $SOLR_USER - rm -f $LOCKFILE $SOLR_PID_FILE - return 0 -} +. /lib/lsb/init-functions -restart() { - stop - start +# Specify the user to run Solr as; if not set, then Solr will run as root. +# Running Solr as root is not recommended for production environments +RUNAS="solr" + +# verify the specified run as user exists +runas_uid="`id -u "$RUNAS"`" +if [ $? -ne 0 ]; then + echo "User $RUNAS not found! Please create the $RUNAS user before running this script." + exit 1 +fi + +check_status() +{ + status_of_proc -p $SOLR_PID_FILE $SOLR_INSTALL_DIR/bin/solrd "solr-server" + return $? } -checkstatus(){ - pidofproc -p $SOLR_PID_FILE java > /dev/null - status=$? - - case "$status" in - $STATUS_RUNNING) - log_success_msg "$desc is running" - ;; - $STATUS_DEAD) - log_failure_msg "$desc is dead and pid file exists" - ;; - $STATUS_DEAD_AND_LOCK) - log_failure_msg "$desc is dead and lock file exists" - ;; - $STATUS_NOT_RUNNING) - log_failure_msg "$desc agent is not running" - ;; - *) - log_failure_msg "$desc agent status is unknown" - ;; - esac - return $status +start_server() +{ + start-stop-daemon --start --quiet --chuid $RUNAS:$RUNAS \ + --exec $SOLR_INSTALL_DIR/bin/solrd -- start --config "$SOLR_ENV" > /dev/null 2>&1 || return 2 } -condrestart(){ - [ -e ${LOCKFILE} ] && restart || : +stop_server() +{ + /bin/su -s /bin/bash -c \ + "$SOLR_INSTALL_DIR/bin/solrd stop --config $SOLR_ENV" $SOLR_USER > /dev/null 2>&1 || return 2 +# rm -f $SOLR_PID_FILE } -init(){ - rm -rf /var/lib/solr/* -} +export PATH="${PATH:+$PATH:}/usr/lib/solr/bin:/usr/sbin:/sbin" case "$1" in start) - start - ;; + check_status > /dev/null 2>&1 + status=$? + if [ $status = 0 ]; then + log_success_msg "${SERVICE_DESC} is already running" + exit 0 + fi + log_daemon_msg "Starting ${SERVICE_DESC} in cloud mode" || true + start_server + case "$?" in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + *) log_end_msg 1 ;; + esac + ;; stop) - stop - ;; - status) - checkstatus - ;; + check_status > /dev/null 2>&1 + status=$? + if [ $status != 0 ]; then + log_success_msg "${SERVICE_DESC} is not running" + exit 1 + fi + + log_daemon_msg "Stopping ${SERVICE_DESC}" || true + stop_server + case "$?" in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + *) log_end_msg 1 ;; + esac + ;; + restart) - restart - ;; - condrestart|try-restart) - condrestart - ;; + log_daemon_msg "Restarting ${SERVICE_DESC}" + check_status > /dev/null 2>&1 + status=$? + # stop running service + if [ $status = 0 ]; then + stop_server + if [ $? != 0 ]; then + log_end_msg 1 + exit 1 + fi + fi + # start service + start_server + case "$?" in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + *) log_end_msg 1 ;; + esac + ;; + + try-restart) + log_daemon_msg "Restarting ${SERVICE_DESC}" + check_status > /dev/null 2>&1 + status=$? + if [ $status != 0 ]; then + log_failure_msg "${SERVICE_DESC} is not running" + exit 1 + fi + stop_server + if [ $? != 0 ]; then + log_end_msg 1 + exit 1 + fi + # start service + start_server + case "$?" in + 0|1) log_end_msg 0 ;; + 2) log_end_msg 1 ;; + *) log_end_msg 1 ;; + esac + ;; + + status) + status_of_proc -p $SOLR_PID_FILE $SOLR_INSTALL_DIR/bin/solrd "solr-server" && exit 0 || exit $? + ;; + init) - init - ;; + check_status > /dev/null 2>&1 + status=$? + if [ $status = 0 ]; then + log_daemon_msg "${SERVICE_DESC} is running" + log_end_msg 1 + exit 1 + fi + rm -rf ${SOLR_HOME}/* + /usr/bin/solrctl init --force + ;; + *) - echo $"Usage: $0 {start|stop|status|restart|try-restart|condrestart|init}" + log_action_msg "Usage: /etc/init.d/solr-server {start|stop|restart|try-restart|status|init}" || true exit 1 + ;; esac -exit $RETVAL +exit 0 http://git-wip-us.apache.org/repos/asf/bigtop/blob/b7306931/bigtop-packages/src/common/solr/solr.default ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/solr/solr.default b/bigtop-packages/src/common/solr/solr.default index dbd3e72..8e73200 100644 --- a/bigtop-packages/src/common/solr/solr.default +++ b/bigtop-packages/src/common/solr/solr.default @@ -12,19 +12,130 @@ # 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. -SOLR_PORT=8983 -SOLR_ADMIN_PORT=8984 -SOLR_LOG=/var/log/solr -# SOLR_ZK_ENSEMBLE=localhost:2181/solr -# SOLR_HDFS_HOME=hdfs://localhost:8020/solr -# SOLR_HDFS_CONFIG=/etc/hadoop/conf -# SOLR_KERBEROS_ENABLED=true -# SOLR_KERBEROS_KEYTAB=/etc/solr/conf/solr.keytab -# SOLR_KERBEROS_PRINCIPAL=solr/localhost@LOCALHOST -SOLR_AUTHENTICATION_TYPE=simple -SOLR_AUTHENTICATION_SIMPLE_ALLOW_ANON=true -# SOLR_AUTHENTICATION_KERBEROS_KEYTAB=/etc/solr/conf/solr.keytab -# SOLR_AUTHENTICATION_KERBEROS_PRINCIPAL=HTTP/localhost@LOCALHOST -# SOLR_AUTHENTICATION_KERBEROS_NAME_RULES=DEFAULT -# SOLR_AUTHENTICATION_JAAS_CONF=/etc/solr/conf/jaas.conf -SOLRD_WATCHDOG_TIMEOUT=30 + +# Settings here will override settings in existing env vars or in bin/solr. The default shipped state +# of this file is completely commented. + +# 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="" + +# This controls the number of seconds that the solr script will wait for +# Solr to stop gracefully or Solr to start. If the graceful stop fails, +# the script will forcibly stop Solr. If the start fails, the script will +# give up waiting and display the last few lines of the logfile. +#SOLR_STOP_WAIT="180" + +# Increase Java Heap as needed to support your indexing / query needs +#SOLR_HEAP="512m" + +# Expert: If you want finer control over memory options, specify them directly +# Comment out SOLR_HEAP if you are using this though, that takes precedence +#SOLR_JAVA_MEM="-Xms512m -Xmx512m" + +# Enable verbose GC logging... +# * If this is unset, various default options will be selected depending on which JVM version is in use +# * For java8 or lower: if this is set, additional params will be added to specify the log file & rotation +# * For java9 or higher: each included opt param that starts with '-Xlog:gc', but does not include an output +# specifier, will have a 'file' output specifier (as well as formatting & rollover options) appended, +# using the effective value of the SOLR_LOGS_DIR. +# +#GC_LOG_OPTS='-Xlog:gc*' # (java9) +#GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \ +# -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime" + +# These GC settings have shown to work well for a number of common Solr workloads +#GC_TUNE="-XX:NewRatio=3 -XX:SurvivorRatio=4 etc. + +# 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="" + +# Set the ZooKeeper client timeout (for SolrCloud mode) +#ZK_CLIENT_TIMEOUT="15000" + +# 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="192.168.1.1" + +# 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="false" + +# The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here +# RMI_PORT=18983 + +# 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" + +# 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=/var/run/solr + +# Path to a directory for Solr to store cores and their data. By default, Solr will use server/solr +# If solr.xml is not stored in ZooKeeper, this directory needs to contain solr.xml +#SOLR_HOME=/var/lib/solr + +# 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=/var/lib/solr/log4j.properties + +# Changes the logging level. Valid values: ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Default is INFO +# This is an alternative to changing the rootLogger in log4j.properties +#SOLR_LOG_LEVEL=INFO + +# Location where Solr should write logs to. Absolute or relative to solr start dir +#SOLR_LOGS_DIR=/var/log/solr + +# Enables log rotation, cleanup, and archiving during start. Setting SOLR_LOG_PRESTART_ROTATION=false will skip start +# time rotation of logs, and the archiving of the last GC and console log files. It does not affect Log4j configuration. +# This pre-startup rotation may need to be disabled depending how much you customize the default logging setup. +#SOLR_LOG_PRESTART_ROTATION=true + +# Sets the port Solr binds to, default is 8983 +#SOLR_PORT=8983 + +# Uncomment to set SSL-related system properties +# Be sure to update the paths to the correct keystore for your environment +#SOLR_SSL_KEY_STORE=/home/shalin/work/oss/shalin-lusolr/solr/server/etc/solr-ssl.keystore.jks +#SOLR_SSL_KEY_STORE_PASSWORD=secret +#SOLR_SSL_KEY_STORE_TYPE=JKS +#SOLR_SSL_TRUST_STORE=/home/shalin/work/oss/shalin-lusolr/solr/server/etc/solr-ssl.keystore.jks +#SOLR_SSL_TRUST_STORE_PASSWORD=secret +#SOLR_SSL_TRUST_STORE_TYPE=JKS +#SOLR_SSL_NEED_CLIENT_AUTH=false +#SOLR_SSL_WANT_CLIENT_AUTH=false + +# Uncomment if you want to override previously defined SSL values for HTTP client +# otherwise keep them commented and the above values will automatically be set for HTTP clients +#SOLR_SSL_CLIENT_KEY_STORE= +#SOLR_SSL_CLIENT_KEY_STORE_PASSWORD= +#SOLR_SSL_CLIENT_KEY_STORE_TYPE= +#SOLR_SSL_CLIENT_TRUST_STORE= +#SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD= +#SOLR_SSL_CLIENT_TRUST_STORE_TYPE= + +# Settings for authentication +# Please configure only one of SOLR_AUTHENTICATION_CLIENT_CONFIGURER or SOLR_AUTH_TYPE parameters +#SOLR_AUTHENTICATION_CLIENT_CONFIGURER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthConfigurer" +#SOLR_AUTH_TYPE="basic" +#SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:SolrRocks" + +# Settings for ZK ACL +#SOLR_ZK_CREDS_AND_ACLS="-DzkACLProvider=org.apache.solr.common.cloud.VMParamsAllAndReadonlyDigestZkACLProvider \ +# -DzkCredentialsProvider=org.apache.solr.common.cloud.VMParamsSingleSetCredentialsDigestZkCredentialsProvider \ +# -DzkDigestUsername=admin-user -DzkDigestPassword=CHANGEME-ADMIN-PASSWORD \ +# -DzkDigestReadonlyUsername=readonly-user -DzkDigestReadonlyPassword=CHANGEME-READONLY-PASSWORD" +#SOLR_OPTS="$SOLR_OPTS $SOLR_ZK_CREDS_AND_ACLS" + http://git-wip-us.apache.org/repos/asf/bigtop/blob/b7306931/bigtop-packages/src/common/solr/solrctl.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/solr/solrctl.sh b/bigtop-packages/src/common/solr/solrctl.sh old mode 100644 new mode 100755 index e0d6cf4..18f055b --- a/bigtop-packages/src/common/solr/solrctl.sh +++ b/bigtop-packages/src/common/solr/solrctl.sh @@ -15,24 +15,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -SOLR_XML='<solr> - - <solrcloud> - <str name="host">${host:}</str> - <int name="hostPort">${solr.port:8983}</int> - <str name="hostContext">${hostContext:solr}</str> - <int name="zkClientTimeout">${zkClientTimeout:15000}</int> - <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool> - </solrcloud> - - <shardHandlerFactory name="shardHandlerFactory" - class="HttpShardHandlerFactory"> - <int name="socketTimeout">${socketTimeout:0}</int> - <int name="connTimeout">${connTimeout:0}</int> - </shardHandlerFactory> - -</solr>' - usage() { [ $# -eq 0 ] || echo "$@" echo " @@ -106,7 +88,7 @@ local_coreconfig() { mkdir -p $4 cp -r /var/lib/solr/$6/conf/* $4 ;; - esac + esac } solr_webapi() { @@ -118,13 +100,11 @@ solr_webapi() { break fi done - [ -n "$SOLR_ADMIN_URI" ] || die "Error: can't discover Solr URI. Please specify it explicitly via --solr." + [ -n "$SOLR_ADMIN_URI" ] || die "Error: can't discover Solr URI. Please specify it explicitly via --solr." fi - - URI="$SOLR_ADMIN_URI/$1" + URI="$SOLR_ADMIN_URI$1" shift - local WEB_OUT=`$SOLR_ADMIN_CURL $URI "$@" | sed -e 's#>#>\n#g'` - + local WEB_OUT=$($SOLR_ADMIN_CURL $URI "$@" | sed -e 's#>#>\n#g') if [ $? -eq 0 ] && (echo "$WEB_OUT" | grep -q 'HTTP/.*200.*OK') ; then echo "$WEB_OUT" | egrep -q '<lst name="(failure|exception|error)">' || return 0 fi @@ -146,15 +126,14 @@ if [ -e "$SOLR_CONF_DIR/solr-env.sh" ] ; then . "$SOLR_CONF_DIR/solr-env.sh" elif [ -e /etc/default/solr ] ; then . /etc/default/solr -else - SOLR_PORT=8983 fi +SOLR_PORT=${SOLR_PORT:-8983} SOLR_ADMIN_CURL='curl -i --retry 5 -s -L -k --negotiate -u :' SOLR_ADMIN_CHAT=echo SOLR_ADMIN_API_CMD='solr_webapi' -SOLR_HOME=${SOLR_HOME:-/usr/lib/solr/} +SOLR_INSTALL_DIR=/usr/lib/solr # Autodetect JAVA_HOME if not defined . /usr/lib/bigtop-utils/bigtop-detect-javahome @@ -162,7 +141,7 @@ SOLR_HOME=${SOLR_HOME:-/usr/lib/solr/} # First eat up all the global options while test $# != 0 ; do - case "$1" in + case "$1" in --help) usage ;; @@ -190,19 +169,19 @@ if [ -z "$SOLR_ZK_ENSEMBLE" ] ; then SOLR_ADMIN_ZK_CMD="local_coreconfig" cat >&2 <<-__EOT__ Warning: Non-SolrCloud mode has been completely deprecated - Please configure SolrCloud via SOLR_ZK_ENSEMBLE setting in + Please configure SolrCloud via SOLR_ZK_ENSEMBLE setting in /etc/default/solr If you running remotely, please use --zk zk_ensemble. __EOT__ else - SOLR_ADMIN_ZK_CMD='${JAVA_HOME}/bin/java -classpath "${SOLR_HOME}/server/webapps/solr/WEB-INF/lib/*" org.apache.solr.cloud.ZkCLI -zkhost $SOLR_ZK_ENSEMBLE 2>/dev/null' + SOLR_ADMIN_ZK_CMD='${JAVA_HOME}/bin/java -classpath "${SOLR_INSTALL_DIR}/server/solr-webapp/webapp/WEB-INF/lib/*:${SOLR_INSTALL_DIR}/server/lib/ext/*:${SOLR_INSTALL_DIR}/server/lib/*" org.apache.solr.cloud.ZkCLI -zkhost $SOLR_ZK_ENSEMBLE 2>/dev/null' fi # Now start parsing commands -- there has to be at least one! -[ $# -gt 0 ] || usage +[ $# -gt 0 ] || usage while test $# != 0 ; do - case "$1" in + case "$1" in debug-dump) get_solr_state @@ -222,10 +201,10 @@ while test $# != 0 ; do fi fi - eval $SOLR_ADMIN_ZK_CMD -cmd makepath / > /dev/null 2>&1 || : + eval $SOLR_ADMIN_ZK_CMD -cmd makepath / > /dev/null 2>&1 || : eval $SOLR_ADMIN_ZK_CMD -cmd clear / || die "Error: failed to initialize Solr" - eval $SOLR_ADMIN_ZK_CMD -cmd put /solr.xml "'$SOLR_XML'" + eval $SOLR_ADMIN_ZK_CMD -cmd put /solr.xml "'$(cat $SOLR_INSTALL_DIR/server/solr/solr.xml)'" shift 1 ;; @@ -238,8 +217,8 @@ while test $# != 0 ; do instancedir) [ $# -gt 1 ] || usage "Error: incorrect specification of arguments for $1" case "$2" in - --create) - [ $# -gt 3 ] || usage "Error: incorrect specification of arguments for $1 $2" + --create) + [ $# -gt 3 ] || usage "Error: incorrect specification of arguments for $1 $2" if [ -d $4/conf ] ; then INSTANCE_DIR="$4/conf" @@ -247,7 +226,7 @@ while test $# != 0 ; do INSTANCE_DIR="$4" fi - [ -e ${INSTANCE_DIR}/solrconfig.xml -a -e ${INSTANCE_DIR}/schema.xml ] || die "Error: ${INSTANCE_DIR} must be a directory with at least solrconfig.xml and schema.xml" + [ -e ${INSTANCE_DIR}/solrconfig.xml -a -e ${INSTANCE_DIR}/managed-schema ] || die "Error: ${INSTANCE_DIR} must be a directory with at least solrconfig.xml and managed-schema" get_solr_state | grep -q '^ */configs/'"$3/" && die "Error: \"$3\" configuration already exists. Aborting. Try --update if you want to override" @@ -264,7 +243,7 @@ while test $# != 0 ; do INSTANCE_DIR="$4" fi - [ -e ${INSTANCE_DIR}/solrconfig.xml -a -e ${INSTANCE_DIR}/schema.xml ] || die "Error: ${INSTANCE_DIR} must be a directory with at least solrconfig.xml and schema.xml" + [ -e ${INSTANCE_DIR}/solrconfig.xml -a -e ${INSTANCE_DIR}/managed-schema ] || die "Error: ${INSTANCE_DIR} must be a directory with at least solrconfig.xml and managed-schema" eval $SOLR_ADMIN_ZK_CMD -cmd clear /configs/$3 2>/dev/null || die "Error: can't delete configuration" @@ -283,7 +262,7 @@ while test $# != 0 ; do ;; --delete) [ $# -gt 2 ] || usage "Error: incorrect specification of arguments for $1" - + eval $SOLR_ADMIN_ZK_CMD -cmd clear /configs/$3 2>/dev/null || die "Error: can't delete configuration" shift 3 ;; @@ -294,14 +273,15 @@ while test $# != 0 ; do mkdir -p "$3" > /dev/null 2>&1 [ -d "$3" ] || usage "Error: $3 has to be a directory" - cp -r ${SOLR_HOME}/coreconfig-template "$3/conf" + # data_driven_schema_configs is used as default + cp -r ${SOLR_INSTALL_DIR}/server/solr/configsets/data_driven_schema_configs/conf "$3/conf" shift 3 ;; --list) get_solr_state | sed -n -e '/\/configs\//s#^.*/configs/\([^/]*\)/.*$#\1#p' | sort -u shift 2 ;; - *) + *) shift 1 ;; esac @@ -310,7 +290,7 @@ while test $# != 0 ; do collection) [ "$2" = "--list" ] || [ $# -gt 2 ] || usage "Error: incorrect specification of arguments for $1" case "$2" in - --create) + --create) COL_CREATE_NAME=$3 COL_CREATE_NUMSHARDS=1 shift 3 @@ -357,7 +337,7 @@ while test $# != 0 ; do [ -n "$COL_CREATE_REPL" ] && COL_CREATE_CALL="${COL_CREATE_CALL}&replicationFactor=${COL_CREATE_REPL}" [ -n "$COL_CREATE_MAXSHARDS" ] && COL_CREATE_CALL="${COL_CREATE_CALL}&maxShardsPerNode=${COL_CREATE_MAXSHARDS}" [ -n "$COL_CREATE_NODESET" ] && COL_CREATE_CALL="${COL_CREATE_CALL}&createNodeSet=${COL_CREATE_NODESET}" - + eval $SOLR_ADMIN_API_CMD "'/admin/collections?action=CREATE${COL_CREATE_CALL}'" shift 4 @@ -379,7 +359,7 @@ while test $# != 0 ; do get_solr_state | sed -ne '/\/collections\/[^\/]*$/s#^.*/collections/##p' shift 2 ;; - *) + *) shift 1 ;; esac @@ -404,7 +384,7 @@ while test $# != 0 ; do esac done [ -n "$CORE_KV_PAIRS" ] || CORE_KV_PAIRS="&instanceDir=${CORE_CREATE_NAME}" - + eval $SOLR_ADMIN_API_CMD "'/admin/cores?action=CREATE&name=${CORE_CREATE_NAME}${CORE_KV_PAIRS}'" ;; --reload|--unload|--status) @@ -412,7 +392,7 @@ while test $# != 0 ; do eval $SOLR_ADMIN_API_CMD "'/admin/cores?action=`echo $CORE_ACTION`&core=$3'" shift 3 ;; - *) + *) shift 1 ;; esac http://git-wip-us.apache.org/repos/asf/bigtop/blob/b7306931/bigtop-packages/src/common/solr/solrd ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/solr/solrd b/bigtop-packages/src/common/solr/solrd new file mode 100755 index 0000000..5d1bcce --- /dev/null +++ b/bigtop-packages/src/common/solr/solrd @@ -0,0 +1,126 @@ +#! /bin/bash + +CMD=$1 +shift 1 +# parse options +if [ $# -gt 1 ]; then + while true; do + case "$1" in + -c|--config) + CFG_FILE="$2" + shift 2 + ;; +-m|--mode) + RUN_MODE="$2" +shift 2 + ;; + *) + break # out-of-args, stop looping + ;; +esac +done +fi + +# load configurations +BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR:-/etc/default} +SOLR_CONFIG=${CFG_FILE:-${BIGTOP_DEFAULTS_DIR}/solr} +[ -f $SOLR_CONFIG ] && . $SOLR_CONFIG + + +# Autodetect JAVA_HOME if not defined +. /usr/lib/bigtop-utils/bigtop-detect-javahome + +# resolve links - $0 may be a softlink +PRG="${BASH_SOURCE[0]}" + +while [ -h "${PRG}" ]; do + ls=`ls -ld "${PRG}"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "${PRG}"`/"$link" + fi +done + +BASEDIR=`dirname ${PRG}` +BASEDIR=`cd ${BASEDIR}/..;pwd` + +SOLR_MODE=${RUN_MODE:-cloud} +SOLR_PORT=${SOLR_PORT:-8983} +SOLR_ADMIN_PORT=${SOLR_ADMIN_PORT:-8984} +SOLR_LOG4J_CONFIG=${LOG4J_PROPS:-/etc/solr/conf/log4j.properties} + +SOLR_HOME=${SOLR_HOME:-/var/lib/solr} +export SOLR_LOGS_DIR=${SOLR_LOGS_DIR:-/var/log/solr} +export SOLR_PID_DIR=${SOLR_PID_DIR:-/var/run/solr} + +die() { + echo "$@" >&2 + exit 1 +} + +# Preflight checks: +# SolrCloud mode check +if [ "$SOLR_MODE" = "cloud" ]; then + if [ -z "$SOLR_ZK_ENSEMBLE" ] ; then + die "Error: Cloud mode is set but ZK_HOST is not set in /etc/default/solr" + fi + SOLR_OPTS="${SOLR_OPTS} -DzkHost=${SOLR_ZK_ENSEMBLE} -Dsolr.solrxml.location=zookeeper" +fi + +if [ -n "$SOLR_HDFS_HOME" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.hdfs.home=${SOLR_HDFS_HOME}" +fi + +if [ -n "$SOLR_HDFS_CONFIG" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.hdfs.confdir=${SOLR_HDFS_CONFIG}" +fi + +if [ "$SOLR_KERBEROS_ENABLED" == "true" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.hdfs.security.kerberos.enabled=${SOLR_KERBEROS_ENABLED}" +fi + +if [ -n "$SOLR_KERBEROS_KEYTAB" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.hdfs.security.kerberos.keytabfile=${SOLR_KERBEROS_KEYTAB}" +fi + +if [ -n "$SOLR_KERBEROS_PRINCIPAL" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.hdfs.security.kerberos.principal=${SOLR_KERBEROS_PRINCIPAL}" +fi + +if [ -n "$SOLR_AUTHENTICATION_TYPE" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.authentication.type=${SOLR_AUTHENTICATION_TYPE}" +fi + +if [ -n "$SOLR_AUTHENTICATION_KERBEROS_KEYTAB" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.authentication.kerberos.keytab=${SOLR_AUTHENTICATION_KERBEROS_KEYTAB}" +fi + +if [ -n "$SOLR_AUTHENTICATION_KERBEROS_PRINCIPAL" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.authentication.kerberos.principal=${SOLR_AUTHENTICATION_KERBEROS_PRINCIPAL}" +fi + +if [ -n "$SOLR_AUTHENTICATION_KERBEROS_NAME_RULES" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.authentication.kerberos.name.rules=${SOLR_AUTHENTICATION_KERBEROS_NAME_RULES}" +fi + +if [ -n "$SOLR_AUTHENTICATION_SIMPLE_ALLOW_ANON" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Dsolr.authentication.simple.anonymous.allowed=${SOLR_AUTHENTICATION_SIMPLE_ALLOW_ANON}" +fi + +if [ -n "$SOLR_AUTHENTICATION_JAAS_CONF" ] ; then + SOLR_OPTS="${SOLR_OPTS} -Djava.security.auth.login.config=${SOLR_AUTHENTICATION_JAAS_CONF}" +fi + +# FIXME: we need to set this because of the jetty-centric default solr.xml +SOLR_OPTS="${SOLR_OPTS} -Dhost=$HOSTNAME -Djetty.port=$SOLR_PORT" + +export SOLR_OPTS="${SOLR_OPTS} -Dsolr.host=$HOSTNAME + -Dsolr.port=$SOLR_PORT + -Dsolr.admin.port=$SOLR_ADMIN_PORT + -Dlog4j.configuration=file://$SOLR_LOG4J_CONFIG + -Dsolr.log.dir=$SOLR_LOGS_DIR + -Dsolr.solr.home=$SOLR_HOME" + +exec /usr/lib/solr/bin/solr $CMD "$@" http://git-wip-us.apache.org/repos/asf/bigtop/blob/b7306931/bigtop-packages/src/common/solr/tomcat-deployment.sh ---------------------------------------------------------------------- diff --git a/bigtop-packages/src/common/solr/tomcat-deployment.sh b/bigtop-packages/src/common/solr/tomcat-deployment.sh deleted file mode 100644 index 1da3428..0000000 --- a/bigtop-packages/src/common/solr/tomcat-deployment.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# 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 script must be sourced so that it can set CATALINA_BASE for the parent process - -TOMCAT_CONF=${TOMCAT_CONF:-`readlink -e /etc/solr/tomcat-conf`} -TOMCAT_DEPLOYMENT=${TOMCAT_DEPLOYMENT:-/var/lib/solr/tomcat-deployment} -SOLR_HOME=${SOLR_HOME:-/usr/lib/solr} - -rm -rf ${TOMCAT_DEPLOYMENT} -mkdir ${TOMCAT_DEPLOYMENT} -cp -r ${TOMCAT_CONF}/conf ${TOMCAT_DEPLOYMENT} -cp -r ${SOLR_HOME}/server/webapps ${TOMCAT_DEPLOYMENT}/webapps -cp -r ${TOMCAT_CONF}/WEB-INF/* ${TOMCAT_DEPLOYMENT}/webapps/solr/WEB-INF/ - -if [ -n "${BIGTOP_CLASSPATH}" ] ; then - sed -i -e "s#^\(common.loader=.*\)\$#\1,${BIGTOP_CLASSPATH/:/,}#" ${TOMCAT_DEPLOYMENT}/conf/catalina.properties -fi - -chown -R solr:solr ${TOMCAT_DEPLOYMENT} - -export CATALINA_BASE=${TOMCAT_DEPLOYMENT} -
