From: Dennis Schafroth Date: Fri, 29 Nov 2013 15:12:08 +0000 (+0100) Subject: :Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/lui-solr X-Git-Tag: v0.6.0~6 X-Git-Url: http://git.indexdata.com/?p=lui-solr.git;a=commitdiff_plain;h=8ccbd8c80f78ce6c7015ade8fbbc889b462f6a80;hp=a93d187fb201ef162e791349c0dd0c62f6df834d :Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/lui-solr --- diff --git a/debian/control b/debian/control index a2ea578..7999a8d 100644 --- a/debian/control +++ b/debian/control @@ -42,4 +42,10 @@ Depends: tomcat6,masterkey-lui-solr4-slave,masterkey-lui-solr4-common-tomcat6 Description: Local Unified Index Solr Tomcat 6 integration for a LUI master The LUI is part of the MasterKey suite. This package provides Tomcat 6 integration. +Package: masterkey-lui-solr4-zookeeper +Architecture: all +Depends: masterkey-lui-solr4-common +Description: Local Unified Index (Solr) + A stand-alone (jetty) ZooKeeper enabled Solr 4. Require 2 or more configurations running on multiple machines + diff --git a/debian/masterkey-lui-solr-zookeeper.postinst b/debian/masterkey-lui-solr-zookeeper.postinst new file mode 100644 index 0000000..9b4ba0a --- /dev/null +++ b/debian/masterkey-lui-solr-zookeeper.postinst @@ -0,0 +1,3 @@ +#!/bin/sh +ln -sf /etc/masterkey/lui/lui-solr-master.xml /etc/tomcat6/Catalina/localhost/solr.xml +chown -R tomcat6:tomcat6 /var/lib/masterkey/lui/solr/master diff --git a/debian/masterkey-lui-solr-zookeeper.postrm b/debian/masterkey-lui-solr-zookeeper.postrm new file mode 100644 index 0000000..04cefb7 --- /dev/null +++ b/debian/masterkey-lui-solr-zookeeper.postrm @@ -0,0 +1,19 @@ +#!/bin/sh -e + +case "$1" in + remove) + ;; + purge) + rm -rf /var/lib/masterkey/masterkey-lui-solr4/zookeeper + ;; + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules index 192226b..ec07092 100755 --- a/debian/rules +++ b/debian/rules @@ -14,10 +14,12 @@ SHARE = /usr/share/masterkey/lui/solr4 CONF_MASTER = $(SHARE)/master/collection1/ CONF_SLAVE = $(SHARE)/slave/collection1/ +CONF_ZK = $(SHARE)/zookeeper/ DATA = /var/lib/masterkey/lui/solr4 DATA_MASTER = $(DATA)/master DATA_SLAVE = $(DATA)/slave +DATA_ZK = $(DATA)/zk-first LUI_SOLR_COMMON = $(BASE)-common LUI_SOLR_COMMON_ROOT = $(CURDIR)/debian/$(LUI_SOLR_COMMON) @@ -44,6 +46,12 @@ LUI_SOLR_SLAVE_TOMCAT_ROOT = $(CURDIR)/debian/$(LUI_SLAVE_TOMCAT) CATALINA_HOME=/usr/share/tomcat6 SOLR_VERSION=4.4.0 +LUI_SOLR_ZK = $(BASE)-zookeeper +LUI_SOLR_ZK_ROOT = $(CURDIR)/debian/$(LUI_SOLR_ZK) +LUI_SOLR_ZK_SHARE_DIR = $(LUI_SOLR_ZK_ROOT)$(CONF_ZK) +LUI_SOLR_ZK_LIB_DIR = $(LUI_SOLR_ZK_ROOT)$(DATA_ZK) + + PACKAGE=$(shell dh_listpackages) build: @@ -93,6 +101,12 @@ install-stamp: build mkdir -p $(LUI_SOLR_SLAVE_ROOT)/etc/masterkey/lui cp etc/solr4-tomcat-context-slave.xml $(LUI_SOLR_SLAVE_ROOT)/etc/masterkey/lui/lui-solr4-slave.xml + # lui-solr-zookeeper + mkdir -p $(LUI_SOLR_ZK_SHARE_DIR) + cp -rp zookeeper $(LUI_SOLR_ZK_SHARE_DIR) + mkdir -p $(LUI_SOLR_ZK_LIB_DIR) + + touch $@ binary: build install diff --git a/scripts/make_new_config.sh b/scripts/make_new_config.sh new file mode 100755 index 0000000..034e15c --- /dev/null +++ b/scripts/make_new_config.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +INSTALL_PATH=`pwd` +CONFIG=$1 +mkdir -p ${CONFIG} +ln -s ${INSTALL_PATH}/etc ${CONFIG}/ +ln -s ${INSTALL_PATH}/contexts ${CONFIG}/ +ln -s ${INSTALL_PATH}/lib ${CONFIG}/ +ln -s ${INSTALL_PATH}/webapps ${CONFIG}/ +ln -s ${INSTALL_PATH}/resources ${CONFIG}/ +ln -s ${INSTALL_PATH}/start.jar ${CONFIG}/ +ln -s ${INSTALL_PATH}/zookeeper.sh ${CONFIG}/ +cp -rp ${INSTALL_PATH}/solr ${CONFIG}/ +mkdir -p ${CONFIG}/logs \ No newline at end of file diff --git a/scripts/zookeeper.sh b/scripts/zookeeper.sh index 8e48202..329f175 100755 --- a/scripts/zookeeper.sh +++ b/scripts/zookeeper.sh @@ -1,15 +1,45 @@ #/bin/bash -OPTIONS="-Djetty.port=8983 -DzkHost=opencontent-solr.index:9983" -NAME="indexdata-solr-zookeeper" +NAME="indexdata-lui-solr-zookeeper" +HOST=localhost +PORT=8983 +SHARDS=2 PID_FILE=/var/run/${NAME}.pid LOG_FILE=/var/log/${NAME}.log -if [ -f "options" ]; then - source options +ZOOKEEPER=yes +OPTIONS=${OPTIONS:-options} + +if [ -f "$OPTIONS" ]; then + source $OPTIONS else - echo "No options file. Using defaults: $OPTIONS" + echo "No options file ($OPTIONS). Using defaults." +fi +let ZKPORT=$PORT+1000 +if [ "$ZKHOSTS" == "" ] ; then + ZKHOSTS=${HOST}:${ZKPORT} +fi + +if [ "$BOOTSTRAP_CONF" != "" ] ; then + BOOTSTRAP_OPT="-Dbootstrap_confdir=$BOOTSTRAP_CONF" +fi +if [ "$PORT" == "" ] ; then + echo Port missing + +fi +if [ "$ZKHOSTS" == "" ] ; then + echo ZKHOSTS missing +fi +if [ "$SHARDS" == "" ] ; then + echo SHARDS missing +fi +if [ "$ZOOKEEPER" == "yes" ] ; then + ZKRUN="-DzkRun -DnumShards=${SHARDS}" +fi +if [ "${SOLR_HOME}" != "" ] ; then + SOLR_HOME_OPT="-Dsolr.solr.home=${SOLR_HOME}" fi +OPTIONS=" $SOLR_HOME_OPT -Djetty.port=$PORT ${BOOTSTRAP_OPT} -Dcollection.configName=$NAME ${ZKRUN} -DzkHost=${ZKHOSTS} " if [ "$1" == "start" ]; then if [ -f "${PID_FILE}" ] ; then echo "pid file ${PID_FILE} exists. Already running?" @@ -18,9 +48,11 @@ if [ "$1" == "start" ]; then java $OPTIONS -jar start.jar > $LOG_FILE & echo $! > ${PID_FILE} elif [ "$1" == "stop" ]; then - if [ -x "${PID_FILE}" ] ; then - kill `echo ${PID_FILE}` + if [ -f "${PID_FILE}" ] ; then + kill `cat ${PID_FILE}` rm ${PID_FILE} + else + echo "No pid file ($PID_FILE) found" fi else echo "$0 [start|stop|status]" diff --git a/zookeeper/.gitignore b/zookeeper/.gitignore new file mode 100644 index 0000000..bdda313 --- /dev/null +++ b/zookeeper/.gitignore @@ -0,0 +1,5 @@ +*.log +*.pid +logs/ +solr/zoo_data +solr-webapp/ \ No newline at end of file diff --git a/zookeeper/options b/zookeeper/options index f31b9ec..0b7b07f 100644 --- a/zookeeper/options +++ b/zookeeper/options @@ -1 +1,8 @@ -OPTIONS=" -Dbootstrap_confdir=./solr/collection1/conf -Dcollection.configName=myconf -DzkRun -DzkHost=opencontent-solr.index:9983 -DnumShards=2 " \ No newline at end of file +NAME="zk-lui-solr" +HOST=localhost +PID_FILE="./${NAME}.pid" +LOG_FILE="./${NAME}.log" +PORT=8983 +#ZKHOSTS=opencontent-solr.index:9983 +ZKRUN=yes +BOOTSTRAP_CONF=./solr/collection1/conf diff --git a/zookeeper/options_localhost b/zookeeper/options_localhost new file mode 100644 index 0000000..25894d2 --- /dev/null +++ b/zookeeper/options_localhost @@ -0,0 +1,7 @@ +NAME="zk-lui-solr" +HOST=localhost +PID_FILE="./${NAME}.pid" +LOG_FILE="./${NAME}.log" +PORT=8983 +ZKRUN=yes +BOOTSTRAP_CONF=./solr/collection1/conf diff --git a/zookeeper/options_localhost_second b/zookeeper/options_localhost_second new file mode 100644 index 0000000..a62a84e --- /dev/null +++ b/zookeeper/options_localhost_second @@ -0,0 +1,8 @@ +NAME="zk-lui-solr-second" +HOST=localhost +PID_FILE="./${NAME}.pid" +LOG_FILE="./${NAME}.log" +PORT=8984 +ZKHOSTS=localhost:9983 +#BOOTSTRAP_CONF=./solr/collection1/conf +ZOOKEEPER=no diff --git a/zookeeper/solr/collection1/conf/schema.xml b/zookeeper/solr/collection1/conf/schema.xml index 27b6dff..df61c5e 100644 --- a/zookeeper/solr/collection1/conf/schema.xml +++ b/zookeeper/solr/collection1/conf/schema.xml @@ -471,8 +471,8 @@ - - + + @@ -499,7 +499,7 @@ - + @@ -508,7 +508,7 @@ - + @@ -644,7 +644,7 @@ destination field is to use the dynamic field syntax. copyField also supports a maxChars to copy setting. --> - + diff --git a/zookeeper/solr/collection1/conf/solrconfig.xml b/zookeeper/solr/collection1/conf/solrconfig.xml index 156314d..3dfc0c3 100644 --- a/zookeeper/solr/collection1/conf/solrconfig.xml +++ b/zookeeper/solr/collection1/conf/solrconfig.xml @@ -72,6 +72,7 @@ The examples below can be used to load some solr-contribs along with their external dependencies. --> + - + + database:* + true + 1 + author_exact + subject_exact + medium_exact + date + database + - static firstSearcher warming in solrconfig.xml + database:* + true + 1 + author_exact + subject_exact + medium_exact + date + database @@ -808,6 +822,7 @@ explicit 10 text + *,score