I am attempting a simple sharding set up (on a single host without any replica set). However I am unable to go any further because this is what happens when i try to start mongos:
C:\>mongos --configdb localhost:27010 --port 27011
I get:
BadValue: configdb supports only replica set connection string
try 'mongos --help' for more information
I am failing to see what is lacking. I tried mongos --help
, but according to that valid arguments for --configdb are <config replset name>/<host1:port>, <host2:port>, etc
. But this is what I've done.
I have not done anything else than starting the config server:
mongod --configsvr --port 27010
which is the one I am trying to connect the mongos to.
Any ideas on how this can be resolved?
Thankful for any advice in advance.
You can start MongoDB from a command line by issuing the mongod command and specifying options. For a list of options, see the mongod reference. MongoDB can also run as a Windows service. For details, see Start MongoDB Community Edition as a Windows Service.
For a sharded cluster, the mongos instances provide the interface between the client applications and the sharded cluster. The mongos instances route queries and write operations to the shards. From the perspective of the application, a mongos instance behaves identically to any other MongoDB instance.
Go to the MongoDB website's download section and download the correct version of MongoDB. Run the Mongo daemon, in one terminal window run ~/mongodb/bin/mongod . This will start the Mongo server. Run the Mongo shell, with the Mongo daemon running in one terminal, type ~/mongodb/bin/mongo in another terminal window.
You have set up the config server as a standalone mongod process, but as of MongoDB 3.4 that isn't supported: it must be a replicaset:
config servers: Config servers store metadata and configuration settings for the cluster. As of MongoDB 3.4, config servers must be deployed as a replica set (CSRS).
The minimum setup is to have a single mongod process, configured as a 1-member replica set; then your mongos process connects to the replica set:
mongos --configdb replsetname/localhost:27010 --port 27011
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With