You can use the ssdb-port tool to migrate data from SSDB to ApsaraDB for Redis.
How it works
As an SSDB replica node, the ssdb-port tool synchronizes data from the SSDB master node that serves as the source database. Then, the ssdb-port tool parses and 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 migration process.
- If you run a command that is not supported by the ssdb-port tool to modify data in the source SSDB database, the modified data cannot be synchronized to the ApsaraDB for Redis instance. For more information about the SSDB commands that are supported by the ssdb-port tool, see the following list.
- If you need to synchronize more commands, log on to the Connect Platform to propose a suggestion.
Commands supported by the ssdb-port tool
- A Linux-based Elastic Compute Service (ECS) instance is created in the same Virtual Private Cloud (VPC) as the destination ApsaraDB for Redis instance, and can connect to the destination ApsaraDB for Redis instance.
- The version of the source SSDB database is 1.9.2 or later.
- Run the following commands in the ECS instance to download and decompress the ssdb-port.tar.gz
# 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
- Run the following command to modify the configuration file of the ssdb-port tool based
on the example:
The following code shows an example of 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 configuration for replication # You MUST indent the code with the Tab key. # The relative path of this file. The directory must exist. 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 # The maximum synchronization speed. Unit: MB/s. A value of -1 indicates that the speed is not limited. sync_speed: -1 slaveof: # The ID of the master node. This ID takes effect even when the IP address or port number of the master node is changed. # If this parameter is left empty or not specified, the IP address and port number (in the format of IP address:port) will be used. id: svc_1 # The replication type. Valid values: sync and mirror. Default value: sync. type: sync host: localhost # The connection address of the SSDB master node (the source SSDB database). port: 8888 # The port of the SSDB master node (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: # Unit: MB. cache_size: 500 # Unit: MB. write_buffer_size: 64 # Unit: MB/s. compaction_speed: 1000 # Compression flag. Value values: yes and no. compression: yes
- Run the
./ssdb-port-2.17 ssdb_port.confcommand to start synchronization.
- Connect to the ApsaraDB for Redis instance to check whether data synchronization is
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.