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"
|
|
|
|
|
2014-08-29 08:30:53 -04:00
|
|
|
# To use ZooKeeper security, try:
|
|
|
|
# export JAVA_OPTS="-DzkACLProvider=org.apache.solr.common.cloud.VMParamsAllAndReadonlyDigestZkACLProvider -DzkCredentialsProvider=org.apache.solr.common.cloud.VMParamsSingleSetCredentialsDigestZkCredentialsProvider -DzkDigestUsername=admin-user -DzkDigestPassword=admin-password -DzkDigestReadonlyUsername=readonly-user -DzkDigestReadonlyPassword=readonly-password"
|
|
|
|
|
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-29 08:30:53 -04:00
|
|
|
zkAddress=localhost:9900/solr
|
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
|
2014-12-02 12:41:30 -05:00
|
|
|
echo "try to remove existing directory: server$i"
|
|
|
|
rm -r -f server$i
|
2013-12-22 23:44:26 -05:00
|
|
|
done
|
|
|
|
|
2012-01-25 14:49:26 -05:00
|
|
|
|
|
|
|
rm -r -f dist
|
|
|
|
rm -r -f build
|
2014-12-02 12:41:30 -05:00
|
|
|
rm -r -f server/solr/zoo_data
|
|
|
|
rm -f server/server.log
|
2012-01-25 14:49:26 -05:00
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
ant -f ../build.xml clean
|
2015-01-13 18:31:20 -05:00
|
|
|
ant server dist
|
2012-01-25 14:49:26 -05:00
|
|
|
|
2014-12-02 12:41:30 -05:00
|
|
|
rm -r server/solr-webapp/*
|
|
|
|
unzip server/webapps/solr.war -d server/solr-webapp/webapp
|
2013-03-02 20:29:48 -05:00
|
|
|
|
2013-12-22 23:44:26 -05:00
|
|
|
for (( i=1; i <= $numServers; i++ ))
|
|
|
|
do
|
2014-12-02 12:41:30 -05:00
|
|
|
echo "create server$i"
|
|
|
|
cp -r -f server server$i
|
2013-12-22 23:44:26 -05:00
|
|
|
done
|
2014-08-29 08:30:53 -04:00
|
|
|
|
2014-12-02 12:41:30 -05:00
|
|
|
rm -r -f serverzk
|
|
|
|
cp -r -f server serverzk
|
|
|
|
cp core/src/test-files/solr/solr-no-core.xml serverzk/solr/solr.xml
|
|
|
|
rm -r -f serverzk/solr/collection1/core.properties
|
|
|
|
cd serverzk
|
2014-08-06 12:46:31 -04:00
|
|
|
stopPort=1313
|
|
|
|
jettyPort=8900
|
2014-12-02 12:41:30 -05:00
|
|
|
exec -a jettyzk java -Xmx512m $JAVA_OPTS -Djetty.port=$jettyPort -DhostPort=$jettyPort -DzkRun=localhost:9900/solr -DzkHost=$zkAddress -DzkRunOnly=true -DSTOP.PORT=$stopPort -DSTOP.KEY=key -jar start.jar 1>serverzk.log 2>&1 &
|
2014-08-06 12:46:31 -04:00
|
|
|
cd ..
|
2013-12-22 23:44:26 -05:00
|
|
|
|
2014-08-06 12:46:31 -04:00
|
|
|
# upload config files
|
2014-12-02 12:41:30 -05:00
|
|
|
java -classpath "server/solr-webapp/webapp/WEB-INF/lib/*:server/lib/ext/*" $JAVA_OPTS org.apache.solr.cloud.ZkCLI -zkhost $zkAddress -cmd upconfig --confdir server/solr/configsets/basic_configs --confname basic_configs
|
2014-08-06 12:46:31 -04:00
|
|
|
|
2014-12-02 12:41:30 -05:00
|
|
|
cd server
|
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
|
2014-12-02 12:41:30 -05:00
|
|
|
echo "starting server$i"
|
|
|
|
cd ../server$i
|
2013-12-22 23:44:26 -05:00
|
|
|
stopPort=`expr $baseStopPort + $i`
|
|
|
|
jettyPort=`expr $baseJettyPort + $i`
|
2014-12-02 12:41:30 -05: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>server$i.log 2>&1 &
|
2013-12-22 23:44:26 -05:00
|
|
|
done
|