使用 mlab、Meteor 并部署到 Galaxy:接收错误"not authorized on"数据库"to execute command"



使用mlab,使用Meteor并部署到Galaxy,我收到错误"not authorized on <DB> to execute command"

当我不小心删除了用于登录的数据库用户时,此错误就开始了。我重新创建了用户。我确保我的帐户用户具有相同的用户名和密码。数据库用户具有以下凭据:

{
"_id": "db.username",
"user": "username",
"db": "password",
"roles": [
{
"role": "dbOwner",
"db": "db"
}
]
}

我的设置 url 未更改:

mongodb://username:password@ds115758.mlab.com:15758/db

我做错了什么?这让我发疯:(

错误:

Exception in setInterval callback: MongoError: not authorized on db to execute command { delete: "meteor_oauth_pendingRequestTokens", ordered: true, $db: "db" }

联系support@mlab.com。他们非常乐于助人,帮助我调试和修复我的问题。

如果有帮助,持续的身份验证问题是由于我的 Galaxy 应用程序在删除数据库用户后未关闭和重新打开连接。我在下面包含了一些显示此行为的日志消息:

2018-10-22T05:00:00.798-0700 I COMMAND  [conn616856] command db.dbname command: insert { insert: "dbname", ordered: true, $db: "db" } ninserted:1 keysInserted:1 numYields:0 reslen:229 locks:{ Global: { acquireCount: { r: 2, w: 2 } }, MMAPV1Journal: { acquireCount: { w: 2 }, acquireWaitCount: { w: 1 }, timeAcquiringMicros: { w: 46 } }, Database: { acquireCount: { w: 2 } }, Collection: { acquireCount: { W: 1 } }, Metadata: { acquireCount: { W: 1 } }, oplog: { acquireCount: { W: 1 } } } protocol:op_query 182ms
2018-10-22T23:15:34.155-0700 I ACCESS   [conn616856] Removed deleted user dbusername@db from session cache of user information.
2018-10-22T23:15:34.155-0700 I ACCESS   [conn616856] Unauthorized: not authorized on db to execute command { find: "meteor_accounts_loginServiceConfiguration", filter: {}, projection: { secret: 0 }, $db: "db" }

从昨天删除用户开始:

2018-10-22T05:00:00.798-0700 I COMMAND  [conn616856] command db.dbname command: insert { insert: "dbname", ordered: true, $db: "db" } ninserted:1 keysInserted:1 numYields:0 reslen:229 locks:{ Global: { acquireCount: { r: 2, w: 2 } }, MMAPV1Journal: { acquireCount: { w: 2 }, acquireWaitCount: { w: 1 }, timeAcquiringMicros: { w: 46 } }, Database: { acquireCount: { w: 2 } }, Collection: { acquireCount: { W: 1 } }, Metadata: { acquireCount: { W: 1 } }, oplog: { acquireCount: { W: 1 } } } protocol:op_query 182ms
2018-10-22T23:15:34.155-0700 I ACCESS   [conn616856] Removed deleted user dbusername@db from session cache of user information.
2018-10-22T23:15:34.155-0700 I ACCESS   [conn616856] Unauthorized: not authorized on db to execute command { find: "meteor_accounts_loginServiceConfiguration", filter: {}, projection: { secret: 0 }, $db: "db" }

从今天开始;请注意未授权的消息如何具有相同的线程 ID (conn616856(:

2018-10-23T09:24:54.778-0700 I ACCESS   [conn616856] Unauthorized: not authorized on db to execute command { delete: "meteor_oauth_pendingCredentials", ordered: true, $db: "db" }
2018-10-23T09:27:54.785-0700 I ACCESS   [conn616856] Unauthorized: not authorized on db to execute command { delete: "meteor_oauth_pendingCredentials", ordered: true, $db: "db" }
2018-10-23T09:30:54.794-0700 I ACCESS   [conn616856] Unauthorized: not authorized on db to execute command { delete: "meteor_oauth_pendingCredentials", ordered: true, $db: "db" }

删除数据库用户时,所有现有连接都失去了已删除的权限。这些连接要么需要重新进行身份验证,要么需要创建新的经过身份验证的连接。

我尝试关闭连接并让它重新启动,它似乎工作得更好。

登齐尔

相关内容

最新更新