Jel se netko uspio spojiti sa nekim programom na ovaj replicaSet ?
Dodao sam rs0,rs1,rs2,rs3 i rs4 u /etc/hosts na Windows-ima
127.0.0.1 rs0
127.0.0.1 rs1
127.0.0.1 rs2
127.0.0.1 rs3
127.0.0.1 rs4
Probao sam iz node.js sa Mongo clientom ili mongoose-om
MongoClient.connect("mongodb://rs0:27018,rs1:27019,rs2:27020,rs3:27021,rs4:27022/", function(err, db) {
test.equal(null, err);
test.ok(db != null);
})
ili
const DB_URI = 'mongodb://rs0:27018,rs1:27019,rs2:27020,rs3:27021,rs4:27022/admin?replicaSet=rsnmbp
mongoose.connect(DB_URI, {
serverSelectionTimeoutMS: 5000
}).then((result) =>console.log ("connected to database"))
.catch((err) =>console.log (err.reason))
no dobijem ovaj error
MongoServerSelectionError: ECONNREFUSED 127.0.0.1:27018
u oba slučaja.
Probao sam sa pymongo ali isto ne dobijem nista, c.nodes je prazan.
c = pymongo.MongoClient('mongodb://rs0:27018,rs1:27019,rs2:27020,rs3:27021,rs4:27022/?replicaSet=rsnmbp')
time.sleep(5)
print(c.nodes);
Jel ima tko neku ideju u čemu je problem ?