Search code examples
databasemongodbconfigurationnosqlsharding

Error parsing command line: unrecognised option '--configdb'


I am following this tutorial, that explains how to set up mongodb shard at windows. In step 3, it says to start a route process with the command

mongod --port 40000 --configdb localhost:27100 --logpath=/www/mongoDB/shard/log/route.log --chunkSize 500

and windows console returns:

Error parsing command line: unrecognised option '--configdb' try 'mongod --help' for more information

I tried mongod --help and I saw that --configdb really does not exist for mongod. How can I go through this step or solve this error?

I read other tutorial, and in step 2 it uses the same mongod with configdb

mongod –configdb ServerD: 27019

I am using MongoDB v3.4.


Solution

  • It looks like this tutorial is for versions prior to 3.4. From 3.4 onwards the config databases are themselves a replica set (since it's very important that the data is not lost).

    There's an official tutorial for 3.4 with more detail which works for the latest versions.

    In summary, you're --configdb value will end up like <configReplSetName>/cfg1.example.net:27019,cfg2.example.net:27019