Creating and restoring database backups
  • 29 Jan 2021
  • 3 Minutes To Read
  • Print
  • Share
  • Dark
    Light

Creating and restoring database backups

  • Print
  • Share
  • Dark
    Light

This document describes how to create and restore database backups in Spryker Cloud Commerce OS (SCCOS).

As all the data is stored in relational databases, you only need database(DB) backups. DB backups are managed via Amazon Relational Database Service (Amazon RDS).

The following DB backups are created automatically:

  1. AWS daily snapshots with a default retention of 5 days.

  2. Transaction log backups via AWS Point-in-time recovery.

  3. Hourly snapshots by SCCOS tools with a default retention of 60 hours.

Also, you can create DB snapshots manually.

Creating a DB snapshot

To create a DB snapshot:

  1. In the AWS Management Console, go to Services > RDS.

  2. In the navigation pane, select Databases.

  3. In the Databases pane, select the DB you want to take a snapshot of.

  4. Select ActionsTake snapshot.

    This opens the Take DB snapshot page.

  5. Enter a Snapshot name.

Meaningful Snapshot name

Ensure that you enter a meaningful Snapshot name. It is used as an identifier when restoring a DB.

  1. Select Take snapshot.

This opens the Snapshots page. The created snapshot is displayed in the Manual snapshots pane.

Restoring a database

To restore a DB from a snapshot, follow the steps below.

Expected downtime

During database restoration, your application is not accessible. For production environments, we recommend setting up a maintenance page. To do that, provide your custom HTML page or request to set up a generic one via support.

1. Rename a DB

To rename a DB:

  1. In the AWS Management Console, go to Services > RDS.

  2. In the navigation pane, select Databases.

  3. In the Databases pane, select the DB you want to rename.

  4. Select Modify.
    This takes you to the Modify DB instance: {DB name} page.

  5. In the Settings pane, update the DB instance identifier.

  6. Scroll down the page and select Continue.

  7. In the Scheduling of modifications pane:

  • To apply the changes immediately, select Immediately. This can cause an outage in some cases. For more information, see  Modifying an Amazon RDS DB Instance.

  • To apply the changes during the next scheduled maintenance window of the DB, select During the next scheduled maintenance window. In this case, you have to wait for the database to be renamed before you can restore it from a snapshot.

  1. Review your changes and select Modify DB Instance.
    This takes you to the Databases page with the success message displayed.

Even if you selected to apply the change immediately, it may take a few minutes to update the DB name.

2. Restore a DB from a snapshot

To restore a DB from a snapshot:

  1. In the AWS Management Console, go to Services > RDS.

  2. In the navigation pane, select Snapshots.

  3. Select the snapshot you want to restore.

  4. Select Actions > Restore snapshot.
    This takes you to the Restore snapshot page.

  5. Enter the settings of the original DB.

DB settings

Ensure that:

  • DB instance identifier corresponds to the name of the original DB before you renamed it.

  • The settings exactly replicate those of the original DB. Otherwise, the DB may fail to restore correctly or work with the application.

  1. Select Restore DB Instance.
    This takes you to the Databases page with the success message displayed. The entry of the restored DB is displayed in the list.

It may take a few minutes for the DB to restore.

3. Re-sync data from the restored database

To re-sync data from a restored database to ElasticSearch and Redis:

  1. Connect to OpenVPN.

  2. Open Jenkins web interface at http://jenkins.{environment_hostname}.

  3. Select New Item.

  4. For Enter an item name, enter a job name.

  5. Select Freestyle project.

  6. Select OK.

  7. In the Build section, select Add build step > Execute shell.

  8. In the Execute shell pane, for Command, enter the script with the vendor/bin/console sync:data command. You can add the command to the script from another Jenkins job in your environment.

  9. Select Save.

Set up a jenkins job

  1. On the page that opens, select Build Now.
    Give it a few minutes to execute the job. You can track the execution in the Build History pane.

You’ve re-synced data from a restored database to ElasticSearch and Redis.

Restoring an application

Application restoration is part of a regular deployment workflow. See Rolling back an application to learn about restoring a previous version of an application.

Next step

Was This Article Helpful?