The mongodb database is connected through a shell, and clusters deployed by replication can be connected as follows:
mongos mongodb://ctl1m:27017,ctl2m:27017,ctl3m:27017/? replicaSet=rs0
So, how should I connect if it is a sharding cluster deployment?
I have tried the following, but I will report an error:
[root@ctl1m ~]# mongos mongodb://ctl1m:30000,ctl2m:30000,ctl3m:30000/ Error parsing command line: too many positional options have been specified on the command line try 'mongos --help' for more information
Can you tell me how to write the command to connect correctly? Thank you!
The understanding is not quite correct. For sharded cluster, mongos is used for routing in front of mongos. shell or Mongos is a program that can connect Mongos as well as Mongos.
mongo --host "mongodb://mongos1,mongos2,mongos3.../db"