连接MongoLab数据库的方式是否有变化?

时间:2015-10-26 11:28:30

标签: python mongodb ibm-cloud mlab

我有一个绑定了MongoDB实例的Bluemix应用程序。该应用已运行了大约一年。大约一个星期前,我的应用程序崩溃了,我无法重新部署它。我在日志中看到以下内容:

 Instance (index 0) failed to start accepting connections
App instance exited with guid f13c5665-7753-4451-b766-b0879b3726fd payload: {"cc_partition"=>"default", "droplet"=>"f13c5665-7753-4451-b766-b0879b3726fd", "version"=>"1c5aeea8-2718-48ff-9d89-211148391cc8", "instance"=>"5673b51557b3457f8b3e365639fe7f6f", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1445263465}
App instance exited with guid f13c5665-7753-4451-b766-b0879b3726fd payload: {"cc_partition"=>"default", "droplet"=>"f13c5665-7753-4451-b766-b0879b3726fd", "version"=>"1c5aeea8-2718-48ff-9d89-211148391cc8", "instance"=>"5673b51557b3457f8b3e365639fe7f6f", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1445263465}
Starting app instance (index 0) with guid f13c5665-7753-4451-b766-b0879b3726fd
App instance exited with guid f13c5665-7753-4451-b766-b0879b3726fd payload: {"cc_partition"=>"default", "droplet"=>"f13c5665-7753-4451-b766-b0879b3726fd", "version"=>"1c5aeea8-2718-48ff-9d89-211148391cc8", "instance"=>"5673b51557b3457f8b3e365639fe7f6f", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1445263465}
Starting app instance (index 0) with guid f13c5665-7753-4451-b766-b0879b3726fd
Traceback (most recent call last):
File "wsgi.py", line 65, in <module>
 client = pymongo.Connection(mongo_url)
File "/app/.heroku/python/lib/python2.7/site-packages/pymongo/connection.py", line 220, in __init__
max_pool_size, document_class, tz_aware, _connect, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/pymongo/mongo_client.py", line 369, in __init__raise ConfigurationError(str(exc))
pymongo.errors.ConfigurationError: command SON([('authenticate', 1), ('user', u'removingForPrivacy'), ('nonce', u'removingForPrivacy'), ('key', u'removingForPrivacy')]) failed: auth failed

我的代码位于google documentation的项目中。连接到MongoLab实例的方式有变化吗?为什么我会收到身份验证错误?

1 个答案:

答案 0 :(得分:4)

我通过MongoLab支持发了电子邮件。他们回答说:

  

我们的免费Sandbox数据库最近通过了预定版本   升级事件描述于:

     

http://docs.mongolab.com/20150930-maintenance-event/

     

在过去的几天里,我们发送了几份有关此计划维护的通知   个月。

     

此Sandbox数据库现在运行MongoDB 3.0.x,其中包括   更改MongoDB的身份验证机制。这个新机制是   某些较新的驱动程序版本支持,如下所述   http://docs.mongodb.org/manual/release-notes/3.0-scram/#upgrade-drivers

     

为了让您的应用程序连接到此数据库,您将会   需要使用上面链接中列出的其中一个驱动程序。

他们为我的应用提出了以下建议,并修复了问题:

  

您必须将“mongo-python-driver-master”文件夹更新为   更新版本的python驱动程序。你可以下载驱动程序   在这里:https://github.com/mongodb/mongo-python-driver/releases。 ID   建议使用版本2.9或3.0.3。