2018-07-26 07:37:30 +00:00
|
|
|
.. include:: /_includes/all.rst
|
2019-03-07 15:35:54 +00:00
|
|
|
.. include:: /_includes/snippets/__ANNOUNCEMENTS__.rst
|
2018-07-26 07:37:30 +00:00
|
|
|
|
2018-04-03 12:59:17 +00:00
|
|
|
.. _backup_and_restore_mongo:
|
|
|
|
|
|
|
|
**************************
|
|
|
|
Backup and restore MongoDB
|
|
|
|
**************************
|
|
|
|
|
|
|
|
Backup and restore will be necessary when you are going to switch MongoDB versions.
|
|
|
|
Each version has its own data directory and is fully indepentend of other versions.
|
|
|
|
In case you want to switch to a different version, but still want to have your MongoDB databases
|
|
|
|
present, you must first backup the databases of your current version and import them into the
|
|
|
|
new version.
|
|
|
|
|
|
|
|
There are multiple ways to backup and restore. Chose the one which is most convenient for you.
|
|
|
|
|
|
|
|
|
|
|
|
**Table of Contents**
|
|
|
|
|
|
|
|
.. contents:: :local:
|
|
|
|
|
|
|
|
|
|
|
|
Backup
|
|
|
|
======
|
|
|
|
|
|
|
|
mongodump
|
|
|
|
---------
|
|
|
|
|
2018-07-26 07:37:30 +00:00
|
|
|
|ext_lnk_tool_mongodump| is bundled with each PHP container and reay to use.
|
|
|
|
To backup all databases follow the below listed example:
|
2018-04-03 12:59:17 +00:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Navigate to the Devilbox directory
|
|
|
|
host> cd path/to/devilbox
|
2018-04-03 12:59:17 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Enter the PHP container
|
|
|
|
host> ./shell.sh
|
2018-04-03 12:59:17 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Run mongodump
|
|
|
|
devilbox@php-7.1.6 in /shared/httpd $ mongodump --out /shared/backups/mongo
|
2018-04-03 12:59:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
Restore
|
|
|
|
=======
|
|
|
|
|
|
|
|
mongorestore
|
|
|
|
------------
|
|
|
|
|
2018-07-26 07:37:30 +00:00
|
|
|
|ext_lnk_tool_mongorestore| is bundled with each PHP container and ready to use.
|
|
|
|
To restore all MongoDB databases follow the below listed example:
|
2018-04-03 12:59:17 +00:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Navigate to the Devilbox directory
|
|
|
|
host> cd path/to/devilbox
|
2018-04-03 12:59:17 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Enter the PHP container
|
|
|
|
host> ./shell.sh
|
2018-04-03 12:59:17 +00:00
|
|
|
|
2018-06-03 18:45:01 +00:00
|
|
|
# Start the restore/import from /shared/backups/mongo
|
|
|
|
devilbox@php-7.1.6 in /shared/httpd $ mongorestore /shared/backups/mongo
|