Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 320
kubra ozgoc Avatar asked May 24 '26 13:05

kubra ozgoc


1 Answers

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/

like image 56
Robert Seaman Avatar answered May 27 '26 02:05

Robert Seaman