In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Whether MongoDB can not log in to the application when building the index, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
Background introduction:
Mongodb version 3.0.2
Indexing and collection and account query collection are on the same server and on different database names.
Because mongodb3.0.2 is used, it is known that 3. 0 is a row-level lock, so dba does not add the parameter background:true when indexing the table.
Check the cause:
The time when a colleague is unable to log in to the application coincides with the time period when the library has an index. So the main investigation is on the index. Later, the problem was confirmed by repeating the problem.
When the main library starts to build indexes, the read and write of the main library is normal. The application can be accessed normally. However, when the main database index is established and Secondary pulls a batch of oplog, when the oplog is replayed from the library, there is a special Lock::ParallelBatchWriterMode lock that blocks all read requests. This explains why the application cannot be accessed a few minutes after indexing.
After that, I consulted the information:
Try to avoid dirty reading and wait for a batch of oplog to be replayed before users are allowed to read the data.
Try to ensure synchronization performance. Imagine that if ordinary locks are used when replaying oplog, then oplog playback needs to compete with normal reads and writes for lock resources. If there are a large number of reads on the Secondary, it is bound to cause backup synchronization to gradually lag behind.
Although version 3. 0 read-write locks do not block the database, do not ignore the impact of the synchronization lock Lock::ParallelBatchWriterMode.
Resolve the problem:
Build an index when the database is as idle as possible
When building an index, it is best to add background:true.
This is the answer to the question about whether MongoDB can not log in to the application when building the index. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.