In my cluster on Atlas, have a many connections in secondary nodes.
How to list this connections?
When execute this command, list the current connections in primary node.
db.currentOp(true).inprog.reduce(
(accumulator, connection) => {
ipaddress = connection.client ? connection.client.split(":")[0] : "unknown";
accumulator[ipaddress] = (accumulator[ipaddress] || 0) + 1;
accumulator["TOTAL_CONNECTION_COUNT"]++;
return accumulator;
},
{ TOTAL_CONNECTION_COUNT: 0 }
)
{
"TOTAL_CONNECTION_COUNT" : 229,
}
But, I have 700 connection in replicaSet.
Thank's
Best Answer
mongostat
command under Set Up Diagnostics sectionUpdate password and add
--discover
option at the endRun it in any command-line tool
You should be able to see the number of connections as below for all primary and secondaries