MongoDB转储和还原 [英] MongoDB dump and restore

查看:86
本文介绍了MongoDB转储和还原的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用docker安装了mongo,现在我需要进行 mongodb转储并还原.

I installed the mongo using the docker, Now I need to take the mongodb dump and restore.

1)我在哪里可以下载这两个工具?
2)我不需要安装完整的mongo,因为已经使用docker安装了mongo,我只需要下载这两个mongo工具并使用docker mongo的IP和PORT进行转储和还原.

1) where can I download these two tools?
2) I don't need to install the complete mongo since the mongo is already installed using docker, I just need to download these two mongo tools and use the IP and PORT of docker mongo to dump and restore.

谢谢,
哈里

推荐答案

MongoDB在核心数据库旁边安装此工具,因此您只需在容器内执行命令或在系统中安装 mongod 即可使用您可以使用以下命令获取MongoDB数据:

MongoDB install this tool beside the core database so you can just execute commands inside the container or install mongod in your system and use this you can use below command to get MongoDB data:

docker exec <CONTAINER> sh -c 'exec mongodump --db somedb --gzip --archive' > dump_`date "+%Y-%m-%d"`.gz

此外,您可以在没有mongo core的情况下获得这些实用程序.这是用于alpine-linux的示例软件包: mongodb-tools .对于其他发行版,您可以自己制作: mongodb-tools

also, you can get these utilities without mongo core. here is an example package for alpine-linux: mongodb-tools. and for other distro you can make it yourself: mongodb-tools

这篇关于MongoDB转储和还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆