root/other-projects/hathitrust/wcsa/extracted-features-solr/trunk/gslis-cluster/SCRIPTS/remote-solr-start-shard.sh @ 32174

Revision 32174, 1.5 KB (checked in by davidb, 18 months ago)

Useful utility

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3solr_cmd=${1-start}
4core_num=${2-null}
5
6if [ "x$SOLR_SHARDS" != "x" ] ; then
7    SOLR_NODES_ARRAY=($SOLR_NODES)
8    SOLR_SHARDS_ARRAY=($SOLR_SHARDS)
9
10    num_shards=${#SOLR_NODES_ARRAY[*]}
11   
12    i=0
13   
14    while [ $i -lt $num_shards ] ; do
15    solr_node=${SOLR_NODES_ARRAY[$i]}
16    solr_home_shard_dir=${SOLR_SHARDS_ARRAY[$i]}
17   
18    solr_host=${solr_node%:*}
19    solr_port=${solr_node##*:}
20
21    server_dir="/disk0/solr-server-$solr_host-$solr_port"
22   
23    export SOLR_HOME=
24    export SOLR_PID_DIR=
25    #export SOLR_PID_DIR="$solr_home_shard_dir"
26        if [ "$core_num" == "null" ] || [ "$core_num" == "$i" ] ; then
27
28      echo "Starting solr cloud node on: $solr_host:$solr_port solr_home=$solr_home_shard_dir"
29      if [ "x$SOLR_JAVA_MEM" != "x" ] ; then
30        echo "=> SOLR_JAVA_MEM=$SOLR_JAVA_MEM"
31      fi
32        ssh $solr_host solr $solr_cmd -cloud -z $ZOOKEEPER_SERVER -h $solr_host -p $solr_port -d "$server_dir" -s "$solr_home_shard_dir"
33    fi
34   
35    i=$((i+1))
36    done
37else
38
39    run_from_local_disk=1
40
41    #local_dir="/tmp/solr-ef"
42    local_dir="/hdfsd05/dbbridge/solr-ef"
43
44
45    if [ $run_from_local_disk = "1" ] ; then
46    opt_s="-s $local_dir"
47    export SOLR_HOME=
48    echo "****"
49    echo "* Running solr from local disk: $local_dir"
50    echo "****"
51    else
52    opt_s=
53    fi
54   
55    for solr_node in $SOLR_NODES ; do
56    solr_host=${solr_node%:*}
57    solr_port=${solr_node##*:}
58   
59    echo "Starting solr cloud node on: $solr_host [port $solr_port]"
60    ssh $solr_host solr $solr_cmd -cloud -z $ZOOKEEPER_SERVER -h $solr_host -p $solr_port $opt_s
61    done
62fi
Note: See TracBrowser for help on using the browser.