X

MySQL and MySQL Community information

  • February 2, 2016

MySQL Enterprise Backup (MEB) and Oracle Storage Cloud

Guest Author

MEB 3.12.0 and above support
cloud backup and restore using OpenStack-compatible object stores
("Swift"). This allows MySQL database users with Oracle
Storage Cloud account to take backups and store them directly in the
cloud and restore them from there.

The
following steps illustrate how to set up and use MEB with Oracle
Storage Cloud :

1)
Create Oracle Storage Cloud account at
https://cloud.oracle.com/storage . Once
service gets activated, make a note of the following credentials that
will be required in further
steps :

  • Username

  • Password

  • Identity

    domain name

  • Service

    Instance Name : Customer-specified name of the service instance

  • Data

    Center Code : The identifier of the data center in which the service

    instance is provisioned. For example, dataCenterCode is us2 for the

    data center US Commercial 2 in Chicago and em2 for EMEA Commercial 2

    in Amsterdam.

2)
Create a container where the backup images (objects) will be stored.
A container is a user-created resource, 
which
can hold an unlimited number of objects but cannot be nested. To
create container, we use çURL :

  • Oracle

    Storage Cloud Service requires authentication when executing

    operations against the service instance. Generate an Authorization

    Token that allows creation, deletion, and listing of containers.

    Get
    the Auth-Token
    :

         çurl
-v -X GET -H 'X-Storage-User:
<serviceInstanceName>-<identityDomainName>:\

    <userName>' -H
'X-Storage-Pass: <Password>' \  

    https://<dataCenterCode>.storage.oraclecloud.com/auth/v1.0

         The
"Auth-Token" generated expires in 30 minutes.

  • Create

    a container with a name of one's choice that is not already in use

    in the service instance. 
    The “container name” can be from 1 to 256 characters long and must consist of alphanumeric characters.

    To list existing container(s) :

    çurl -v -s -X GET -H 'X-Auth-Token: <Generated_Auth_Token>' \

    https://<dataCenterCode>.storage.oraclecloud.com/v1/<serviceInstanceName>-\

    <identityDomainName>

    To
    create a new container
    :

    çurl -v -X PUT -s -H 'X-Auth-Token: <Generated_Auth_Token>' \

    https://<dataCenterCode>.storage.oraclecloud.com/v1/<serviceInstanceName>-\

    <identityDomainName>/<container_name>

3)
The setup is complete and MEB operations on images can now be
performed with Oracle Storage Cloud. For example :

  • Take

    backup to cloud :

    mysqlbackup -uroot
--socket=/tmp/mysql.sock --cloud-service=openstack \

    --cloud-container=<container_name>
--cloud-object=<backup_image_name> \

    --cloud-user-id=<serviceInstanceName>-<identityDomainName>:<userName> \

    --cloud-password=<Password>
\

    --cloud-tempauth-url=https://<dataCenterCode>.storage.oraclecloud.com
\

    --backup-dir=/home/user/temp_dir
--backup-image=- backup-to-image


  • Extract

    from cloud backup :

    mysqlbackup
--cloud-service=openstack --cloud-container=<container_name> \

    --cloud-object=<backup_image_name>
\

    --cloud-user-id=<serviceInstanceName>-<identityDomainName>:<userName> \

    --cloud-password=<Password>
\

    --cloud-tempauth-url=https://<dataCenterCode>.storage.oraclecloud.com
\

    --backup-dir=/home/user/bkp_dir
--backup-image=- image-to-backup-dir


  • Restore

    from cloud backup :

    mysqlbackup
--defaults-file=/home/user/bkp_dir/backup-my.cnf \

    --cloud-service=openstack --cloud-container=<container_name> \

    --cloud-object=<backup_image_name> \

    --cloud-user-id=<serviceInstanceName>-<identityDomainName>:<userName> \

    --cloud-password=<Password>
\

    --cloud-tempauth-url=https://<dataCenterCode>.storage.oraclecloud.com
\

    --backup-dir=/home/user/tmp_dir
--backup-image=- --datadir=/home/user/db/datadir  \

    copy-back-and-apply-log


All
MEB operations that can be performed with cloud storage are listed
here :

Backup
of MySQL 5.5 and 5.6 to Cloud with MEB 3.12

Backup
of MySQL 5.7 to Cloud with MEB 4.0

4)
Objects or containers can be removed as follows :

  • Delete

    an object in a container :

          çurl
-v -X DELETE -H "X-Auth-Token: <Generated_Auth_Token>"
\

    https://<dataCenterCode>.storage.oraclecloud.com/v1/<serviceInstanceName>-\

    <identityDomainName>/<container_name>/<object_name>


  • Delete

    a container :

         çurl
-v -X DELETE -H "X-Auth-Token: <Generated_Auth_Token>"
\

    https://<dataCenterCode>.storage.oraclecloud.com/v1/<serviceInstanceName>-\

    <identityDomainName>/<container_name>


Figure
: Sequence Diagram for Backup to Oracle Storage Cloud

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.