.. _restore-a-backup:

Restore the backup
------------------

.. index:: backup;backup list
.. index:: backup;backup import
.. index:: backup;backup restore
.. index:: backup;backup passphrase

.. _19.2.1|VOSS-497:


A complete list of backups on a location can be displayed using **backup list <location>**.
To restore on a new system, run the **backup passphrase**
command and enter password used to create the backup.

1. Copy the backup to the environment with **scp**. It will be located in 
   the ``media/`` folder.
2. Once the file is successfully copied, use the **backup import** command 
   to import the backup to a location that was set up, or the default ``localbackup``.
3. Once the import is complete, run the **backup list** command as for example:
   ::   

      platform@Restore:~$ backup list
      localbackup:
          URI: file:///backups
          Backups:
             2019-08-13 13:08
       	
4. Run the **backup restore** command as for example:

   .. important::

      * Backups should be created and restored in a ``tmux`` session - see: :ref:`tmux-command`.
      * When restoring a backup on a cluster, the latest backup from the highest weighted secondary
        database server must be used to ensure the entire cluster (excluding the web certificates)
        including the database is restored and the cluster is automatically provisioned as part of
        the restore.

   ::
      
      platform@Restore:~$  backup restore localbackup 2019-08-13 13:08
      Services will be restarted during the restore. Do you wish to continue? y
      Check if restore can continue (step 1/4)
      Enough space on /opt/platform/apps/mongodb/dbroot: total 93MB / 224GB
      Enough space on /backups/appdata: free 934MB / 232GB
      Running pre-restore scripts (step 2/4)
      Stopping Application while performing database restore
      Running backup restore (step 3/4)
      System restore starting from \
        file:///backups/058bccead2588a6f11f1dd86678bab68de48691d (1565701713)
      Local and Remote metadata are synchronized, no sync needed.
      Last full backup date: Tue Aug 13 13:08:33 2019
      /backups/appdata/
      completed
      Running post-restore scripts (step 4/4)
      Starting Application after performing database restore
      Restarting services
      
      Application processes stopped.
      
      Reconfiguring applications....

      If this includes a database restore, it may take some time to sync
      Please run 'database config' to check when all nodes are done
      
      Restored successfully
      You have new mail in /var/mail/platform


.. |VOSS Automate| replace:: VOSS Automate
.. |Unified CM| replace:: Unified CM
