2013-12-22 23:44:26 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
# To run on hdfs, try something along the lines of:
|
|
|
|
# export JAVA_OPTS="-Dsolr.directoryFactory=solr.HdfsDirectoryFactory -Dsolr.lock.type=hdfs -Dsolr.hdfs.home=hdfs://localhost:8020/solr -Dsolr.hdfs.confdir=/etc/hadoop_conf/conf"
|
|
|
|
|
2013-12-22 23:44:26 -05:00
|
|
|
numServers=$1
|
|
|
|
numShards=$2
|
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
baseJettyPort=8900
|
|
|
|
baseStopPort=9900
|
2013-12-22 23:44:26 -05:00
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
zkAddress=localhost:9900
|
2013-12-22 23:44:26 -05:00
|
|
|
|
|
|
|
die () {
|
|
|
|
echo >&2 "$@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
[ "$#" -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
|
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
ant -f ../build.xml clean
|
2012-01-25 14:49:26 -05:00
|
|
|
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
|
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
rm -r -f examplezk
|
|
|
|
cp -r -f example examplezk
|
|
|
|
cp core/src/test-files/solr/solr-no-core.xml examplezk/solr/solr.xml
|
|
|
|
rm -r -f examplezk/solr/collection1/core.properties
|
|
|
|
cd examplezk
|
|
|
|
stopPort=1313
|
|
|
|
jettyPort=8900
|
|
|
|
exec -a jettyzk java -Xmx512m $JAVA_OPTS -Djetty.port=$jettyPort -DhostPort=$jettyPort -DzkRun -DzkRunOnly=true -DSTOP.PORT=$stopPort -DSTOP.KEY=key -jar start.jar 1>examplezk.log 2>&1 &
|
|
|
|
cd ..
|
2013-12-22 23:44:26 -05:00
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
# upload config files
|
|
|
|
java -classpath "example1/solr-webapp/webapp/WEB-INF/lib/*:example/lib/ext/*" org.apache.solr.cloud.ZkCLI -cmd bootstrap -zkhost $zkAddress -solrhome example1/solr
|
|
|
|
|
|
|
|
cd example
|
2012-01-25 14:49:26 -05:00
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
for (( i=1; i <= $numServers; i++ ))
|
2013-12-22 23:44:26 -05:00
|
|
|
do
|
|
|
|
echo "starting example$i"
|
|
|
|
cd ../example$i
|
|
|
|
stopPort=`expr $baseStopPort + $i`
|
|
|
|
jettyPort=`expr $baseJettyPort + $i`
|
2014-08-06 12:46:31 -04:00
|
|
|
exec -a jetty java -Xmx1g $JAVA_OPTS -DnumShards=$numShards -Djetty.port=$jettyPort -DzkHost=$zkAddress -DSTOP.PORT=$stopPort -DSTOP.KEY=key -jar start.jar 1>example$i.log 2>&1 &
|
2013-12-22 23:44:26 -05:00
|
|
|
done
|
2012-01-25 14:49:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
|