gpt4 book ai didi

编辑 mongo.conf 后 MongoDB 状态失败(代码退出,状态=2)

转载 作者:行者123 更新时间:2023-12-04 14:29:48 24 4
gpt4 key购买 nike

我正在尝试使用 Robo 3T 远程连接到我的 Google 云服务器也可以连接 MongoDB v4.0.11只是为了让我可以看到来自 Windows 的数据。

我正在运行 Ubuntu 18.04LTS Minimal。为了启用到 MongoDB 的远程连接,我首先在我的 admin 数据库中创建了一个管理用户和 root 用户。

我的问题是一旦我添加 authorization: "enabled"security:/etc/mongod.conf并重新启动 MongoDB,我在运行 $:systemctl status mongod 时得到以下状态

● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-08-06 16:43:51 BST; 1min 20s ago
Docs: https://docs.mongodb.org/manual
Process: 6517 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=2)
Main PID: 6517 (code=exited, status=2)

Aug 06 16:43:51 instance-1 systemd[1]: Started MongoDB Database Server.
Aug 06 16:43:51 instance-1 mongod[6517]: Unrecognized option: processManagement.authorization
Aug 06 16:43:51 instance-1 mongod[6517]: try '/usr/bin/mongod --help' for more information
Aug 06 16:43:51 instance-1 systemd[1]: mongod.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Aug 06 16:43:51 instance-1 systemd[1]: mongod.service: Failed with result 'exit-code'.
/etc/mongod.conf 的示例
# mongod.conf
# 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: 127.0.0.1

# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo

#security:
authorization: "enabled"
#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:
/etc/mongod.conf 中似乎存在无效参数但从我在网上阅读的内容来看,我看不出问题所在。

最佳答案

错误的:

#security:
authorization: "enabled"

正确的:
security:
authorization: enabled

关于编辑 mongo.conf 后 MongoDB 状态失败(代码退出,状态=2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57380491/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com