kubra ozgoc
kubra ozgoc

Reputation: 45

mongodb cannot drop database when secondary is down

I have a replica set with 1 primary, 1 secondary and 1 arbiter. When I close secondary member, I cannot drop a database. It waits for something. However, if I open secondary member, dropDatabase is okay. What is the reason of this? Can't we drop database without any secondary member?

Upvotes: 3

Views: 537

Answers (1)

Robert Seaman
Robert Seaman

Reputation: 2582

Since MongoDB 3.6, dropDatabase now carries a writeConcern. This is set to majority by default. This means, in a replicaset cluster of 3, at least 2 data-bearing nodes (not arbiters) need to apply the same change.

If you really want, you can force dropDatabase to complete using just one data-bearing node by using a writeConcern of 1. However, this can cause a rollback.

For more information on writeConcern and how to set it, please refer to the docs: https://docs.mongodb.com/manual/reference/write-concern/

Upvotes: 3

Related Questions