Updated on 2024-11-29 GMT+08:00

Backing Up Redis Data

Scenario

Back up service data stored in the Redis cluster to a specified directory as an MRS cluster administrator in case of system faults during major operations such as cluster reinstallation, upgrade, and scale-out.

Prerequisites

  • The Redis cluster and instances are running properly.
  • If the installation mode of the Redis service is the security mode, the Redis client can access the Redis cluster and perform operations only after login authentication and authorization. You need to perform the following operations:
    1. Log in to FusionInsight Manager and choose System > Permission > Role to create a role that has the permission to manage the specified Redis cluster. For details, see Creating a Redis Role.
    2. Choose System > Permission > User, create a machine-machine user, and assign the role permissions created in 1 to the role.
    3. After the user is created successfully, click More > Download authentication credential next to the username in the user list to download the keytab file. After the file is automatically generated, specify the location to save the file.
    4. Decompress the keytab file, and upload the decompressed file to the Software installation path/FusionInsight_HD_xxx/install/FusionInsight-redis-xxx/redis/config directory on the target Redis node as user omm.

      xxx indicates the version number. Replace it with the actual version number.

    5. In the Software installation path/FusionInsight_HD_xxx/install/FusionInsight-redis-xxx/redis/config/auth.conf file, change the value of userName to Username@Cluster domain name, change the value of realmsName to the current domain name, change the value of keyTabFile to the absolute path of the uploaded user.keytab file, and change the value of krbConfPath to the absolute path of the uploaded krb5.conf file.

Procedure

  1. Log in to any Redis node as user root.
  2. Run the following command to open the Redis backup configuration file aof-backup.properties, set related parameters based on the description in Table 1, save the settings, and exit:

    vi ${BIGDATA_HOME}/FusionInsight_HD_xxx/install/FusionInsight-redis-xxx/redis/config/aof-backup.properties

    Table 1 Parameters to be modified for backing up Redis cluster data

    Parameter

    Parameter Description

    Example Value

    redis.server.mode

    Redis operating modes, which include the following options:

    • single
    • cluster
    NOTE:

    The current version supports data backup and restoration only in Redis cluster mode.

    cluster

    redis.server.address

    Redis instance IP address (management plane) and port number.

    You can set this parameter to the IP address and port number of any Redis instance or the IP addresses and port numbers of multiple Redis instances in the Redis cluster to be backed up, and use commas (,) to separate multiple pairs of IP address and port number.

    • The IP address of the Redis instance is the IP address of the node where the Redis instance is located.
    • The formula for calculating the port number of the Redis instance is: 22400 + Instance ID - 1.

      To view the instance ID, choose Cluster > Name of the desired cluster > Service > Redis > Redis Manager on FusionInsight Manager and click the target Redis cluster name.

      For example, in the Redis cluster, the port number of the Redis instance that corresponds to the role R1 port is 22400 (22400 + 1-1 =22400).

    192.168.0.1:22400

    192.168.0.100:22400,192.168.0.101:22401

    client.read.timeout

    Client read/write timeout interval, in milliseconds. You are advised to use the default value.

    10000

    backup.path

    Directory for storing backup files. The directory must be created in advance.

    NOTE:

    If the directory contains previous backup Redis data files, move them to another directory. Otherwise, the previous backup files are overwritten after the backup.

    /opt/arch/cluster1

    redis_ssl_on

    Whether to enable SSL channel encryption. The value must be the same as that configured on FusionInsight Manager.

    • true
    • false
    NOTE:

    Log in to FusionInsight Manager and choose Cluster > Services > Redis. Click Configuration then All Configurations and search for redis_ssl_on to view the value.

    false

  3. Run the following commands in the backup directory to ensure that the omm user has the operation permission:

    chmod 744 Outermost path for backup files -R

    chown omm:wheel Outermost path for backup files -R

  4. Run the su - omm command to switch to user omm.
  5. Go to the ${BIGDATA_HOME}/FusionInsight_HD_xxx/install/FusionInsight-redis-xxx/redis/sbin directory and run the redis-backup.sh script.

    cd ${BIGDATA_HOME}/FusionInsight_HD_xxx/install/FusionInsight-redis-xxx/redis/sbin/

    ./redis-backup.sh

    The system backs up the data of all Redis instances in the Redis cluster to the target path. After the backup is successful, the following information is displayed:

    Backup successful.

  6. Check the data files in the backup path and move them to a reliable location for future restoration.