javascript - 无法连接到我在 AWS 上运行的 Mongo 服务器。节点进程未启动,但 Mongod 日志看起来不错
问题描述
当我启动我的 mongod 服务器时,它运行得非常好。我打开了所有连接来尝试解决这个问题,所以不要介意警告。当我尝试运行我的节点进程时,它通过其公共 IP 连接到我的服务器(我有那个设置,所以我也可以从家里连接到我的数据库)。但是,我的节点进程实际上从未启动,但 mongo 服务器显示
[conn1] received client metadata from Censored IP: 46534 conn1: {
driver: {
name: "nodejs",
version: "3.1.10"
},
os: {
type: "Linux",
name: "linux",
architecture: "x64",
version: "4.15.0-1031-aws"
},
platform: "Node.js v11.4.0, LE, mongodb-core: 3.1.9"
}
我的mongo配置是:
# for documentation of all options, see: #http: //docs.mongodb.org/manual/reference/configuration-options/
#Where and how to store data.
storage:
dbPath: /var/lib / mongodb
journal:
enabled: true# engine: #mmapv1: #wiredTiger:
#where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log / mongodb / mongod.log
# network interfaces
net:
port: 27017
bindIp: ::, 0.0 .0 .0# bindIpAll: true# how the process runs
processManagement:
timeZoneInfo: /usr/share / zoneinfo
# security: #authorization: enabled# operationProfiling:
#replication:
#sharding:
##Enterprise - Only Options:
#auditLog:
#snmp:
我使用mongoose连接,之前只遇到过一次,暂时修复了,但不知道为什么我的node进程连接不上mongod服务器并正常启动。蒙古日志:
2019 - 01 - 09 T16: 35: 59.390 + 0000 I STORAGE[initandlisten] WiredTiger message[1547051759: 390412][3431: 0x7f79c7a83a40], txn - recover: Recovering log 25 through 26
2019 - 01 - 09 T16: 35: 59.442 + 0000 I STORAGE[initandlisten] WiredTiger message[1547051759: 442748][3431: 0x7f79c7a83a40], txn - recover: Recovering log 26 through 26
2019 - 01 - 09 T16: 35: 59.486 + 0000 I STORAGE[initandlisten] WiredTiger message[1547051759: 486445][3431: 0x7f79c7a83a40], txn - recover: Set global recovery timestamp: 0
2019 - 01 - 09 T16: 35: 59.530 + 0000 I RECOVERY[initandlisten] WiredTiger recoveryTimestamp.Ts: Timestamp(0, 0)
2019 - 01 - 09 T16: 35: 59.547 + 0000 I CONTROL[initandlisten]
2019 - 01 - 09 T16: 35: 59.547 + 0000 I CONTROL[initandlisten] ** WARNING: Access control is not enabled
for the database.
2019 - 01 - 09 T16: 35: 59.547 + 0000 I CONTROL[initandlisten] ** Read and write access to data and configuration is unrestricted.
2019 - 01 - 09 T16: 35: 59.547 + 0000 I CONTROL[initandlisten]
2019 - 01 - 09 T16: 35: 59.584 + 0000 I FTDC[initandlisten] Initializing full - time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
2019 - 01 - 09 T16: 35: 59.585 + 0000 I NETWORK[initandlisten] waiting
for connections on port 27017
2019 - 01 - 09 T16: 36: 10.088 + 0000 I NETWORK[listener] connection accepted from Censored IP: 46534 #1 (1 connection now open)
2019-01-09T16:36:10.095+0000 I NETWORK [conn1] received client metadata from Censored IP:46534 conn1: { driver: { name: "nodejs", version: "3.1.10" }, os: { type: "Linux", name: "linux", architecture: "x64", version: "4.15.0-1031-aws" }, platform: "Node.js v11.4.0, LE, mongodb-core: 3.1.9" }
如果有人知道出了什么问题,请告诉我!
const mongoose = require('mongoose')
mongoose.connect(process.env.MONGO_URL, {
useNewUrlParser: true
})
我的 .env 是:
MONGO_URL=mongodb://censoredip:27017/theseus
解决方案
我解决了我的问题!我四处试验,发现它与 Mongo 无关。我实际上没有执行任何操作,并且某个功能一定已经消失或被意外删除。很抱歉给您带来麻烦,感谢拉维!
推荐阅读
- javascript - 如何为 HTML 表格设置固定的行数?
- asp.net - 自动检测 ASP.NET MVC 捆绑中的缩小失败
- javascript - 从firestore查询的文档中获取用户信息?
- wix - Wix 引导程序卸载另一个应用程序需要的依赖项
- angular - 如何使用 Angular Material 从复选框组创建表单字段?
- ios - 如何在 Cordova iOS 应用程序中请求位置权限时更改警报文本?
- c++ - QIntValidator 在有效输入中返回中间值
- kubernetes-ingress - 如何在斜杠内和不带斜杠的情况下重写目标上下文路径?
- f# - 此表达式应具有“obj”类型,但此处具有“字符串”类型
- c# - 在快速增长的 SQL Server 数据库表中搜索最新数据