Skip to content

SirawichDev/k8s-replicaSet-mongodb-loadBalance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This read Me for setting up replica set for mongo krub

1. Install kubernete

2. Install Metallb system

3 Run file .yaml

$ kubectl create -f .

4.connect mongo pod together

Set primary node

$ kubectl exec -it mongo-0.mongo:27017
> rs.initiate()
> var ctx = rs.conf()
> ctx.members[0].host="mongo-0.mongo:27017"

re-save config

> rs.reconfig(ctx)

connect rest node to primary node :3

> rs.add("mongo-1.mongo:27017")
> rs.add("mongi-2.mongo:27017")

check it with creeate new mongo shell pod

$ mongo mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo

and check with

> rs.status()

Sirawich Voungchuy :3

Releases

No releases published

Packages

No packages published