【问题标题】:Remotely dumping mongodb collection远程转储 mongodb 集合
【发布时间】:2019-02-08 13:58:34
【问题描述】:

所以我想转储在另一台服务器上运行的 mongoDB 集合。以下是采取的步骤:
1.在admin中创建用户名和密码

 $ db.createUser(
     {
       user: "username1",
       pwd: "password1",
       roles: [
               { role: "userAdminAnyDatabase", db: "admin" },
               { role: "readWriteAnyDatabase", db: "admin" },
               { role: "dbAdminAnyDatabase", db: "admin" },
               { role: "clusterAdmin", db: "admin" }
            ]
     }
   )

2。然后在mongod.conf(/etc/mongod.conf)bindIp字段中添加数据库服务器的私有ip(x.x.x.x)

bindIp: 127.0.0.1,x.x.x.x

3。然后按如下方式运行 mongodump:

$ mongodump --host x.x.x.x:27017 -d database_name -c collection_name --out path_to_mongoDump -u username1 -p password1 --authenticationDatabase admin

以上将集合转储到指定位置的应用服务器没有任何问题。

上述方法是否安全?或者有没有更好的方法来完成上述操作?

谢谢。

参考链接:
1.What does the --bindip configuration option in mongodb does?
2.How to connect to MongoDB EC2 instance
3.How to secure MongoDB with username and password
4.Mongodump from remote server

【问题讨论】:

    标签: mongodb


    【解决方案1】:

    您应该使用选项--ssl,以便对完整的通信进行加密。如果您忽略该选项,攻击者可能会监听您的通信并从您的数据库中提取数据。

    当您使用此选项时,您应该是安全的,无需采取其他步骤。

    【讨论】:

    • 嗨,如果这真的有帮助,我会很高兴接受。
    • 对不起,伙计..是的,它有帮助:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-21
    • 2012-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多