When trying to add clustered nodes IP in mongos Getting error

Hi Team,

I’m a beginner in Mongodb, so I need to perform sharding in the UAT server so First explain what I have. I have 2 separate server with Linux centos OS so I installed MongoDB 4.2.24. I tried to open the Mongos because of need to enable the sharding but I getting error in ip. Please find the error below:

sudo mongos -f /etc/mongos.conf
FailedToParse: invalid url [172.28.129.131:27017,172.28.136.157:27017]
try ‘mongos --help’ for more information again and again getting same error tell me the proper way

so intially mongos.conf file not there so I created a mongos.conf file with below code:

systemLog:
destination: file
path: “/var/log/mongos/mongos.log”
processManagement:
fork: true
net:
bindIp: 0.0.0.0
port: 27017
sharding:
configDB: configReplSet/configServer1:27017,configServer2:27017
then also getting same error only so I need to enable the shadring for the collection so I need to open the mongos and give a clustered nodes IP so how to do that?

Thanks & Regards
Aravind

  1. Are your config servers up and running successfully with a primary?
  2. Is the mongos on the same or different server as them? If they are on a different server I would verify that you can connect to them with telnet ip_address port to verify no FW are blocking.
  3. Verify that you don’t have any issues in your config file spacing, here is a sample. the “<>” should be removed they just indicate a variable you have to populate.

sharding:
    configDB: "<CONFIG_REPL_NAME>/<host1:27019,host2:27019>"
 
systemLog:
    destination: file
    path: /var/log/mongos/mongos.log
    logAppend: true
    logRotate: reopen
 
net:
    port: 27017
    bindIp: "<HOSTNAME>,localhost"
     
processManagement:
    fork: true