简体   繁体   English

MongoDB转储和还原

[英]MongoDB dump and restore

I installed the mongo using the docker, Now I need to take the mongodb dump and restore . 我使用docker安装了mongo,现在我需要进行mongodb dump和restore

1) where can I download these two tools? 1)我在哪里可以下载这两个工具?
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. 2)我不需要安装完整的mongo,因为已经使用docker安装了mongo,我只需要下载这两个mongo工具并使用docker mongo的IP和PORT进行转储和还原。

Thanks, 谢谢,
Harry 哈利

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

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

also, you can get these utilities without mongo core. 另外,您可以在没有mongo core的情况下获得这些实用程序。 here is an example package for alpine-linux: mongodb-tools . 这是alpine-linux的示例软件包: mongodb-tools and for other distro you can make it yourself: mongodb-tools 对于其他发行版,您可以自己制作: mongodb-tools

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM