[SERVER-18753] Problems shutting down single node RS with auth Created: 30/May/15  Updated: 09/Feb/20  Resolved: 30/May/15

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 3.0.3
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Ronan Bohan Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Operating System: ALL
Steps To Reproduce:

mlaunch --replicaset --nodes 1 --auth
mongo admin -u user -p password --eval "db.shutdownServer()"

Participants:

 Description   

I started a single node replica set with auth enabled for testing. It doesn't want to shutdown claiming no electable secondaries are available:

$ mongo admin -u user -p password --eval "db.shutdownServer()"
MongoDB shell version: 3.0.3
connecting to: 127.0.0.1:27017/admin
assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-30T17:57:32.163+0100
Error: assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-30T17:57:32.163+0100
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at assert (src/mongo/shell/assert.js:20:5)
    at DB.shutdownServer (src/mongo/shell/db.js:212:9)
    at (shell eval):1:4
2015-05-30T17:57:32.166+0100 E QUERY    Error: assert failed : unexpected error: Error: shutdownServer failed: No electable secondaries caught up as of 2015-05-30T17:57:32.163+0100
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at assert (src/mongo/shell/assert.js:20:5)
    at DB.shutdownServer (src/mongo/shell/db.js:212:9)
    at (shell eval):1:4 at src/mongo/shell/assert.js:13



 Comments   
Comment by Andy Schwerin [ 30/May/15 ]

This is the designed behavior. If you do not specify the "force" parameter to the shutdown command, you cannot shut down a replica set primary unless another electable node exists. The documentation is here.

Interestingly, you can shut down a secondary even if doing so will force the primary to step down from lack of majority without passing the "force" argument.

Long story short, use "force" to shut down stand-alone replica set nodes.

Generated at Thu Feb 08 03:48:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.