0

I am building a system that outputs information such as visit information and page transition of the user who visited the website to MongoDB, The MongoDB connection pool of the server of the web site became MAX and it ceased to MongoDB from the web 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)

※Originally the following state is set, but OS is restarted, primary has dropped to node # 2, but it is left as it is node#1 service:rs01(primary)、rs02(secondary) node#2 service:rs01(secondary)、rs02(primary)

From this state, we restarted the OS of node # 2. rs 01 and rs 02 of node # 1 were promoted to primary. rs01, rs02 of node # 2 demoted to secondary.I confirmed it from the log.

However, it happened that more connections would take more than 1 to 2 hours from OS reboot on node # 2 to expire. And the MongoDB connection pool of the server of the web site became MAX and it became not connected to MongoDB from the web site. Normally it will be out of connection in about 30 minutes at the longest. I thought that node # 1 works as Primary, so I thought it would work normally, but I do not know why the connection is not disconnected for a long time.

If you encounter similar events, please let me know if anyone knows the solution or workaround.

appendix The version of MongoDB is "MongoDB 3.0.12". The application connected to MongoDB is built with .net c # and is running on Windows Server 2012 R2. TCP Keepalive remains the default setting. Also when connecting from application socketOptions.keepAlive has not changed. The connectionString of the application also does not set the option as follows.

  • Welcome to the site.What is MongoDB version(x,y,z) & their connecting language. – Md Haidar Ali Khan Nov 15 '18 at 11:53
  • Thanks for your reply. I use mongoDB server vsersion is 3.0.12 and client is C#.Net Client. I use client as DLL that is MongoDB.Driver.dll (version 1.10.0.62). . – Kato Tetsuya Nov 15 '18 at 23:02
0

From this state, we restarted the OS of node # 2. rs 01 and rs 02 of node # 1 were promoted to primary. rs01, rs02 of node # 2 demoted to secondary.I confirmed it from the log.

However, it happened that more connections would take more than 1 to 2 hours from OS reboot on node # 2 to expire. And the MongoDB connection pool of the server of the web site became MAX and it became not connected to MongoDB from the web site. Normally it will be out of connection in about 30 minutes at the longest. I thought that node # 1 works as Primary, so I thought it would work normally, but I do not know why the connection is not disconnected for a long time.

As per MongoDB documentation here The priority settings of replica set members affect both the timing and the outcome of elections for primary. Higher-priority members are more likely to call elections, and are more likely to win. Use this setting to ensure that some members are more likely to become primary and that others can never become primary.

The value of the member’s priority setting determines the member’s priority in elections. The higher the number, the higher the priority.

Note: As you said that the version 3.0, this version of the manual is no longer supported. Learn more about upgrading your version of MongoDB.

For further your ref here and here

| improve this answer | |
  • Thank you for your reply. I understand that priority affects the outcome of elections and the speed of elections. However, the problem that I am facing is that the connection from the connection pool of the client's Web server will not be disconnected for a long time just after elections. Why is the connection no longer disconnected? Is it possible to solve the problem by adjusting the connection string of the Web application? Can you solve the problem with mongos server settings? I will be saved if you receive wisdom. – Kato Tetsuya Nov 19 '18 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.