docker mongo data backup and restore

 #export

docker exec -i fe81a51232d0 mongodump -u 'admin' -p '1QAZ2wsx' --authenticationDatabase admin -d t_collections --archive > /tmp/dump.archive

fe81a51232d0: mongo image instance id

admin: database user name

-p : database password

-d t_collections : database name

dump-collections.archive: the name of the export

#reduction

docker exec -i <IMAGE_NAME> mongorestore --archive <  ./dump.archive

Guess you like

Origin blog.csdn.net/qq_30381077/article/details/129490908