-->

DEVOPSZONES

  • Recent blogs

    How to Export/Import data from a Redis instance

     The import and export feature uses the native RDB snapshot feature of Redis to import data into or export data out of a Memorystore for Redis instance. The use of the native RDB (Redis Database Backup) format prevents lock-in and makes it very easy to move data within Google Cloud or outside of Google Cloud. Import and export uses Cloud Storage buckets to store RDB files.


    1. For optimal performance, you should import from Cloud Storage buckets located in the same region as your Redis instance.
    2. Your Redis instance is unavailable during an import operation. Your instance becomes available after the import operation finishes.
    3. If an import is successful, the existing data in the instance is overwritten by the data in the RDB file.
    4. If an import fails for any reason, the instance is brought online, but the data may be fully flushed. You can retry the import using the same RDB file, or you may use another RDB file to restore data.
    5. Your Memorystore for Redis instance can import RDB files from the same Redis version and from a previous Redis version, but it cannot import RDB files from a newer version.
    6. An instance can only import backups from older Redis versions. An instance running Redis 5.0 can import an RDB exported from Redis 4.0, but an instance running Redis 4.0 cannot import an RDB from Redis 5.0.
    7. You can read and write data to your Redis instance during an export operation; however, you cannot perform any admin operations like scaling, updating, or configuring your instance.

    Export: 

    Console:

        Go to the Memorystore for Redis page in the Google Cloud console.
    1. Click your instance ID to view the instance details page.

    2. Click the Export button in the top bar.

    3. Click the Browse button and navigate to the Cloud Storage bucket to which you want to export your RDB file.

    4. Use the default export file name, or enter your own file name that includes the.rdb file extension. For example:

      myexport.rdb

    5. Click the Select button.

    6. Click the Export button.

    7. Confirm that you want to export, and click the Export button



    GCLOUD:

    1. Export an RDB file to the Cloud Storage bucket  the following command:
      gcloud redis instances export gs://[BUCKET_NAME]/[FILE_NAME].rdb [INSTANCE_ID] --region=[REGION] --project=[PROJECT_ID]
    Example:

    gcloud redis instances export --project=dev gs://redisbucket-dev/memorystore-dev.rdb dev02 --region=us-central1


    Import:

    Go to the Memorystore for Redis page in the Google Cloud console.

    1. Click your instance ID to view the instance details page.

    2. Click the Import button in the top bar.

    3. Click the Browse button and navigate to the Cloud Storage bucket that stores the RDB file you want to import.

    4. Click the RDB file and then click the Select button.

    5. Click the Import button.

    6. Confirm that you want to import, and click the Import button.


    GCLOUD:

    1. Import the RDB file from the Cloud Storage bucket .

    gcloud redis instances import gs://[BUCKET_NAME]/[FILE_NAME].rdb [INSTANCE_ID] --region=[REGION] --project=[PROJECT_ID]


    Example: 

    gcloud redis instances import --project=dev gs://redisbucket-dev/memorystore-dev.rdb  dev02 --region=us-central1

    To Check the operation id:

    gcloud redis operations list --region=[REGION] -project=[PROJECT]

    No comments