:Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/lui-solr
authorDennis Schafroth <dennis@indexdata.com>
Fri, 29 Nov 2013 15:12:08 +0000 (16:12 +0100)
committerDennis Schafroth <dennis@indexdata.com>
Fri, 29 Nov 2013 15:12:08 +0000 (16:12 +0100)
15 files changed:
debian/control
debian/masterkey-lui-solr-zookeeper.postinst [new file with mode: 0644]
debian/masterkey-lui-solr-zookeeper.postrm [new file with mode: 0644]
debian/rules
scripts/make_new_config.sh [new file with mode: 0755]
scripts/zookeeper.sh
zookeeper/.gitignore [new file with mode: 0644]
zookeeper/options
zookeeper/options_localhost [new file with mode: 0644]
zookeeper/options_localhost_second [new file with mode: 0644]
zookeeper/solr/collection1/conf/schema.xml
zookeeper/solr/collection1/conf/solrconfig.xml
zookeeper/webapps/solr-4.4.0.war [deleted symlink]
zookeeper/webapps/solr.war [new symlink]
zookeeper/zookeeper.sh.pid [deleted file]

index a2ea578..7999a8d 100644 (file)
@@ -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 (file)
index 0000000..9b4ba0a
--- /dev/null
@@ -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 (file)
index 0000000..04cefb7
--- /dev/null
@@ -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
index 192226b..ec07092 100755 (executable)
@@ -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 (executable)
index 0000000..034e15c
--- /dev/null
@@ -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
index 8e48202..329f175 100755 (executable)
@@ -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 (file)
index 0000000..bdda313
--- /dev/null
@@ -0,0 +1,5 @@
+*.log
+*.pid
+logs/
+solr/zoo_data
+solr-webapp/
\ No newline at end of file
index f31b9ec..0b7b07f 100644 (file)
@@ -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 (file)
index 0000000..25894d2
--- /dev/null
@@ -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 (file)
index 0000000..a62a84e
--- /dev/null
@@ -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
index 27b6dff..df61c5e 100644 (file)
 
    <field name="transactionId" type="long" indexed="true" stored="false"/>
 
-   <field name="author"       type="text"   indexed="true" stored="true"  multiValued="true"  omitNorms="true"/>
-   <field name="author_exact" type="string"  indexed="true" stored="false" multiValued="true"  omitNorms="true" docValues="true" />
+   <field name="author"       type="text"   indexed="true" stored="true"  multiValued="true" omitNorms="true"/>
+   <field name="author_exact" type="string" indexed="true" stored="false" multiValued="true" omitNorms="true" docValues="true" />
    <field name="author-date"  type="text"   indexed="true" stored="true"  multiValued="true" omitNorms="true"/>
    <field name="author-title" type="text"   indexed="true" stored="true"  multiValued="true" omitNorms="true"/>
 
    <field name="lccn" type="text" indexed="true" stored="true" multiValued="true" omitNorms="true"/>
 
    <field name="medium"       type="text"  indexed="true" stored="true"  multiValued="true" omitNorms="true"/>
-   <field name="medium_exact" type="facet" indexed="true" stored="false" multiValued="true" omitNorms="true"/>
+   <field name="medium_exact" type="facet" indexed="true" stored="false" multiValued="true" omitNorms="true" />
 
    <field name="meeting-date"     type="text" indexed="true" stored="true" omitNorms="true"/>
    <field name="meeting-location" type="text" indexed="true" stored="true" omitNorms="true"/>
    <field name="series-title" type="text" indexed="true" stored="true" multiValued="true" omitNorms="true"/>
 
    <field name="subject"       type="text_ws" indexed="true" stored="true"  multiValued="true" omitNorms="true" />
-   <field name="subject_exact" type="facet"   indexed="true" stored="false" multiValued="true" omitNorms="true" />
+   <field name="subject_exact" type="string"  indexed="true" stored="false" multiValued="true" omitNorms="true" docValues="true" />
    <field name="subject-long"  type="text_ws" indexed="true" stored="true"  multiValued="true" omitNorms="true" />
 
    <field name="system-control-nr" type="text" indexed="true" stored="true" multiValued="true" omitNorms="true"/>
          destination field is to use the dynamic field syntax. 
          copyField also supports a maxChars to copy setting.  -->
           
-   <copyField source="*" dest="text" maxChars="10000"/> 
+   <copyField source="*" dest="text"/> 
 
    <!-- copy name to alphaNameSort, a field designed for sorting by name -->
    <!-- <copyField source="name" dest="alphaNameSort"/> -->
index 156314d..3dfc0c3 100644 (file)
@@ -72,6 +72,7 @@
        The examples below can be used to load some solr-contribs along 
        with their external dependencies.
     -->
+<!--
   <lib dir="../../../contrib/extraction/lib" regex=".*\.jar" />
   <lib dir="../../../dist/" regex="solr-cell-\d.*\.jar" />
 
@@ -83,7 +84,7 @@
 
   <lib dir="../../../contrib/velocity/lib" regex=".*\.jar" />
   <lib dir="../../../dist/" regex="solr-velocity-\d.*\.jar" />
-
+-->
   <!-- an exact 'path' can be used instead of a 'dir' to specify a 
        specific jar file.  This will cause a serious error to be logged 
        if it can't be loaded.
       -->
     <listener event="newSearcher" class="solr.QuerySenderListener">
       <arr name="queries">
-        <!--
-           <lst><str name="q">solr</str><str name="sort">price asc</str></lst>
-           <lst><str name="q">rocks</str><str name="sort">weight asc</str></lst>
-          -->
+        <lst>
+         <str name="q">database:*</str>
+         <str name="facet">true</str>
+         <str name="facet.mincount">1</str>
+         <str name="facet.field">author_exact</str>
+         <str name="facet.field">subject_exact</str>
+         <str name="facet.field">medium_exact</str>
+         <str name="facet.field">date</str>
+         <str name="facet.field">database</str>
+        </lst>
       </arr>
     </listener>
     <listener event="firstSearcher" class="solr.QuerySenderListener">
       <arr name="queries">
         <lst>
-          <str name="q">static firstSearcher warming in solrconfig.xml</str>
+         <str name="q">database:*</str>
+         <str name="facet">true</str>
+         <str name="facet.mincount">1</str>
+         <str name="facet.field">author_exact</str>
+         <str name="facet.field">subject_exact</str>
+         <str name="facet.field">medium_exact</str>
+         <str name="facet.field">date</str>
+         <str name="facet.field">database</str>
         </lst>
       </arr>
     </listener>
        <str name="echoParams">explicit</str>
        <int name="rows">10</int>
        <str name="df">text</str>
+       <str name="fl">*,score</str>
      </lst>
     <!-- In addition to defaults, "appends" params can be specified
          to identify values which should be appended to the list of
diff --git a/zookeeper/webapps/solr-4.4.0.war b/zookeeper/webapps/solr-4.4.0.war
deleted file mode 120000 (symlink)
index e25a915..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../dist/solr-4.4.0.war
\ No newline at end of file
diff --git a/zookeeper/webapps/solr.war b/zookeeper/webapps/solr.war
new file mode 120000 (symlink)
index 0000000..6d98814
--- /dev/null
@@ -0,0 +1 @@
+../../dist/solr-4.4.0.war
\ No newline at end of file
diff --git a/zookeeper/zookeeper.sh.pid b/zookeeper/zookeeper.sh.pid
deleted file mode 100644 (file)
index 3ebb04f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-18024