【问题标题】:MongoDB command denied on OpenShiftMongoDB 命令在 OpenShift 上被拒绝
【发布时间】:2014-10-05 02:03:56
【问题描述】:

在 Openshift 上部署简单的 MongoDB 和 Node.js 应用程序时,我收到 503 错误。 http://photoed-sking.rhcloud.com/

MongoDB.log 读取:

note: noprealloc may hurt performance in many applications
Sat Oct  4 21:33:07.177 [initandlisten] MongoDB starting : pid=216116 port=27017 dbpath=/var/lib/openshift/54307ba35973caa3d100078c/mongodb/data/ 64-bit host=ex-std-node240.prod.rhcloud.com
Sat Oct  4 21:33:07.194 [initandlisten] db version v2.4.9
Sat Oct  4 21:33:07.194 [initandlisten] git version: nogitversion
Sat Oct  4 21:33:07.194 [initandlisten] build info: Linux x86-025.build.eng.bos.redhat.com 2.6.32-431.5.1.el6.x86_64 #1 SMP Fri Jan 10 14:46:43 EST 2014 x86_64 BOOST_LIB_VERSION=1_41
Sat Oct  4 21:33:07.194 [initandlisten] allocator: tcmalloc
Sat Oct  4 21:33:07.195 [initandlisten] options: { auth: true, bind_ip: "127.13.135.2", command: [ "run" ], config: "/var/lib/openshift/54307ba35973caa3d100078c/mongodb//conf/mongodb.conf", dbpath: "/var/lib/openshift/54307ba35973caa3d100078c/mongodb/data/", nohttpinterface: "true", noprealloc: "true", pidfilepath: "/var/lib/openshift/54307ba35973caa3d100078c/mongodb/pid/mongodb.pid", quiet: "true", smallfiles: "true" }
Sat Oct  4 21:33:07.301 [initandlisten] journal dir=/var/lib/openshift/54307ba35973caa3d100078c/mongodb/data/journal
Sat Oct  4 21:33:07.301 [initandlisten] recover : no journal files present, no recovery needed
Sat Oct  4 21:33:07.468 [initandlisten] waiting for connections on port 27017
Sat Oct  4 21:33:08.621 [conn1] command denied: { replSetGetStatus: 1.0, forShell: 1.0 }

这里是 mongodb 连接的 server.js 文件的一部分。

https://github.com/steven-king/photoed-server/blob/master/server.js#L12-L28

非常感谢您帮助我解决错误。

【问题讨论】:

    标签: node.js mongodb openshift


    【解决方案1】:

    连接字符串不能以这种方式工作(出于某种原因)。我像这样创建我的连接字符串并且它可以工作:

    https://github.com/thesteve0/fluentwebmap/blob/master/server.js

    我认为你可以忽略第 18 行和第 19 行,但我已经有一段时间没有接触过代码了。

    第 130 - 139 行向您展示了如何进行身份验证。

    【讨论】:

      【解决方案2】:

      尝试运行mongod --repair,然后重新启动您的进程

      【讨论】:

      • 谢谢,数据库没有问题。我刚刚在服务器和数据库之间遇到了连接问题。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-12
      • 2014-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-21
      相关资源
      最近更新 更多