mirror of https://github.com/apache/lucene.git
add more scripting to help testing different scenarios
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1294489 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0b7cf94411
commit
af16f0da65
|
@ -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
|
|
@ -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"
|
||||
}
|
Loading…
Reference in New Issue