-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartMongoShard.py
More file actions
executable file
·69 lines (47 loc) · 1.42 KB
/
StartMongoShard.py
File metadata and controls
executable file
·69 lines (47 loc) · 1.42 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
#!/usr/bin/python
import os, time
mainDir = '/home/ayadav/mongoShardScripts/'
cmd = mainDir+'KillMongo.py'
os.system(cmd)
cmd = 'rm -rf '+mainDir+'configdb-1'
os.system(cmd)
#cmd = 'rm -rf '+mainDir+'configdb-2'
#os.system(cmd)
#cmd = 'rm -rf '+mainDir+'configdb-3'
#os.system(cmd)
cmd = 'mkdir '+mainDir+'configdb-1'
os.system(cmd)
#cmd = 'mkdir '+mainDir+'configdb-2'
#os.system(cmd)
#cmd = 'mkdir '+mainDir+'configdb-3'
#os.system(cmd)
cmd = mainDir+'runMongoDConfig.sh compute-0-23 1'
os.system(cmd)
#cmd = mainDir+'runMongoDConfig.sh compute-0-14 2'
#os.system(cmd)
#cmd = mainDir+'runMongoDConfig.sh compute-0-15 3'
#os.system(cmd)
time.sleep(10)
# starting mongos on each 10 compute nodes
cmd = mainDir+'RunMongoS.py'
os.system(cmd)
# start mongd instances at different ports.
# remove directories, create directories
cmd = mainDir+'RemoveMongoDir.py'
os.system(cmd)
# make dirs
cmd = mainDir+'CreateDirMongo.py'
os.system(cmd)
# run mongod process
cmd = mainDir+'RunMongoD.py'
os.system(cmd)
time.sleep(10)
#adding all shards
cmd = 'mongo --host compute-0-13 --port 27017 '+mainDir+'mongoShell.js'
os.system(cmd)
# enable sharding on database and collections
cmd = 'mongo --host compute-0-13 --port 27017 '+mainDir+'enableShard.js'
os.system(cmd)