root/other-projects/hathitrust/wcsa/extracted-features-solr/trunk/gslis-cluster/SCRIPTS/remote-mongodb-start-shardservers.sh @ 31307

Revision 31305, 1.5 KB (checked in by davidb, 3 years ago)

Next good commit point. Initial testing of shard replset scripts

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3repl_set_core="htrc-ef"
4
5
6MONGODB_REPLSET_META_ARRAY=($MONGODB_REPLSET_METALIST)
7
8num_shards=${#MONGODB_REPLSET_META_ARRAY[*]}
9
10i=0
11
12while [ $i -lt $num_shards ]; do
13
14  replset_meta_hosts=${MONGODB_REPLSET_META_ARRAY[$i]}
15  eval replset_hosts="`echo \\$$replset_meta_hosts`"
16
17  for h in $replset_hosts ; do
18    echo "* Starting MongoDB Replica-set Shard$i Server on $h:$MONGODB_REPLSET_PORT"
19    repl_set="$repl_set_core-shard$i"
20    repl_shard_dir="$MONGODB_DBDIR/$repl_set-$h"
21    ssh $h "if [ ! -d $repl_shard_dir ] ; then mkdir $repl_shard_dir ; fi"
22    ssh $h "mongod --shardsvr --replSet $repl_set --dbpath \"$repl_shard_dir\" --port $MONGODB_REPLSET_PORT > mongodb-output-$h-replset$i.log &"
23  done
24
25  i=$((i+1))
26  echo ""
27done
28
29
30
31
32
33#for h in $MONGODB_REPLSET2_HOSTS ; do
34#  repl_set="$repl_set_core-shard2"
35#  repl_shard_dir="$MONGODB_DBDIR/$repl_set-$h"
36#  ssh $h "if [ ! -d $repl_shard_dir ] ; then mkdir $repl_shard_dir ; fi"
37#  echo "* Starting MongoDB Replica-set Shard2 Server on $h:$MONGODB_REPLSET_PORT"
38#  ssh $h "mongod --shardsvr --replSet $repl_set --dbpath \"$repl_shard_dir\" --port $MONGODB_REPLSET_PORT > mongodb-output-$h-replset2.log &"
39#done
40
41
42## mongod --shardsvr --replSet a --dbpath /var/lib/mongodb/shardedcluster/a0 --logpath /var/lib/mongodb/shardedcluster/log.a0 --port 27000 --fork --logappend --smallfiles --oplogSize 50
43## ...
44## mongod --shardsvr --replSet a --dbpath /var/lib/mongodb/shardedcluster/a1 --logpath /var/lib/mongodb/shardedcluster/log.a1 --port 27001 --fork --logappend --smallfiles --oplogSize 50
45
46# Then same for 'b'
Note: See TracBrowser for help on using the browser.