【问题标题】:how to start mongodb on remote server EC2?如何在远程服务器 EC2 上启动 mongodb?
【发布时间】:2014-10-31 16:33:03
【问题描述】:

我是 mongodb 的新手。我已经用 wamp 服务器将它安装在我的电脑上,它工作正常。现在我正在尝试远程连接 EC2。 我已经通过 this 。但仍然无法连接。

这里是代码

[ec2-user@ip-162-31-45-45 ~]$ mongod
mongod --help for help and startup options
2014-09-07T06:07:44.158+0000 [initandlisten] MongoDB starting : pid=27743 port=27017 dbpath=/data/db 64-bit host=ip-172-31-45-55
2014-09-07T06:07:44.158+0000 [initandlisten] db version v2.6.4
2014-09-07T06:07:44.158+0000 [initandlisten] git version:  xxxxx
2014-09-07T06:07:44.158+0000 [initandlisten] build info:  xxxxx
2014-09-07T06:07:44.158+0000 [initandlisten] allocator: tcmalloc
2014-09-07T06:07:44.158+0000 [initandlisten] options: {}
2014-09-07T06:07:44.163+0000 [initandlisten] journal dir=/data/db/journal
2014-09-07T06:07:44.163+0000 [initandlisten] recover : no journal files present, no recovery needed
2014-09-07T06:07:44.331+0000 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2014-09-07T06:07:44.331+0000 [initandlisten] ERROR:   addr already in use
2014-09-07T06:07:44.331+0000 [initandlisten] now exiting
2014-09-07T06:07:44.331+0000 [initandlisten] dbexit:
2014-09-07T06:07:44.331+0000 [initandlisten] shutdown: going to close listening sockets...
2014-09-07T06:07:44.331+0000 [initandlisten] shutdown: going to flush diaglog...
2014-09-07T06:07:44.332+0000 [initandlisten] shutdown: going to close sockets...
2014-09-07T06:07:44.332+0000 [initandlisten] shutdown: waiting for fs preallocator...
2014-09-07T06:07:44.332+0000 [initandlisten] shutdown: lock for final commit...
2014-09-07T06:07:44.332+0000 [initandlisten] shutdown: final commit...
2014-09-07T06:07:44.340+0000 [initandlisten] shutdown: closing all files...
2014-09-07T06:07:44.340+0000 [initandlisten] closeAllFiles() finished
2014-09-07T06:07:44.340+0000 [initandlisten] journalCleanup...
2014-09-07T06:07:44.340+0000 [initandlisten] removeJournalFiles
2014-09-07T06:07:44.344+0000 [initandlisten] shutdown: removing fs lock...
2014-09-07T06:07:44.344+0000 [initandlisten] dbexit: really exiting now



[ec2-user@ip-162-31-45-45 ~]$ sudo service mongod start
Starting mongod:                                           [FAILED]

如何解决?

【问题讨论】:

    标签: mongodb amazon-ec2


    【解决方案1】:

    通过从This 安装所有这些解决了我的问题。

    【讨论】:

      【解决方案2】:

      错误表明该地址已被使用。您确定它尚未运行吗?

      【讨论】:

      • 感谢您的回答。如何知道它是否正在运行。我无法从浏览器运行
      • 只需在服务器上运行 mongo 命令 - 它应该连接到本地服务器。
      • 是的,$ mongo MongoDB shell 版本:2.6.4 连接到:test > 但是为什么无法从浏览器运行
      • 好的,太好了,所以它开始了,这是你最初的问题。现在我们需要弄清楚为什么你不能远程连接。首先,您的安全组设置是否允许访问?其次,mongodb是绑定到所有网络接口,还是只绑定localhost?
      • 我在 /var/www/html ec2-xxx.us-west-2.compute.amazonaws.com 下复制了我的代码。但我能够运行正常的 html/php。我无法在此下运行 mongodb
      猜你喜欢
      • 2014-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-26
      • 2013-01-17
      • 1970-01-01
      • 2021-06-10
      相关资源
      最近更新 更多