将mlab与Meteor一起使用,并部署到Galaxy:收到错误“未授权” DB“执行命令”

时间:2018-10-23 09:06:22

标签: database meteor authorization mlab galaxy

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

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

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

我的设置网址未更改:

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" }

1 个答案:

答案 0 :(得分:0)

访问 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" }

在删除数据库用户时,所有现有连接都失去了权限”。这些连接要么需要重新认证,要么需要创建新的认证连接。

我尝试关闭我的连接,然后重新开始连接,看来效果更好。

Denzil