justmeandopensource / learn-mongodb Goto Github PK
View Code? Open in Web Editor NEWMongoDB stuff
MongoDB stuff
When I issue rs.initiate(
{
_id: "cfgrs",
configsvr: true,
members: [
{ _id : 0, host : "localhost:40001" },
{ _id : 1, host : "localhost:40002" },
{ _id : 2, host : "localhost:40003" }
]
}
)
I am getting the following error
{
"ok" : 0,
"errmsg" : "No host described in new configuration with {version: 1, term: 0} for replica set cfgrs maps to this node",
"code" : 93,
"codeName" : "InvalidReplicaSetConfig",
"$gleStats" : {
"lastOpTime" : Timestamp(0, 0),
"electionId" : ObjectId("000000000000000000000000")
},
"lastCommittedOpTime" : Timestamp(0, 0)
}
It will be great if you can help.
hello i tried for 3 days but your command is missing somtheing
mongo mongodb IP address/:40001
it does not work
to me this syntax is wrong
soince i have dome replica sets and sharding w/out docker containers and it works
plz advise but its not working in your docker mongo shard vids
thxz anyway and thxz
Lisa
The first, thanks for your tutorial.
I would like to try Mongo Sharding
on DigitalOcean droplets.
Droplets
, we need for 2 Shardings
?I checked many doc and youtube, they use docker hostname to config rs.initiate()
like this
// docker-compose
version: "3"
services:
mongors1:
hostname: mongors1
container_name: mongors1
image: mongo:4.0.6
command: mongod --replSet mongors --port 27017 --dbpath /data/db
ports:
- 20001:27017
volumes:
- mongors1:/data/db
mongors2:
hostname: mongors2
container_name: mongors2
image: mongo:4.0.6
command: mongod --replSet mongors --port 27017 --dbpath /data/db
ports:
- 20002:27017
volumes:
- mongors2:/data/db
mongors3:
hostname: mongors3
container_name: mongors3
image: mongo:4.0.6
command: mongod --replSet mongors --port 27017 --dbpath /data/db
ports:
- 20003:27017
volumes:
- mongors3:/data/db
volumes:
mongors1: {}
mongors2: {}
mongors3: {}
Config replicaSet
config = {
_id: "mongors",
members: [
{ _id : 0, host : "mongors1:27017" },
{ _id : 1, host : "mongors2:27017" },
{ _id : 2, host : "mongors3:27017" }
]
}
rs.initiate(config)
But I have problem on replicaSet connection (don't work)
mongo 'mongodb;//localhost:20001,localhost:20002,localhsot:20003/?replicaSet=mongors'
mongo 'mongodb;//192.168.1.100:20001,192.168.1.100:20002,192.168.1.100:20003/?replicaSet=mongors'
....
Don't understand????????
Could example how to use Mongos Router
with 2 or 3 nodes?
version: "3"
services:
mongos:
container_name: mongos
image: mongo:4.0.6
command: mongos --configdb cfgrs/192.168.0.102:40001,192.168.0.102:40002,192.168.0.102:40003 --bind_ip 0.0.0.0 --port 27017
ports:
- 60000:27017
...............
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.