Is there any way to restart MongoDB version 5.0 without rebuilding indexes from scratch?

260 views Asked by At

I have a standalone deployment of MongoDB which runs on MongoDB 5.0. Due to some issue, mongod service crashed which was fixed. But the problem is, mongod service takes forever to restart because it is building all the indexes from scratch. For now, the daemon is running with no issues. But waiting for hours just for restarting the mongo daemon on next crash is not worth it.

Prior to MongoDB v4.4, there was a setting in mongod.conf indexBuildRetry which skipped the index building. Thanks.

1

There are 1 answers

0
贾坤鹏 On

If a node in a replica set is cleanly shutdown or rolls back during an index build, the index build progress is now saved to disk. When the server restarts, index creation resumes from the saved position.

https://docs.mongodb.com/manual/core/index-creation/#std-label-index-operations-build-failure