-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart.ps1
66 lines (44 loc) · 2.84 KB
/
start.ps1
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
# Config Server ReplicaSet Nodes
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --configsvr --port=1001 --dbpath="./store/config/node1" --replSet="configserver-rs"'
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --configsvr --port=1002 --dbpath="./store/config/node2" --replSet="configserver-rs"'
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --configsvr --port=1003 --dbpath="./store/config/node3" --replSet="configserver-rs"'
Start-Sleep -Seconds 5
# Shard1 ReplicaSet Nodes
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1011 --dbpath="./store/shards/shard1/node1" --replSet="shard1-rs"'
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1012 --dbpath="./store/shards/shard1/node2" --replSet="shard1-rs"'
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1013 --dbpath="./store/shards/shard1/node3" --replSet="shard1-rs"'
Start-Sleep -Seconds 5
# Shard2 ReplicaSet Nodes
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1021 --dbpath="./store/shards/shard2/node1" --replSet="shard2-rs"'
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1022 --dbpath="./store/shards/shard2/node2" --replSet="shard2-rs"'
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1023 --dbpath="./store/shards/shard2/node3" --replSet="shard2-rs"'
Start-Sleep -Seconds 5
# Shard3 ReplicaSet Nodes
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1031 --dbpath="./store/shards/shard3/node1" --replSet="shard3-rs"'
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1032 --dbpath="./store/shards/shard3/node2" --replSet="shard3-rs"'
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongod --shardsvr --port=1033 --dbpath="./store/shards/shard3/node3" --replSet="shard3-rs"'
Start-Sleep -Seconds 5
# Mongos Router
Start-Process powershell -ArgumentList '-NoExit', '-Command',
'mongos --port=2000 --configdb="configserver-rs/localhost:1001,localhost:1002,localhost:1003"'
Start-Sleep -Seconds 5
Start-Process powershell -ArgumentList '-NoExit', '-Command', 'mongosh --norc --quiet --port=2000'
# Connect to Individual Shards
Start-Sleep -Seconds 2
Start-Process powershell -ArgumentList '-NoExit', '-Command', 'mongosh --norc --quiet mongodb://localhost:1011,localhost:1012,localhost:1013'
Start-Sleep -Seconds 2
Start-Process powershell -ArgumentList '-NoExit', '-Command', 'mongosh --norc --quiet mongodb://localhost:1021,localhost:1022,localhost:1023'
Start-Sleep -Seconds 2
Start-Process powershell -ArgumentList '-NoExit', '-Command', 'mongosh --norc --quiet mongodb://localhost:1031,localhost:1032,localhost:1033'