Skip to content

Instantly share code, notes, and snippets.

@LuisAcerv
Forked from ipedrazas/dump
Created August 9, 2019 03:53
Show Gist options
  • Select an option

  • Save LuisAcerv/6d3d8f794f48b2198115b9b59e7a7ad8 to your computer and use it in GitHub Desktop.

Select an option

Save LuisAcerv/6d3d8f794f48b2198115b9b59e7a7ad8 to your computer and use it in GitHub Desktop.

Revisions

  1. @ipedrazas ipedrazas created this gist Apr 22, 2017.
    10 changes: 10 additions & 0 deletions dump
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # Backup DB
    docker run \
    --rm \
    --link running_mongo:mongo \
    -v /data/mongo/backup:/backup \
    mongo \
    bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’
    # Download the dump
    scp -r USER@REMOTE:/data/mongo/backup ./backup

    10 changes: 10 additions & 0 deletions restore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    # Restore DB
    # upload file
    scp -r ./backup USER@REMOTE:/data/mongo/backup

    docker run \
    --rm \
    --link running_mongo:mongo \
    -v /data/mongodb/backup:/backup \
    mongo \
    bash -c ‘mongorestore /backup --host $MONGO_PORT_27017_TCP_ADDR’