source: other-projects/hathitrust/wcsa/extracted-features-solr/trunk/gslis-cluster/SCRIPTS/remote-mongodb-add-shards-to-routers.sh

Last change on this file was 31306, checked in by davidb, 7 years ago

Final part of the mongodb shard puzzle -- router servers

  • Property svn:executable set to *
File size: 862 bytes
Line 
1#!/bin/bash
2
3repl_set_core="htrc-ef"
4
5MONGODB_REPLSET_META_ARRAY=($MONGODB_REPLSET_METALIST)
6num_shards=${#MONGODB_REPLSET_META_ARRAY[*]}
7
8router_hosts_array=($MONGODB_ROUTER_HOSTS)
9head_router_host=${router_hosts_array[0]}
10
11i=0
12while [ $i -lt $num_shards ]; do
13
14 repl_set="$repl_set_core-shard$i"
15
16 replset_meta_hosts=${MONGODB_REPLSET_META_ARRAY[$i]}
17 eval replset_hosts="`echo \\$$replset_meta_hosts`"
18
19 shard_hosts_array=($replset_hosts)
20 primary_shard_host=${shard_hosts_array[0]}
21
22 # e.g., sh.addShard( "<replSetName>/s1-mongo1.example.net:27017")
23 add_syntax="sh.addShard( \\\"$repl_set/$primary_shard_host:$MONGODB_REPLSET_PORT\\\" )"
24
25 echo "* Adding MongoDB Shard Server Replica Set$i to Router $head_router_host"
26 ssh $head_router_host "mongo --host localhost --port $MONGODB_ROUTER_PORT -eval \"$add_syntax\""
27
28 i=$((i+1))
29 echo ""
30done
31
32
Note: See TracBrowser for help on using the repository browser.