简体   繁体   中英

Unable to shutdown mongodb server - unexpected error: “shutdownServer failed: unauthorized” at src/mongo/shell/assert.js:7

I am trying to shutdown one of the mongodb instance in a 3 node replica set. The config file has auth set to 1. I have a admin account that has userAdminAnyDatabase role and I logged to admin database with that account. However when I run db.shutdownServer() I get the following error

db.shutdownServer() assert failed : unexpected error: "shutdownServer failed: unauthorized" Error: Printing Stack Trace at printStackTrace (src/mongo/shell/utils.js:37:15) at doassert (src/mongo/shell/assert.js:6:5) at assert (src/mongo/shell/assert.js:14:5) at DB.shutdownServer (src/mongo/shell/db.js:346:9) at (shell):1:4 Mon Jun 23 12:52:51.839 assert failed : unexpected error: "shutdownServer failed: unauthorized" at src/mongo/shell/assert.js:7

I created another user that has both dbAdminAnyDatabase and userAdminAnyDatabase roles and that also gets the same error.

Can someone help me with this error?

If running MongoDB 2.4 a user with the clusterAdmin role is needed to run db.shutdownServer(). A full list of user roles for MongoDB 2.4 is available here: http://docs.mongodb.org/v2.4/reference/user-privileges/

If on MongoDB 2.6 you would use the hostManager role instead. See the following page for 2.6 roles: http://docs.mongodb.org/manual/reference/built-in-roles/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM