连接到数据库时出错:无法连接到 [localhost:27018,localhost:27019,localhost:30000]
Error connecting to database: failed to connect to [localhost:27018,localhost:27019,localhost:30000]
我正在使用如下所示的数据库连接字符串
mongodb://localhost:27018,localhost:27019,localhost:30000/db_name?auto_reconnect=true&poolSize=25&readPreference=secondary&w=1&wtimeout=3000
3 mongodb 实例一次是 运行,但是当我尝试使用 node.js 连接时它无法连接。
错误:
Error connecting to database: failed to connect to
[localhost:27018,localhost:27019,localhost:30000]
遵循 http://mongoosejs.com/docs/connections.html 中的文档...
尝试
mongoose.connect('mongodb://mongosA:27501,mongosB:27501', { mongos: true }, cb);
如果有人遇到同样的问题,我只想回答。
我已将我的 connect-mongo 更新为 ~0.8.0,它对我有用。
谢谢。
我正在使用如下所示的数据库连接字符串
mongodb://localhost:27018,localhost:27019,localhost:30000/db_name?auto_reconnect=true&poolSize=25&readPreference=secondary&w=1&wtimeout=3000
3 mongodb 实例一次是 运行,但是当我尝试使用 node.js 连接时它无法连接。
错误:
Error connecting to database: failed to connect to [localhost:27018,localhost:27019,localhost:30000]
遵循 http://mongoosejs.com/docs/connections.html 中的文档...
尝试
mongoose.connect('mongodb://mongosA:27501,mongosB:27501', { mongos: true }, cb);
如果有人遇到同样的问题,我只想回答。 我已将我的 connect-mongo 更新为 ~0.8.0,它对我有用。
谢谢。