如何在EC2实例上配置MongoDb

时间:2019-07-18 14:55:51

标签: linux mongodb amazon-web-services amazon-ec2

我是AWS和Linux的新手,正在尝试在AWS EC2实例上配置mongodb。我已成功安装它并创建了用户。现在,我正在尝试配置bindIp,以便可以从我的IP访问它。

所有步骤我都遵循https://medium.com/@calvin.hsieh/steps-to-install-mongodb-on-aws-ec2-instance-62db66981218

在更改mongod.conf文件后,我无法重新启动mongo。请帮助我。我被困住了。任何帮助或建议,将不胜感激。预先感谢

当我尝试重新启动mongo Service时,出现以下错误:

sudo service mongod restart
Restarting mongod (via systemctl):  Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.


[ec2-user@ip-172-31-8-187 ~]$ sudo systemctl status mongod.service -l
● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
   Loaded: loaded (/etc/rc.d/init.d/mongod; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2019-07-17 15:06:51 UTC; 15h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 13202 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, status=0/SUCCESS)
  Process: 13581 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)

Jul 17 15:06:51 ip-172-31-8-187.ap-south-1.compute.internal systemd[1]: Starting SYSV: Mongo is a scalable, document-oriented database....
Jul 17 15:06:51 ip-172-31-8-187.ap-south-1.compute.internal runuser[13592]: pam_unix(runuser:session): session opened for user mongod by (uid=0)
Jul 17 15:06:51 ip-172-31-8-187.ap-south-1.compute.internal mongod[13581]: Starting mongod: [FAILED]
Jul 17 15:06:51 ip-172-31-8-187.ap-south-1.compute.internal systemd[1]: mongod.service: control process exited, code=exited status=1
Jul 17 15:06:51 ip-172-31-8-187.ap-south-1.compute.internal systemd[1]: Failed to start SYSV: Mongo is a scalable, document-oriented database..
Jul 17 15:06:51 ip-172-31-8-187.ap-south-1.compute.internal systemd[1]: Unit mongod.service entered failed state.
Jul 17 15:06:51 ip-172-31-8-187.ap-south-1.compute.internal systemd[1]: mongod.service failed.

*****我的mongo.d.conf文件********

ndIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.


# for documentation of all options, see:
   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /var/lib/mongo
  journal:
    enabled: true
  engine:
  mmapv1:
  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
  timeZoneInfo: /usr/share/zoneinfo

# network interfaces
net:
  port: 27017
#  bindIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.


security:
 authorization: enabled
#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:
~
~
~
~
~
~
~
~
~
~
~
~
~

0 个答案:

没有答案