Rate This Document
Findability
Accuracy
Completeness
Readability

Manual Packaging

Package source components following the instructions below to prevent data, configuration, and log files outside the installation package from being lost.

The tool cannot automatically migrate Redis installed using an RPM package. Perform a manual migration instead.

Files to Be Migrated

Table 1 Files to be migrated

File Type

Description

Data file

AOF and RDB files

Configuration file

Redis configuration files, such as redis.conf and sentinel.conf

Log file

Redis log file

Procedure

  1. Check whether the files to be migrated are in the specified directories.
    • The redis-server directory structure is bin/redis-server.
    • The redis-server directory structure is redis-xxx/src/redis-server.

    If all files in Table 1 exist in the bin or redis-xxx directory, go to step 6. Otherwise, obtain files outside the bin or redis-xxx directory.

  2. Create a directory named source_related for storing additional files required for migration in the same directory as redis-server, for example, bin/source_related.
    1
    2
    mkdir source_related
    cd source_related
    
  3. To start Redis, you need to specify the configuration file (redis.conf by default). If your configuration file is not in the preceding directory, run the following commands:
    1
    2
    mkdir -p ./path/to/
    cp /path/to/redis.conf ./path/to
    

    /path/to: directory storing redis.conf. Replace it with the actual directory.

  4. Query the data and log file paths.
    1. Open another terminal, start redis-server, and access the redis-cli console. Run the following command to query the data file paths (the default files are dump.rdb and appendonly.aof):
      1
      ./redis-cli -h IP -p port
      
      • IP: Redis IP address.
      • The default port enabled for redis-cli is 6379.
    2. If the requirepass field is set in the configuration file, run the following command to verify the password:
      1
      AUTH password
      
    3. Query the data directory.
      • Obtain dir:
        1
        CONFIG GET dir
        
        Command output:
        1
        2
        1) "dir"
        2) "/home/user"
        
      • Obtain appendfilename.
        1
        CONFIG GET appendfilename
        

        Command output:

        1
        2
        1) "appendfilename"
        2) "appendonly.aof"
        

        If the command output is empty (empty list or set), run the CONFIG GET appendonly command. If yes is returned, search for the appendfilename field in the Redis configuration file specified in step 3. For example, the default value of appendfilename is appendonly.aof.

      • Obtain dbfilename.
        1
        CONFIG GET dbfilename
        
        Command output:
        1
        2
        1) "dbfilename"
        2) "dump.rdb"
        
    4. Query the log file path.
      1
      CONFIG GET logfile
      
      Command output:
      1
      2
      1) "logfile"
      2) "/home/user/redis/redis-4.0.14/redis.log"
      
    5. If the file exists and is not in the preceding directory structures, go back to the previous terminal and run the following command in the source_related directory:
      1
      mkdir -p ./dir_address
      
    6. Copy data files.
      1
      2
      cp /home/user/appendonly.aof ./dir_address
      cp /home/user/dump.rdb ./dir_address
      

      If a message is displayed indicating that a file or directory does not exist, the file does not need to be packaged.

      • /home/user: directory obtained in step 4.c.
      • appendonly.aof: appendfilename obtained in step 4.c.
      • dump.rdb: dbfilename obtained in step 4.c.
    7. Copy log data.
      1
      2
      mkdir -p ./home/user/redis/redis-4.0.14
      cp /home/user/redis/redis-4.0.14/redis.log ./home/user/redis/redis-4.0.14
      

      /home/user/redis/redis-4.0.14/redis.log: log file directory obtained in step 4.d. Replace it with the actual directory.

  5. Create a JSON file named devkit_redis_conf_data.json in the parent directory of redis-server and add the following content to the file. Modify the content as required. If the sentinel mode is used, set is_sentinel_mode to true.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    {
    "redis": {
        "redis_conf": "",
        "redis_conf_in_package": false,
        "redis_dir": "",
        "redis_dir_in_package": false,
        "redis_dbfile": "",
        "redis_aof": "",
        "redis_logfile": "",
        "redis_logfile_in_package": false,
        "redis_pidfile": ""
    },
    "sentinel": {
        "sentinel_conf": "",
        "is_sentinel_mode": false,
        "sentinel_conf_in_package": false,
        "sentinel_dir": ""
    }
    }
    

    Redis configuration:

    • redis_conf: absolute path to the Redis configuration file.
    • redis_conf_in_package: indicates whether the Redis configuration file is in the Redis installation package. The default value is false.
    • redis_dir: absolute path to dir obtained in step 4.c.
    • redis_dir_in_package: indicates whether dir is in the Redis installation package. The default value is false.
    • redis_dbfile: absolute path to dbfilename obtained in step 4.c.
    • redis_aof: absolute path to appendfilename obtained in step 4.c.
    • redis_logfile: absolute path to logfile obtained in step 4.d.
    • redis_logfile_in_package: indicates whether logfile is in the Redis installation package. The default value is false.
    • redis_pidfile: pidfile path in the Redis configuration file. Leave it empty if you do not want to change it.

    Sentinel configuration:

    • sentinel_conf: absolute path to the Redis sentinel configuration file. The default value is sentinel.conf.
    • is_sentinel_mode: indicates whether to enable the sentinel mode. The default value is false. To enable this mode, set it to true.
    • sentinel_conf_in_package: indicates whether the Redis sentinel configuration file is in the Redis installation package. The default value is false.
    • sentinel_dir: absolute path to dir in the Redis sentinel configuration file. Leave it empty if you do not want to change it.
  6. Compress the installation directory of the source components to be scanned into a package, for example, a tar.gz package. Replace the example package name with the actual one.
    1. Run the packaging command in the upper-level directory of the directory where redis-server is located to generate a package, for example, redis.tar.gz.
      • For the bin/redis-server directory structure, go to the upper-level directory of bin and run the following command:
        tar -zcvf redis.tar.gz bin/
      • For the redis-xxx/src/redis-server directory structure, go to the upper-level directory of redis-xxx and run the following command:
        tar -zcvf redis.tar.gz redis-xxx/
    2. Obtain the source components using either of the following methods:
      • If you select the Upload source component package option, return to the Add Component Information tab, and click Upload next to Upload source component package to upload the source component package.
      • If you select the Obtain from node server option, run the following command to decompress the source component package.
        1. Log in to the tool through SSH and upload the package to the user-defined directory on Target Node.
        2. Go to the directory that stores the package.
          1
          cd User-defined_directory
          
        3. Decompress the source component package.
          tar xvf redis.tar.gz
        4. After the decompression is complete, you can run the following command to delete the source component package.
          rm -f redis.tar.gz
        5. Set the path to the decompressed file as the source component path.
  7. After the packaging is complete, delete the source_related directory and devkit_redis_conf_data.json file.