Oracle by Example brandingBacking Up a MySQL Database to Oracle Cloud Storage Service

section 0Before You Begin

This tutorial shows you how to back up an on-premises MySQL database to Oracle Cloud Storage Service. The tutorial takes approximately 10 minutes to complete.

Background

  • You can use MySQL Enterprise Backup to back up on-premises MySQL databases to Oracle Cloud Storage Service.
    • The mysqlbackup tool includes a number of options specific to cloud backups.
    • Oracle Cloud Storage Service supports only single-file backups.
  • Oracle Storage Cloud Service uses OpenStack Swift for object storage. It authenticates users with Swift's TempAuth system.

What Do You Need?

  • MySQL Enterprise Backup, version 4.1 or later
  • An on-premises MySQL database server
  • An Oracle Public Cloud account with the Oracle Storage Cloud Service activated, together with the following associated information:
    • Data center
    • Identity domain
    • Credentials (username and password) for your account, which you might need to request from your account administrator.

section 3Creating an Oracle Cloud Storage Service Container

A container is a storage compartment that provides a way to organize the data stored in Oracle Storage Cloud Service. If you do not have an existing container you want to use for the backup operation, create one by performing the following steps.

  1. Log in to your Oracle Public Cloud account.
  2. From the Dashboard menu, select Storage Classic.
  3. Select Storage Classic from the Oracle Public Cloud Dashboard menu.
    Description of the image
  4. In the Container List, click the Create Container button.
  5. The Container List. Click the Create Container button to begin creating a new container.
    Description of the image
  6. In the Create Storage Container dialog, enter a unique name for the new container and click Create.
  7. The Create Storage Container dialog box. Enter a name for the new container in the Name field and then click Create.
    Description of the image
  8. The new container appears in the Container List.

section 1Determining the Correct Options for MySQL Enterprise Backup

MySQL Enterprise Backup includes a number of options (cloud-*) specific to cloud backups. In this section, you determine the required options and their values.

  1. --cloud-service. You must set this to openstack for Oracle Cloud Storage Service.
  2. --cloud-container. Specify the name of the container you want to use for the backup in this option.
  3. --cloud-user-id and --cloud-user-password. Supply the user credentials for the Oracle Cloud Storage Service.
  4. --cloud-tempauth-url. The Oracle Cloud Storage Service REST endpoint that validates the user credentials using OpenStack Swift's TempAuth system. For example: https://example.storage.oraclecloud.com.
  5. --cloud-object. The name of the Oracle Cloud Storage Service object for the backup image. This must be unique.
  6. --cloud-ca-info. Absolute path to the CA bundle file that authenticates SSL connections to the host. Oracle cloud services use a certicate signed by Verisign, so you must have the Verisign certificate on your local machine for the process to trust the Oracle Cloud server. The CA bundle on RHEL/Oracle Linux 7 systems is available in the ca-certificates package and, when installed, is available at the following location: /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt. This location might be different for other Linux distributions and operating systems.

    Note: There are two types of certificate authorities (CAs): root CAs and intermediate CAs. The CA must be included in the trusted store of the connecting client for the SSL certificate to be trusted by that client. If the certificate is not issued by a trusted CA, the client then checks to see if the certificate of the issuing CA was issued by a trusted CA and will continue these checks until a trusted CA is found, at which point a secure connection is established. If no trusted CA is found, the operation results in an error. A CA bundle is a file that contains these root and intermediate certificates and typically includes the Verisign certficate.

  7. Optionally, set --cloud-trace=1 to view trace output during the backup operation.

section 2Executing the Backup

  1. Using the arguments you determined in the previous section, execute the mysqlbackup command. For example:
    # mysqlbackup --include-tables=sakila.* \
    > --backup-dir=mybackupdir --backup-image=- backup-to-image -uroot -p \
    > --cloud-service=openstack --cloud-container=MigrateStorage \
    > --cloud-user-id=Storage-example:xxxxx.yyyy@example.com \
    > --cloud-password=xxxxxxxxxx \
    > --cloud-tempauth-url=https://example.storage.oraclecloud.com \
    > --cloud-trace=1 --cloud-object=BackupTutorial.mbi \
    > --cloud-ca-info=/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt
                                      
  2. In the example command shown, sakila, mybackupdir, and MigrateStorage are identifiers:

    • sakila is the name of the database to back up.
    • MigrateStorage is the name of the container in Oracle Storage Cloud Service that will store the backup.
    • mybackupdir is the name of a directory that is created during the backup process, and must not exist prior to the backup.

  3. The backup can take a while to complete. Factors affecting the duration include the speed of your network connection and the size of the database. When the backup operation has finished, you will see the following message in your terminal window: mysqlbackup completed OK!

section 3Viewing the Backup in Oracle Cloud Storage Service

  1. Log in to your Oracle Public Cloud account.
  2. View the Oracle Cloud Storage Service container that you specified in the --cloud-container option. If the backup completed successfully, you will be able to view the resulting .mbi file:
  3. The Oracle Cloud Storage Service page for the container used in the backup operation, showing the resulting backup file.
    Description of the image

    Note: MySQL Enterprise Backup stores the backup as a segmented large object, and might consist of multiple data files together with a manifest file. In this example, there is a single data file (with the extension .mbi_part_1).


more informationWant to Learn More?