2014-08-06 12:46:31 -04:00
|
|
|
INT_JAVA_OPTS="-server -Xms256M -Xmx256M"
|
|
|
|
BASE_PORT=8900
|
|
|
|
BASE_STOP_PORT=9900
|
|
|
|
ZK_PORT="2414"
|
2014-08-29 08:30:53 -04:00
|
|
|
ZK_CHROOT="solr"
|
2012-02-28 02:05:37 -05:00
|
|
|
|
|
|
|
rebuild() {
|
2015-08-12 13:43:08 -04:00
|
|
|
echo "Rebuilding"
|
|
|
|
cd ..
|
|
|
|
rm -r -f dist
|
|
|
|
rm -r -f build
|
|
|
|
rm -r -f server/solr/zoo_data
|
|
|
|
rm -f server/server.log
|
|
|
|
ant server dist
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
setports() {
|
2014-08-06 12:46:31 -04:00
|
|
|
PORT="$(( $BASE_PORT + $1 ))"
|
|
|
|
STOP_PORT="$(( $BASE_STOP_PORT + $1 ))"
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
reinstall() {
|
2015-08-12 13:43:08 -04:00
|
|
|
echo "Reinstalling instance $1"
|
|
|
|
cd ..
|
|
|
|
rm -rf server$1
|
|
|
|
cp -r -f server server$1
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
2015-08-12 13:43:08 -04:00
|
|
|
OPT="-DzkHost=localhost:$ZK_PORT/$ZK_CHROOT"
|
|
|
|
NUMSHARDS=$2
|
2012-02-28 02:05:37 -05:00
|
|
|
|
2015-08-12 13:43:08 -04:00
|
|
|
echo "Starting instance $1"
|
2014-08-29 08:30:53 -04:00
|
|
|
|
2015-08-12 13:43:08 -04:00
|
|
|
setports $1
|
|
|
|
cd ../server$1
|
|
|
|
java $JAVA_OPTS -Djetty.port=$PORT $OPT -jar start.jar --module=http STOP.PORT=$STOP_PORT STOP.KEY=key jetty.base=. 1>server$1.log 2>&1 &
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2015-08-12 13:43:08 -04:00
|
|
|
echo "Stopping instance $1"
|
|
|
|
setports $1
|
|
|
|
cd ../server$1
|
|
|
|
java -jar start.jar --module=http STOP.PORT=$STOP_PORT STOP.KEY=key --stop
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
do_kill() {
|
2015-08-12 13:43:08 -04:00
|
|
|
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
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
status() {
|
2015-08-12 13:43:08 -04:00
|
|
|
echo "Status:"
|
|
|
|
ps aux|grep "STOP.PORT"|grep -v grep
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
cleanlogs() {
|
2014-12-02 12:41:30 -05:00
|
|
|
cd ../server$1
|
2015-08-12 13:43:08 -04:00
|
|
|
mv server$1.log server$1.oldlog
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
taillogs() {
|
2015-08-12 13:43:08 -04:00
|
|
|
cd ../server$1
|
|
|
|
tail -f server$1.log
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
createshard() {
|
2015-08-12 13:43:08 -04:00
|
|
|
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"
|
2012-02-28 02:05:37 -05:00
|
|
|
}
|