I am building a system that outputs information such as visit information and page transitions to the MongoDB user who visited the site. The MongoDB connection pool of the site's server became MAX, and MongoDB was discontinued from the site.
The MongoDB service is configured with the following configuration.
mongos server # 1 service: mongos, config mongos server # 2 service: mongos, config, rs01arbiter mongos server # 3 service: mongos, config, rs02arbiter node # 1 service: rs01 (secondary), rs02 (secondary) node # 2 service: rs01 (primary), rs02 (primary)
※ The initial state is set to the following but the operating system is restarted, the primary database has dropped to node # 2, but is left as it is node number 1 service: rs01 (primary), rs02 (secondary)), rs02 (primary)
From this state, we have restarted the operating system of node # 2. Rs 01 and rs 02 of node # 1 were promoted too primary. rs01, rs02 of node # 2 has been downgraded to secondary. I confirmed it from the log.
However, it could happen that more connections need more than 1 to 2 hours after the operating system is restarted at node # 2. The MongoDB connection pool of the site's server became MAX and no connection to MongoDB was made from the site. Normally the connection is interrupted in at most 30 minutes. I thought that node # 1 worked as a primary, so I thought it would work normally, but I do not know why the connection will not be disconnected for long.
If you encounter similar events, please let me know if anyone knows the solution or workaround.
The version of MongoDB is "MongoDB 3.0.12". The MongoDB-connected application is built with .net c # and runs on Windows Server 2012 R2. TCP Keepalive remains the default. Also when connecting application socketOptions.keepAlive nothing has changed. The connectionString of the application also does not set the option as follows.