连接到在AWS上运行的Mongo Server时出现问题。节点进程未启动,但是Mongod日志看起来不错

时间:2019-01-09 16:45:52

标签: javascript node.js mongodb

当我启动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进行连接,并且以前只遇到过一次此问题,并已临时修复,但不确定为什么我的节点进程将无法连接到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

1 个答案:

答案 0 :(得分:0)

我已解决问题!我经过试验,发现它与Mongo无关。我实际上没有执行任何操作,并且某个功能必须已经消失或被意外删除。抱歉给您带来麻烦,谢谢拉维!