forked from TrieTreeTechnologies/mongoDB-K8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsteps-afterdeploy
33 lines (24 loc) · 867 Bytes
/
steps-afterdeploy
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
kubectl exec -it mongo-0 -- mongo
rs.initiate()
var cfg = rs.conf()
cfg.members[0].host="mongo-0.mongo:27017"
rs.reconfig(cfg)
rs.status()
rs.add("mongo-1.mongo:27017")
rs.add("mongo-2.mongo:27017")
rs.status()
exit
kubectl run mango --rm -it --image mongo -- sh
mongo mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo
rs.status()
mongo mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo --eval 'rs.status()' | grep name
mongo mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo/admin?replicaSet=rs0
show dbs
kubectl expose pod mongo-0 --port 27017 --target-port 27017 --type LoadBalancer
use inventory
db.books.insertMany([
{ title: "Moby Dick", author: "Herman Melville" },
{ title: "The Great Gatsby", author: "F. Scott Fitzgerald" },
{ title: "One Hundred Years of Solitude", author: "Gabriel Garcia Marquez" }
]);
db.books.find({}).pretty()