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 |
|
---|
3 | repl_set_core="htrc-ef"
|
---|
4 |
|
---|
5 | MONGODB_REPLSET_META_ARRAY=($MONGODB_REPLSET_METALIST)
|
---|
6 | num_shards=${#MONGODB_REPLSET_META_ARRAY[*]}
|
---|
7 |
|
---|
8 | router_hosts_array=($MONGODB_ROUTER_HOSTS)
|
---|
9 | head_router_host=${router_hosts_array[0]}
|
---|
10 |
|
---|
11 | i=0
|
---|
12 | while [ $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 ""
|
---|
30 | done
|
---|
31 |
|
---|
32 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.