我在 Elastic Beanstalk (Flask) 应用程序上使用通过 mLab 托管、通过 mongoengine 连接的 MongoDB 数据库。
我是这样连接的:
mongoengine.connect(db='my-database', host ='mongodb:/user:password@xxx.mlab.com')
但是,当 Elastic Beanstalk 第一次自动缩放我的应用程序时,我开始收到以下错误消息:
OperationFailure: Another user is already authenticated to this database.
You must logout first.
我认为这是因为同一个用户在应用程序自动扩展时多次尝试对同一个数据库进行身份验证?如果是这样,解决方案是什么?我应该以不同的方式连接到数据库吗?