You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2012/02/28 08:05:37 UTC
svn commit: r1294489 - in /lucene/dev/trunk/solr/cloud-dev: control.sh
functions.sh
Author: siren
Date: Tue Feb 28 07:05:37 2012
New Revision: 1294489
URL: http://svn.apache.org/viewvc?rev=1294489&view=rev
Log:
add more scripting to help testing different scenarios
Added:
lucene/dev/trunk/solr/cloud-dev/control.sh (with props)
lucene/dev/trunk/solr/cloud-dev/functions.sh (with props)
Added: lucene/dev/trunk/solr/cloud-dev/control.sh
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/cloud-dev/control.sh?rev=1294489&view=auto
==============================================================================
--- lucene/dev/trunk/solr/cloud-dev/control.sh (added)
+++ lucene/dev/trunk/solr/cloud-dev/control.sh Tue Feb 28 07:05:37 2012
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+source ./functions.sh
+
+case "$1" in
+ start)
+ start $2 $3
+ ;;
+ stop)
+ stop $2
+ ;;
+ kill)
+ do_kill $2
+ ;;
+ reinstall)
+ reinstall $2
+ ;;
+ rebuild)
+ rebuild $2
+ ;;
+ status)
+ status $2
+ ;;
+ cleanlogs)
+ cleanlogs $2
+ ;;
+ taillogs)
+ taillogs $2
+ ;;
+ createshard)
+ createshard $2 $3 $4 $5
+ ;;
+ *)
+ echo $"Usage: $0 { rebuild| reinstall <instanceid>| start <instanceid> [numshards]| stop <instanceid>|kill <instanceid>| status<instanceid>| cleanlogs<instanceid>| createshard <instance> <collection> <coreName> [shardId]}"
+ exit 1
+esac
+exit 0
\ No newline at end of file
Added: lucene/dev/trunk/solr/cloud-dev/functions.sh
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/cloud-dev/functions.sh?rev=1294489&view=auto
==============================================================================
--- lucene/dev/trunk/solr/cloud-dev/functions.sh (added)
+++ lucene/dev/trunk/solr/cloud-dev/functions.sh Tue Feb 28 07:05:37 2012
@@ -0,0 +1,87 @@
+JAVA_OPTS="-server -Xms256M -Xmx256M"
+BASE_PORT=7570
+BASE_STOP_PORT=6570
+ZK_PORT="9983"
+
+rebuild() {
+ echo "Rebuilding"
+ cd ..
+ rm -r -f dist
+ rm -r -f build
+ rm -r -f example/solr/zoo_data
+ rm -f example/example.log
+ ant example dist
+}
+
+setports() {
+ if [ "1" = "$1" ]; then
+ PORT="8983"
+ STOP_PORT="7983"
+ else
+ PORT="$(( $BASE_PORT + $1 ))"
+ STOP_PORT="$(( $BASE_STOP_PORT + $1 ))"
+ fi
+}
+
+reinstall() {
+ echo "Reinstalling instance $1"
+ cd ..
+ rm -rf example$1
+ cp -r -f example example$1
+}
+
+start() {
+ OPT="-DzkHost=localhost:$ZK_PORT -DzkRun"
+ NUMSHARDS=$2
+
+ echo "Starting instance $1"
+ if [ "1" = "$1" ]; then
+ if [ "" = "$NUMSHARDS" ]; then
+ NUMSHARDS="1"
+ fi
+ echo "Instance is running zk, numshards=$NUMSHARDS"
+ OPT="-DzkRun -Dbootstrap_confdir=solr/conf -DnumShards=$NUMSHARDS"
+ fi
+ setports $1
+ cd ../example$1
+ java $JAVA_OPTS -Djetty.port=$PORT $OPT -DSTOP.PORT=$STOP_PORT -DSTOP.KEY=key -jar start.jar 1>example$1.log 2>&1 &
+}
+
+stop() {
+ echo "Stopping instance $1"
+ setports $1
+ cd ../example$1
+ java -DSTOP.PORT=$STOP_PORT -DSTOP.KEY=key -jar start.jar --stop
+}
+
+do_kill() {
+ echo "Killing instance $1"
+ setports $1
+ PID=`ps aux|grep "STOP.PORT=$STOP_PORT"|grep -v grep|cut -b 8-15`
+ if [ "" = "$PID" ]; then
+ echo "not running?"
+ else
+ kill -9 $PID
+ fi
+}
+
+status() {
+ echo "Status:"
+ ps aux|grep "STOP.PORT"|grep -v grep
+}
+
+cleanlogs() {
+ cd ../example$1
+ mv example$1.log example$1.oldlog
+}
+
+taillogs() {
+ cd ../example$1
+ tail -f example$1.log
+}
+
+createshard() {
+ setports $1
+ echo "Creating new shard @instance $1, collection=$2, shard=$3, name=$4"
+ curl "http://127.0.0.1:$PORT/solr/admin/cores?action=CREATE&collection=$2&name=$3&shard=$4"
+}