# Backing Up and Restoring HPE Morpheus Enterprise Appliance

HPE Morpheus Enterprise includes built-in tools for backing up managed Instances as well as the appliance itself. Use this guide to configure a location and schedule for backing up your HPE Morpheus Enterprise appliance. This guide also includes steps for restoring or migrating your appliance from the created backup. The steps are the same whether your appliance is deployed in a single node or distributed architecture.

The built-in HPE Morpheus Enterprise appliance backup functionality backs up the MySql data. In addition to the database, it’s advisable to back up your shared storage (at `/var/opt/morpheus/morpheus-ui`) and the morpheus.rb configuration file.

NOTE

The destination HPE Morpheus Enterprise appliance must be running the same version as that which the backup was taken from.

## Create A Backup Job

### About this task

A Backup Job in HPE Morpheus Enterprise holds the schedule timing and retention count for automated backups. If you already have a Job configured, you can move on to the next section. If currently-existing options do not make sense for your backup needs or if none currently exist, create a new execution schedule. See the [execute scheduling](https://support.hpe.com/hpesc/public/docDisplay?docId=sd00008058en_us&docLocale=en_US&page=GUID-46D03C40-2146-434A-B75A-12BBBDB56FF3.html) section of this documentation for additional information on creating these schedules. To begin a new schedule, use the following steps:

### Procedure

1. Navigate to Library > Automation
2. Click on the Execute Scheduling tab
3. Click + ADD
4. Enter schedule timing using `cron` notation
5. Click SAVE

### Results

With the execution schedule created, we can move on to creating the Backup Job itself. A Backup Job includes both the backup retention count and an execution schedule (which we just created).

1. Navigate to Backups > Jobs
2. Click + ADD
3. Name the Job, then configure the retention count and select the correct execution schedule
4. Click SAVE

## Integrate a Bucket or File Share

### About this task

When configuring an HPE Morpheus Enterprise appliance backup, a storage location is selected. If you already have the destination bucket or file share integrated with HPE Morpheus Enterprise, skip to the next section. To integrate a new storage bucket, follow the steps below:

### Procedure

1. Navigate to Infrastructure > Storage
2. Click on the Buckets or File Shares tab depending on your chosen storage type
3. Click + ADD
4. Select the appropriate bucket or file share type
5. Complete the required fields and click SAVE CHANGES

### Results

NOTE

Additional guidance on integrating each of the supported bucket and file share types can be found in [storage](https://support.hpe.com/hpesc/public/api/document/sd00008375en_us/render?page=GUID-034C870E-F6DE-4D0B-950B-23A627D33C65.html) documentation.

## Configuring HPE Morpheus Enterprise Appliance Backup

### About this task

With the groundwork laid in the previous sections, we’re ready to enable and configure HPE Morpheus Enterprise appliance backup.

### Procedure

1. Navigate to Administration > Settings > Backups
2. Slide the switch labeled “Backup Appliance”
3. Click SAVE

### Results

On saving this change, a text link labeled “Backup” will be activated which will take you directly to the automatically-generated appliance backup job. Click this link to continue.

1. Click the EDIT button
2. Enter a name for the appliance backup job if you wish to change it from the default
3. Select the appropriate storage bucket or file share
4. Choose a pre-created backup job. If you do not have an existing backup job that fits, a retention count and schedule can be manually created in this modal. If you manually configure retention counts and schedules in addition to associating a Job, the Job values will override any manual settings.
5. Click SAVE CHANGES

At this point, your appliance will be automatically backed up on the schedule you chose and stored in the selected location. An appliance backup will store backup copies of the appliance MySQL database. Should you need to restore or migrate your database from backup, follow the steps in the next section of this guide.

## Restoring the HPE Morpheus Enterprise Manager from Backup

Begin by ensuring the Morpheus UI service is stopped on the HPE Morpheus Enterprise Manager VM. Connect to the manager over SSH from your workstation **bearing in mind that most commands in this process will require sudo or root access.** Enter the following command:

```
```
[root@app-server~] morpheus-ctl stop morpheus-ui
```
```

To access the MySQL shell we will need the password for the Morpheus DB user. We can find this in the morpheus-secrets file. View it like so:

```
```
[root@app-server~] cat /etc/morpheus/morpheus-secrets.json | grep morpheus_password  
"morpheus_password": "451e122cr5d122asw3de5e1b", <---- this one  
"morpheus_password": "9b5vdj4de5awf87d",
```
```

Make note of the first `morpheus_password` value as indicated above.

Copy the SQL database backup from the backup bucket or file share to the destination Manager VM at path `/tmp/morpheus_backup.sql`. Then, you can import the MySQL dump into the target database using the embedded MySQL binaries, specifying the database host, and entering the password for the morpheus user when prompted:

```
```
[root@app-server~] /opt/morpheus/embedded/mysql/bin/mysql -u morpheus -h 127.0.0.1 morpheus -p < /tmp/morpheus_backup.sql  
Enter password:
```
```

The database backup is now replicated on the new Manager VM. Simply start the UI to complete the process:

```
```
[root@app-server~] morpheus-ctl start morpheus-ui
```
```
