ssdb-port is a tool that can be used to synchronize data from Sequence Similarity DataBase (SSDB) to ApsaraDB for Redis in real time.

Prerequisites

  • A Linux-based Elastic Compute Service (ECS) instance is created in the Virtual Private Cloud (VPC) network that is connected to the destination ApsaraDB for Redis instance. The ECS instance can connect to the destination ApsaraDB for Redis instance.
  • The version of the source SSDB database is 1.9.2 and later.

Background information

  • Synchronization process

    The source SSDB database acts as the master node in the SSDB cluster, and the ssdb-port tool acts as an SSDB replica node. The source SSDB database synchronizes data to the ssdb-port tool. Then, the ssdb-port tool parses the data, converts the data to the format supported by ApsaraDB for Redis, and sends the data to the ApsaraDB for Redis instance that is specified in the configuration file. The following figure shows the synchronization process.

    Process of using the ssdb-port tool to migrate data from SSDB to ApsaraDB for Redis

    After full synchronization is complete, incremental data in the SSDB database is synchronized to the ApsaraDB for Redis instance before ssdb-port is disconnected from the instance.

    Note
    • If you run a command that is not supported by the ssdb-port tool to update data in the source SSDB database, the updated data cannot be synchronized to the ApsaraDB for Redis instance. The following list shows the SSDB commands supported by the ssdb-port tool.
    • If you want to use more commands, submit a suggestion.
  • Commands supported by the ssdb-port tool
    • set
    • setx
    • setnx
    • expire
    • del
    • get
    • incr
    • qpop_front
    • qpush_front
    • qclear
    • qtrim_front
    • qtrim_back
    • zset
    • zdel
    • zincr
    • multi_zdel
    • multi_zset
    • hset
    • hdel
    • hclear
    • multi_hset
    • multi_hdel
    • hincr

Limits

If you run the hset or hget command and the keys in the destination ApsaraDB for Redis instance are in Chinese, the modified data cannot be synchronized. This limit does not apply to other supported commands.

Procedure

  1. Run the following commands in the ECS instance to download and decompress the ssdb-port.tar.gz package:
    # wget http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/attach/94155/cn_zh/1547627852086/ssdb-port.tar.gz
    # tar -xvf ssdb-port.tar.gz
    # cd ssdb-port
  2. Run the following command to modify the configuration file of the ssdb-port tool based on the example:
    vi ssdb_port.conf
    The following sample code shows the ssdb_port.conf file. Modify the connection information of the source SSDB database and the destination ApsaraDB for Redis instance based on the comments.
    # ssdb-server config for replica
    # MUST indent by TAB!
    
    # relative to path of this file, directory must exists
    work_dir = ./var_ssdb_port
    pidfile = ./var_ssdb_port/ssdb.pid
    
    # The connection information of the ssdb-port tool, which does not need to be modified.
    server:
        ip: 127.0.0.1
        port: 8890
        #readonly: yes
    
    replication:
        binlog: yes
            capacity: 100000000
        # Limit sync speed to *MB/s, -1: no limit
        sync_speed: -1
        slaveof:
            # to identify a master even if it moved(ip, port changed)
            # if set to empty or not defined, ip:port will be used.
            id: svc_1
            # sync|mirror, default is sync
            type: sync
            host: localhost # The connection address of the source SSDB database.
            port: 8888 # The port number of the source SSDB database.
            #auth: password
            redis_host: localhost # The connection address of the destination ApsaraDB for Redis instance.
            redis_port: 6379 # The port number of the destination ApsaraDB for Redis instance.
            redis_auth: password # The password of the destination ApsaraDB for Redis instance.
    
    logger:
        level: debug
        output: log_ssdb_port.txt
        rotate:
            size: 1000000000
    
    leveldb:
        # in MB
        cache_size: 500
        # in MB
        write_buffer_size: 64
        # in MB/s
        compaction_speed: 1000
        # yes|no
        compression: yes
  3. Run the ./ssdb-port-2.17 ssdb_port.conf command to start synchronization.
  4. Connect to the ApsaraDB for Redis instance to check whether data synchronization is complete.
    Note You can use the redis-cli tool or Data Management Service (DMS) to connect to the ApsaraDB for Redis instance. For more information about how to connect to the instance, see Quick Start.