-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigs.sh
executable file
·63 lines (50 loc) · 1.42 KB
/
configs.sh
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
mongo mongodb://kubernetes.docker.internal:40001
rs.initiate(
{
_id: "cfgrs",
configsvr: true,
members: [
{ _id : 0, host : "kubernetes.docker.internal:40001" },
{ _id : 1, host : "kubernetes.docker.internal:40002" },
]
}
)
exit
mongo mongodb://kubernetes.docker.internal:50001
rs.initiate(
{
_id: "shard1rs",
members: [
{ _id : 0, host : "kubernetes.docker.internal:50001" },
{ _id : 1, host : "kubernetes.docker.internal:50002" },
]
}
)
rs.addArb("kubernetes.docker.internal:50003")
exit
mongo mongodb://kubernetes.docker.internal:50004
rs.initiate(
{
_id: "shard2rs",
members: [
{ _id : 0, host : "kubernetes.docker.internal:50004" },
{ _id : 1, host : "kubernetes.docker.internal:50005" },
]
}
)
rs.addArb("kubernetes.docker.internal:50006")
exit
mongo mongodb://kubernetes.docker.internal:60000
sh.addShard("shard1rs/kubernetes.docker.internal:50001,kubernetes.docker.internal:50002")
sh.addShard("shard2rs/kubernetes.docker.internal:50004,kubernetes.docker.internal:50005")
use aterrizapp
db.Flights.ensureIndex({"_id": "hashed"})
sh.enableSharding("aterrizapp")
sh.shardCollection("aterrizapp.Flights", {"_id": "hashed" }, false)
# ---- extra...
# sh.shardCollection("aterrizapp.Flights", {"departure": "hashed" }, false)
# docker volume prune
# docker volume ls -f dangling=true
# docker rmi
# docker system prune -a
# docker system prune