2013-12-22 23:44:26 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
numServers=$1
|
|
|
|
numShards=$2
|
|
|
|
|
|
|
|
baseJettyPort=7572
|
|
|
|
baseStopPort=6572
|
|
|
|
|
|
|
|
zkaddress = localhost:2181/solr
|
|
|
|
|
|
|
|
die () {
|
|
|
|
echo >&2 "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
[ "$#" -eq 2 ] || die "2 arguments required, $# provided, usage: solrcloud-start.sh {numServers} {numShards}"
|
2012-01-25 14:49:26 -05:00
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
2013-12-22 23:44:26 -05:00
|
|
|
for (( i=1; i <= $numServers; i++ ))
|
|
|
|
do
|
|
|
|
rm -r -f example$i
|
|
|
|
done
|
|
|
|
|
2012-01-25 14:49:26 -05:00
|
|
|
|
|
|
|
rm -r -f dist
|
|
|
|
rm -r -f build
|
|
|
|
rm -r -f example/solr/zoo_data
|
2012-08-03 12:11:00 -04:00
|
|
|
rm -r -f example/solr/collection1/data
|
2012-01-25 14:49:26 -05:00
|
|
|
rm -f example/example.log
|
|
|
|
|
|
|
|
ant example dist
|
|
|
|
|
2013-03-02 20:29:48 -05:00
|
|
|
rm -r example/solr-webapp/*
|
|
|
|
unzip example/webapps/solr.war -d example/solr-webapp/webapp
|
|
|
|
|
2013-12-22 23:44:26 -05:00
|
|
|
for (( i=1; i <= $numServers; i++ ))
|
|
|
|
do
|
|
|
|
echo "create example$i"
|
|
|
|
cp -r -f example example$i
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
java -classpath "example1/solr-webapp/webapp/WEB-INF/lib/*:example/lib/ext/*" org.apache.solr.cloud.ZkCLI -cmd bootstrap -zkhost 127.0.0.1:9983 -solrhome example1/solr -runzk 8983
|
|
|
|
|
|
|
|
echo "starting example1"
|
2012-01-25 14:49:26 -05:00
|
|
|
|
2013-12-22 23:44:26 -05:00
|
|
|
cd example1
|
|
|
|
java -Xmx1g -DzkRun -DnumShards=$numShards -DSTOP.PORT=7983 -DSTOP.KEY=key -jar start.jar 1>example1.log 2>&1 &
|
2012-01-25 14:49:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-22 23:44:26 -05:00
|
|
|
for (( i=2; i <= $numServers; i++ ))
|
|
|
|
do
|
|
|
|
echo "starting example$i"
|
|
|
|
cd ../example$i
|
|
|
|
stopPort=`expr $baseStopPort + $i`
|
|
|
|
jettyPort=`expr $baseJettyPort + $i`
|
|
|
|
java -Xmx1g -Djetty.port=$jettyPort -DzkHost=localhost:9983 -DnumShards=1 -DSTOP.PORT=$stopPort -DSTOP.KEY=key -jar start.jar 1>example$i.log 2>&1 &
|
|
|
|
done
|
2012-01-25 14:49:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|