Indexing not working in new mongo-cluster

Hi all,

I recently spinned-up mongo-cluster of 3 nodes (now 2, due to limited RAM) and imported data into the cluster via tool called mongorestore, from a mongo-dump of around 6GB maybe.

After importing the data, i noticed that no indexes are restored which were there in previous DB. I repeated the same process again and again but didn’t help.

I then tried to create index myself via mongo-compass but it gets just stuck at the command and slows loading… even when process gets completed, it slows “failed” label in front of index.

Can you please share some methods to investigate further into the issue or any possible reason why this would happen?

Thanks in advance.

Error when create new index from “index” tag of specific collection

I also tried to create index via mongo-shell but it doesn’t work either.

Hi @karan_sharma3

If you have stopped 1 member of the replica set the index will not be maked as usable until it is restored and the index build completes on that member. This is because the default commitQuorum for an index build is votingMembers.

Alternatively the optional parameter commitQuorum can be provided to create an index when all the replica set members are not healthy.

example:

db.animations.createIndex({ status: 1}, {}, "majority"})

refs:
https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndex/#std-label-createIndex-method-commitQuorum

edit: correct format

2 Likes

Thanks, let me look into that and get back to you.