Export data from a database
You can export data to import it into a new database or to make a backup. This article shows how to do so.
You can export the data from a specific database at any time. The following destinations are supported:
- FTP server
- SFTP server
- Amazon AWS S3
- Local mount point
- Azure Blob Storage
- Google Cloud Storage
If you export a database configured for database clustering, export files are created for each shard.
Storage space requirements
Before exporting data, verify that you have enough space available in the storage destination and on the local storage associated with the node hosting the database.
Export is a two-step process: a temporary copy of the data is saved to the local storage of the node and then copied to the storage destination. (The temporary file is removed after the copy operation.)
Export fails when there isn't enough space for either step.
Export database data
To export data from a database using the Cluster Manager UI:
-
On the Databases screen, select the database from the list, then select Configuration.
-
Select Export.
-
Select the tab that corresponds to your storage location type and enter the location details.
See Supported storage locations for more information about each storage location type.
-
Select Export.
Supported storage locations
Data can be exported to a local mount point, transferred to a URI using FTP/SFTP, or stored on cloud provider storage.
When saved to a local mount point or a cloud provider, export locations need to be available to the group and user running Redis Enterprise Software, redislabs:redislabs
by default.
Redis Enterprise Software needs the ability to view permissions and update objects in the storage location. Implementation details vary according to the provider and your configuration. To learn more, consult the provider's documentation.
The following sections provide general guidelines. Because provider features change frequently, use your provider's documentation for the latest info.
FTP server
Before exporting data to an FTP server, verify that:
- Your Redis Enterprise cluster can connect and authenticate to the FTP server.
- The user specified in the FTP server location has permission to read and write files to the server.
To export data to an FTP server, set Path using the following syntax:
[protocol]://[username]:[password]@[host]:[port]/[path]/
Where:
- protocol: the server's protocol, can be either
ftp
orftps
. - username: your username, if needed.
- password: your password, if needed.
- hostname: the hostname or IP address of the server.
- port: the port number of the server, if needed.
- path: the export destination path, if needed.
Example: ftp://username:password@10.1.1.1/home/exports/
Local mount point
Before exporting data to a local mount point, verify that:
- The node can connect to the server hosting the mount point.
- The
redislabs:redislabs
user has permission to read and write files to the local mount point and to the destination server. - The export location has enough disk space for your exported data.
To export to a local mount point:
-
On each node in the cluster, create the mount point:
-
Connect to the node's terminal.
-
Mount the remote storage to a local mount point.
For example:
sudo mount -t nfs 192.168.10.204:/DataVolume/Public /mnt/Public
-
-
In the path for the export location, enter the mount point.
For example:
/mnt/Public
SFTP server
Before exporting data to an SFTP server, make sure that:
-
Your Redis Enterprise cluster can connect and authenticate to the SFTP server.
-
The user specified in the SFTP server location has permission to read and write files to the server.
-
The SSH private keys are specified correctly. You can use the key generated by the cluster or specify a custom key.
To use the cluster auto generated key:
-
Go to Cluster > Security > Certificates.
-
Expand Cluster SSH Public Key.
-
Download or copy the cluster SSH public key to the appropriate location on the SFTP server.
Use the server documentation to determine the appropriate location for the SSH public key.
-
To export data to an SFTP server, enter the SFTP server location in the format:
sftp://[username]:[password]@[host]:[port]/[path]/
Where:
- username: your username, if needed.
- password: your password, if needed.
- hostname: the hostname or IP address of the server.
- port: the port number of the server, if needed.
- path: the export destination path, if needed.
For example: sftp://username:password@10.1.1.1/home/exports/
AWS Simple Storage Service
To export data to an Amazon Web Services (AWS) Simple Storage Service (S3) bucket:
-
Sign in to the AWS console.
-
Create an S3 bucket if you do not already have one.
-
Create an IAM User with permission to add objects to the bucket.
-
Create an access key for that user if you do not already have one.
-
In the Redis Enterprise Software Cluster Manager UI, when you enter the export location details:
-
Select AWS S3.
-
In the Path field, enter the path of your bucket.
-
In the Access key ID field, enter the access key ID.
-
In the Secret access key field, enter the secret access key.
-
You can also connect to a storage service that uses the S3 protocol but is not hosted by Amazon AWS. The storage service must have a valid SSL certificate. To connect to an S3-compatible storage location, run rladmin cluster config
:
rladmin cluster config s3_url <URL>
Replace <URL>
with the hostname or IP address of the S3-compatible storage location.
Google Cloud Storage
To export to a Google Cloud storage bucket:
-
Sign in to the Google Cloud console.
-
Create a JSON service account key if you do not already have one.
-
Create a bucket if you do not already have one.
-
Add a principal to your bucket:
-
In the New principals field, add the
client_email
from the service account key. -
Select "Storage Legacy Bucket Writer" from the Role list.
-
-
In the Redis Enterprise Software Cluster Manager UI, when you enter the export location details:
-
Select Google Cloud Storage.
-
In the Path field, enter the path of your bucket.
-
In the Client ID field, enter the
client_id
from the service account key. -
In the Client Email field, enter the
client_email
from the service account key. -
In the Private Key ID field, enter the
private_key_id
from the service account key. -
In the Private key field, enter the
private_key
from the service account key. Replace\n
with new lines.
-
Azure Blob Storage
To export to Microsoft Azure Blob Storage, sign in to the Azure portal and then:
-
Create an Azure Storage account if you do not already have one.
-
Create a container if you do not already have one.
-
Manage storage account access keys to find the storage account name and account keys.
-
In the Redis Enterprise Software Cluster Manager UI, when you enter the export location details:
-
Select Azure Blob Storage.
-
In the Path field, enter the path of your bucket.
-
In the Account name field, enter your storage account name.
-
In the Account key field, enter the storage account key.
-
To learn more, see Authorizing access to data in Azure Storage.