我正在尝试在不同的主机上安装和配置rocketchat和mongodb。一个用于应用程序,另一个用于mongodb。我遵循这个教程https://rocket.chat/docs/installation/manual-installation/ubuntu/
我分别完成了每个部分的所有步骤(mongodb和rocketchat)
当我运行main.js命令时:MONGO_URL=mongodb://<mongodb-ip-host>:27017/rocketchat?replicaSet=rs01 MONGO_OPLOG_URL=mongodb://<mongodb-ip-host>:27017/local?replicaSet=rs01 ROOT_URL=http://0.0.0.0:3000 PORT=3000 node /var/Rocket.Chat/main.js
我得到这个错误如下:
throw(ex);
^
MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16) {
name: 'MongoNetworkError',
errorLabels: [Array],
[Symbol(mongoErrorContextSymbol)]: {}
}]
at Pool.<anonymous> (/var/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/topologies/server.js:431:11)
at Pool.emit (events.js:311:20)
at /var/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:557:14
at /var/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connect.js:39:11
at callback (/var/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connect.js:261:5)
at Socket.<anonymous> (/var/Rocket.Chat/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connect.js:286:7)
at Object.onceWrapper (events.js:418:26)
at Socket.emit (events.js:311:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
name: 'MongoNetworkError',
errorLabels: [ 'TransientTransactionError' ],
[Symbol(mongoErrorContextSymbol)]: {}
}
PS.:我把RocketChat设置在/var/Rocket.chat文件夹下
我想了解为什么应用程序某些部分试图在mongodb中进行本地连接:127.0.0.1:27017
1条答案
按热度按时间u3r8eeie1#
我认为问题出在您的mongodb服务器的副本集中。它被错误地配置了127.0.0.1mongodb服务器的www.example.com IP地址。
您可以在mongodb服务器的shell中获得此命令。
mongo
或mongosh
取决于您的mongodb版本。我在这里使用mongo
,但您可能需要使用mongosh
mongojs
rs.conf()
函数调用的结果应该类似于以下内容:请注意,副本集的主机配置为
127.0.0.1:27017
这可以通过在副本集所在的mongo服务器上的mongo shell中执行以下命令来修复。
您可以在此处阅读更多信息:
https://github.com/RocketChat/Rocket.Chat/issues/26519