forked from cloudera-labs/envelope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
solr-setup.sh
executable file
·32 lines (26 loc) · 980 Bytes
/
solr-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
COLLECTION_NAME=nav-audit
NUM_SHARDS=3
BASE_DIR=$( readlink -f $( dirname $0 ) )
COLLECTION_DIR=$BASE_DIR/nav-solr
cnt=$( solrctl collection --list | grep "^$COLLECTION_NAME " | wc -l )
if [ "$cnt" -gt "0" ]; then
echo "Collection $COLLECTION_NAME already exists."
echo -n "Delete it? (y/N) "
read deleteit
if [ "$( echo "$deleteit" | tr "y" "Y")" != "Y" ]; then
echo "Bye."
exit
fi
echo "Deleting Solr collection $COLLECTION_NAME"
solrctl collection --delete $COLLECTION_NAME
fi
rm -rf $COLLECTION_DIR
echo "Generating local Solr configuration directory"
solrctl instancedir --generate $COLLECTION_DIR
echo "Updating schema.xml file in the configuration"
cp $BASE_DIR/schema.xml $COLLECTION_DIR/conf/
echo "Uploading configuration to ZooKeeper"
solrctl instancedir --create $COLLECTION_NAME $COLLECTION_DIR
echo "Creating collection $COLLECTION_NAME in Solr"
solrctl collection --create $COLLECTION_NAME -s $NUM_SHARDS -c $COLLECTION_NAME