蒙戈服务启动或重新启动总是失败
问题描述:
我已经安装了MongoDB的话,我已经创建了一个蒙戈服务:蒙戈服务启动或重新启动总是失败
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
但是当我启动该服务,然后我检查状态,我总是得到这样的错误:
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-04-24 13:08:55 UTC; 6min ago
Process: 1094 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=48)
Main PID: 1094 (code=exited, status=48)
Apr 24 13:08:54 ip-172-31-37-163 systemd[1]: Started High-performance, schema-free document-oriented database.
Apr 24 13:08:55 ip-172-31-37-163 systemd[1]: mongodb.service: Main process exited, code=exited, status=48/n/a
Apr 24 13:08:55 ip-172-31-37-163 systemd[1]: mongodb.service: Unit entered failed state.
Apr 24 13:08:55 ip-172-31-37-163 systemd[1]: mongodb.service: Failed with result 'exit-code'.
答
的问题是在配置文件中,并改变
bindIp: 127.0.0.1, X.X.X.X
到
bindIp: [127.0.0.1, X.X.X.X]
解决了我的问题
答
在MongoDB中3.6 @Chlebta提出的支架并没有为我工作,返回错误:
mongod.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
我的错误是用逗号和空格分隔的IP地址。地址之间必须只有逗号:
bindIp: 127.0.0.1,X.X.X.X,Y.Y.Y.Y
没有大写“P”来绑定IP。即使有这种改正,我仍然陷入困境。 –
是的。拼写错误,谢谢。另外,请查找文件中的选项卡。 conf文件只能用于空格。 –
我会检查一下。我认为问题在于这些IP需要位于同一网络上,我试图允许外部IP访问数据库。 –