Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
418 views
in Technique[技术] by (71.8m points)

mongodb - When using MongoStat, how do you correctly format the connection string?

I am trying to use MongoStat to monitor my database deployment. Below is the command I'm using to try and connect:

mongostat --uri "mongodb+srv://user:[email protected]/admin?replicaSet=project-shard-0&connectTimeoutMS=10000&authSource=admin&authMechanism=SCRAM-SHA-1"

This produces the error:

error configuring the connector: error parsing options from URI: error parsing uri: URI with srv must not include a port number 

The connection string format that I'm using does actually work when used with MongoRestore. But with MongoStat, I get this error. Does anyone here know how I can properly format this connection string?

question from:https://stackoverflow.com/questions/65876697/when-using-mongostat-how-do-you-correctly-format-the-connection-string

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

man mongostat shows this:

--uri=<connectionString>
              New in version 3.4.6.

              Specify a resolvable URI connection string (enclose in quotes) to connect to the MongoDB deployment.

                 --uri="mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"

Stands to reason that if you try this command instead, it should work:

mongostat --uri="mongodb+srv://user:[email protected]/admin?replicaSet=project-shard-0&connectTimeoutMS=10000&authSource=admin&authMechanism=SCRAM-SHA-1"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...