24 January,2020 by Rambler
Question: How can I list client ip , port and connection ID of connections to MongoDB? I want to connect through the MongoDB command line and extract this information as I'm testing some HA failover scenarios.
Answer: There's a few different ways to extract the MongoDB connection details - for example you can use netstat. But from the command line - this syntax will report the details required
db.currentOp(true).inprog.forEach(function(d){if(d.client)print(d.client, d.connectionId)})
Example output - clientip:port clientid:
127.0.0.1:55552 4668364
10.120.xxx.xxx:60942 4668363
10.120.xxx.xxx:60924 4668357
Read More on MongoDB
How to read MongoDB system log file
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |