We can find out total number connection to be established in MongoDB using the commands, Enter into MongoDB using mongo command then execute
# mongo
mongos> var status = db.serverStatus()
mongos> status.connections
displays established IP's
# netstat -anp --tcp --udp | grep mongo
tcp 0 0 192.168.1.120:27017 192.168.2.50:34213 ESTABLISHED 27999/mongos
tcp 0 0 192.168.1.120:27017 192.168.2.50:34335 ESTABLISHED 27999/mongos
tcp 0 0 192.168.1.120:27017 192.168.2.50:34284 ESTABLISHED 27999/mongos
Also, you can count the number established connection,
Count the Number of MongoDB connection with IP :
# netstat -anp --tcp --udp | grep mongo | wc -l
3
Comments (0)