且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何连接到 MongoDB EC2 实例

更新时间:2022-06-27 10:05:12

正如 frisky 所说,您必须在 EC2 安全组控制台上打开端口 27017.(要了解有关如何执行此操作的更多信息:http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html)

As frisky said, you have to open the port 27017 at the EC2 Security Group Console. (To know more about how to do that: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html)

但您还需要更改/etc/mongodb.conf 文件中的 bind_ip 变量.您需要注释该行或分配能够将数据库连接到它的 IP.

But you also need to change the bind_ip variable at the /etc/mongodb.conf file. You need to comment the line or assign the ip that will be able to connect the DB to it.