codis迁移数据

codis官方文档

https://github.com/CodisLabs/codis/blob/master/doc/tutorial_zh.md

 

1、阿里开源工具:Codis/Redis集群版通过redis-shake迁移上云

https://help.aliyun.com/document_detail/125941.html?spm=5176.2020520141.0.0.308c6375KXAK0c

2、官方工具:https://github.com/CodisLabs/redis-port

   华为云示例:使用Redis-cli和Redis-port工具迁移自建Codis集群

  https://support.huaweicloud.com/migration-dcs/dcs-migrate-demo01.html

#!/bin/bash

source_redis_address=(
172.18.11.1
172.18.11.2
172.18.11.3
172.18.11.4
172.18.11.5
)

source_redis_port='6379'
source_redis_password='passwd'

for i in ${source_redis_address[@]}
do
  echo "[$i]"
  /opt/codis/bin/redis-cli -h $i -p ${source_redis_port} -a ${source_redis_password} --rdb ${i}.rdb
  if [ $? -ne 0 ];then
    echo "redis-cli rdb failed!"
    exit 1
  else
    echo "redis-cli rdb successed."
  fi

  /opt/soft/redis-port-v2.0-beta-go1.10.1-linux/redis-restore -n 4 -i ${i}.rdb -t  {new_redis_passwd}@{new_redis_host}:{new_redis_port}   
  if [ $? -ne 0 ];then
    echo "redis-restore failed!"
    exit 1
  else
    echo "redis-restore successed."
  fi
done

echo "Finished"

 

posted @ 2023-03-01 15:29  Justtosee  阅读(38)  评论(0编辑  收藏  举报