Import data into a database
You can import an existing dataset into your Redis Cloud instance from an existing Redis server or an RDB file.
Prerequisites
In preparation, make certain the Redis version of the source database is compatible with the database where the data will be imported.
Import from a Redis server
To import a dataset from any publicly available Redis server:
- Select Databases from the Redis Cloud console menu and then select the target database from the database list.
- In the Danger Zone, select Import.
- Enter the source database details:
- Source type - Select Redis.
- Redis Hostname/IP Address - Enter the hostname or the public IP address of the source Redis server.
- Redis port - Enter the port of the source Redis server if it is not the default value of
6379
. - Password - Enter the password, if required by the source Redis database.
- Select Import.
Restore from an RDB file
If you have an RDB or a compressed RDB file from a previous backup, you can restore data from that file into your Redis Cloud database.
Via FTP or HTTP
To import an RDB file stored on an FTP or HTTP server:
-
Select Databases from the Redis Cloud console menu and then select your database from the list.
-
In the Danger Zone, select Import.
-
Enter the details for the RDB file:
- Source type - Select FTP or HTTP.
- Source path - Enter the URL for the RDB file:
<protocol>://[username][:password]@hostname[:port]/[path/]filename.rdb[.gz]
Where:
protocol
- Server protocol: ftp, ftps, http, httpsusername
- Your username, if necessarypassword
- Your password, if necessaryhostname
- Hostname or IP address of the serverport
- Port number of the server, if not6379
path
- Path to the file, if necessaryfilename
- Filename of the RDB file, including the.gz
suffix if the file is compressed
Note:If your FTP username or password contains special characters such as@
,\
, or:
, you must URL encode (also known as Percent encode) these special characters. If you don't, your database may become stuck. -
For sharded databases with multiple RDB files, select Add source to add another RDB file.
-
Select Import.
Via AWS S3
To use the Redis Cloud console to import your data, you must first share the file from the Amazon Web Services (AWS) management console.
To share and import an RDB file that is stored in an AWS Simple Storage Service (S3) bucket:
-
In the AWS Management Console, configure the bucket's bucket policy to give access to Redis Cloud:
-
Use the Services menu to locate and select Storage > S3. This takes you to the Amazon S3 admin panel.
-
Use the Buckets list to locate and select your bucket. When the settings appear, select the Permissions tab, locate the Bucket policy section, and then click Edit.
-
If there is no existing bucket policy, add the following JSON bucket policy. Replace
UNIQUE-BUCKET-NAME
with the name of your bucket.{ "Version": "2012-10-17", "Id": "MyBucketPolicy", "Statement": [ { "Sid": "RedisCloudBackupsAccess", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::168085023892:root" }, "Action": [ "s3:PutObject", "s3:getObject", "s3:DeleteObject" ], "Resource": "arn:aws:s3:::UNIQUE-BUCKET-NAME/*" } ] }
-
If a bucket policy already exists, add the following JSON policy statement to the list of statements. Replace
UNIQUE-BUCKET-NAME
with the name of your bucket.{ "Sid": "RedisCloudBackupsAccess", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::168085023892:root" }, "Action": [ "s3:PutObject", "s3:getObject", "s3:DeleteObject" ], "Resource": "arn:aws:s3:::UNIQUE-BUCKET-NAME/*" }
-
-
Save your changes.
-
If the bucket is encrypted using SSE-KMS, add the following statement to your key policy. If you do not have a key policy, see Creating a key policy. Replace
UNIQUE-BUCKET-NAME
with the name of your bucket andCUSTOM-KEY-ARN
with your key's Amazon Resource Name (ARN).{ "Sid": "Allow use of the key", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::168085023892:root" }, "Action": [ "kms:Encrypt", "kms:Decrypt", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:DescribeKey" ], "Resource": [ "arn:aws:s3:::UNIQUE-BUCKET-NAME/*", "CUSTOM-KEY-ARN" ] }
-
-
In the Redis Cloud console, select the target database from the database list.
-
In the Danger Zone, select Import.
-
Enter the details for the RDB file:
-
Source type - Select AWS S3.
-
Source path - Enter the URL for the RDB file:
s3://bucketname/[path/]filename.rdb[.gz]
Where:
bucketname
- Name of the S3 bucketpath
- Path to the file, if necessaryfilename
- Filename of the RDB file, including the .gz suffix if the file is compressed
-
-
For sharded databases with multiple RDB files, select Add source to add another RDB file.
-
Select Import.
Via Google Cloud Storage
To use the Redis Cloud console to import your data, you must first share the file from the Google Cloud console.
To share and import an RDB file that is stored in a Google Cloud Storage bucket:
-
In the Google Cloud Storage bucket, edit the file's Access Control List to give read access to Redis Cloud:
- Select Edit access in the RDB file menu.
- Select Add item.
- Enter the user details and access:
- In the Entity field of the new item, select User.
- In the Name field of the new item, enter:
[email protected]
- In the Access field of the new item, select Reader.
- Select Save.
For more info, see Set ACLs.
-
In the Redis Cloud console, select the target database from the database list.
-
In the Danger Zone, select Import.
-
Enter the details for the RDB file:
-
Source type - Select Google Cloud Storage.
-
Source path - Enter the URL for the RDB file:
gs://bucketname/[path/]filename.rdb[.gz]
Where:
bucketname
- Name of the GCS bucketpath
- Path to the filefilename
- Filename of the RDB file, including the .gz suffix if the file is compressed
-
-
For sharded databases with multiple RDB files, select Add source to add another RDB file.
-
Select Import.
Via Azure Blob Storage container
To import an RDB file stored in a Microsoft Azure Blog storage container:
-
In the Redis Cloud console, select the target database from the database list.
-
In the Danger Zone, select Import.
-
Enter the details for the RDB file:
-
Source type - Select Azure Blob Storage.
-
Source path - Enter the URL for the RDB file:
abs://:storage_account_access_key@storage_account_name/[container/]filename.rdb[.gz]
Where:
storage_account_access_key
- Primary access key to the storage accountstorage_account_name
- Name of the storage accounturl
- URL of the storage accountcontainer
- Name of the container, if necessaryfilename
- Filename of the RDB file, including the .gz suffix if the file is compressed
-
-
For sharded databases with multiple RDB files, select Add source to add another RDB file.
-
Select Import.