redis-migrate-tool镜像制作使用

tech2023-06-27  126

一、使用流程:

1.下载镜像文件:   链接:https://pan.baidu.com/s/1W_hmloKFF2dXkUiTWeowgA 提取码:0mxs 2.将文件上传虚拟机上,通过docker加载镜像   docker load -i redis-migrate-tool.tar   docker images查看是否存在redis-migrate-tool的镜像 3.启动镜像: docker run -d -it [imageId]   进入容器:docker exec -it [containerId] /bin/bash   进入之后进入到目录/opt/redis-migrate-tool/ 4.修改配置文件,配置文件说明看[配置文件说明] 5.执行迁移命令/opt/redis-migrate-tool-master/src/redis-migrate-tool -c /opt/redis-migrate-tool-master/migrate.conf -o log

二、配置文件说明:

完整文档下载: https://pan.baidu.com/s/1UjTbrgoUIA49rClG86BSYw   提取码:agkn

type类型可以为: redis cluster/singleton/aof file/rdb file

Migrate data from a redis cluster to another redis cluster with key filter(key's prefix is "abc").

[source] type: redis cluster servers: - 127.0.0.1:8379 [target] type: redis cluster servers: - 127.0.0.1:7379 [common] listen: 0.0.0.0:8888 filter: abc*

Load data from aof file to redis cluster.  

[source] type: aof file servers: - /data/redis/appendonly1.aof - /data/redis/appendonly2.aof [target] type: redis cluster servers: - 127.0.0.1:7379 [common] listen: 0.0.0.0:8888 step: 2

三、portainer管理平台添加stack模板部署模式(如果只是简单使用上述步骤已经可以满足了)

docker-compose.yml

version: "3.7" services: redis-migrate-tool: environment: - SOURCE_TYPE=${SOURCE_TYPE:-""} - SOURCE_IP_PORT=${SOURCE_IP_PORT:-""} - SOURCE_IF_PWD=${SOURCE_IF_PWD:-} - SOURCE_PWD=${SOURCE_PWD:-""} - TARGET_TYPE=${TARGET_TYPE:-""} - TARGET_IP_PORT=${TARGET_IP_PORT:-""} - TARGET_IF_PWD=${TARGET_IF_PWD:-} - TARGET_PWD=${TARGET_PWD:-""} - USE_FILTER=${USE_FILTER:-} - CPU=${CPU:-4} - MBUF_SIZE=${MBUF_SIZE:-512} - STEP=${STEP:-1} - FILTER=${FILTER:-.*} image: redis-migrate-tool:0.2.0 working_dir: /opt/redis-migrate-tool-master/ stdin_open: true volumes: - conf:/opt/redis-migrate-tool-master/ - /etc/localtime:/etc/localtime deploy: resources: limits: cpus: ${CPU:-4} memory: ${MEM:-8G} restart_policy: condition: none replicas: 1 placement: constraints: - node.ip==${IP} volumes: conf:

环境变量

添加完上述所有文件之后可以在portainer中一键启动,很方便 

最新回复(0)