首页 > 数据库 >redis 数据迁移到集群

redis 数据迁移到集群

时间:2024-12-25 18:19:28浏览次数:4  
标签:OK redis 192.168 集群 26379 174.108 迁移 Migrating

关闭 protected-mode

/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.108 config set protected-mode no
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.112 config set protected-mode no
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.114 config set protected-mode no
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.115 config set protected-mode no
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.116 config set protected-mode no
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.117 config set protected-mode no
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.118 config set protected-mode no

取消所有节点密码

/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.108 config set requirepass ''
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.112 config set requirepass ''
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.114 config set requirepass ''
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.115 config set requirepass ''
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.116 config set requirepass ''
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.117 config set requirepass ''
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.118 config set requirepass ''

导入数据

/usr/local/redis/bin/redis-cli  --cluster import 192.168.174.108:26379 --cluster-from 192.168.174.118:26379 --cluster-copy --cluster-replace
>>> Importing data from 192.168.174.118:26379 to cluster 192.168.174.108:26379
>>> Performing Cluster Check (using node 192.168.174.108:26379)
M: 2c2f409a5893ed9c6087d705126f8df80a746841 192.168.174.108:26379
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
M: 53eadf87db7fd4efa4a14924eb80178f6e92c5e5 192.168.174.114:26379
   slots:[8191],[10923-16383] (5462 slots) master
   1 additional replica(s)
M: 1538d933904b5093bfb92f4ef8df33d218cee3a8 192.168.174.112:26379
   slots:[5461-8190],[8192-10922] (5461 slots) master
   1 additional replica(s)
S: c95a6697886121a6743e50d41a84512e496bc663 192.168.174.115:26379
   slots: (0 slots) slave
   replicates 53eadf87db7fd4efa4a14924eb80178f6e92c5e5
S: c807ec73ea369b4dd88f9a6e16cd3abb8b01732b 192.168.174.116:26379
   slots: (0 slots) slave
   replicates 2c2f409a5893ed9c6087d705126f8df80a746841
S: 4fdec8f3a6f42aee6c892fb175335c746da7f749 192.168.174.117:26379
   slots: (0 slots) slave
   replicates 1538d933904b5093bfb92f4ef8df33d218cee3a8
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
*** Importing 100 keys from DB 0
Migrating testkey84 to 192.168.174.108:26379: OK
Migrating testkey68 to 192.168.174.112:26379: OK
Migrating testkey11 to 192.168.174.114:26379: OK
Migrating testkey96 to 192.168.174.108:26379: OK
Migrating testkey5 to 192.168.174.108:26379: OK
Migrating testkey42 to 192.168.174.112:26379: OK
Migrating testkey76 to 192.168.174.114:26379: OK
Migrating testkey32 to 192.168.174.114:26379: OK
Migrating testkey10 to 192.168.174.114:26379: OK
Migrating testkey3 to 192.168.174.112:26379: OK
Migrating testkey41 to 192.168.174.108:26379: OK
Migrating testkey51 to 192.168.174.112:26379: OK
Migrating testkey99 to 192.168.174.112:26379: OK
Migrating testkey24 to 192.168.174.114:26379: OK
Migrating testkey20 to 192.168.174.114:26379: OK
Migrating testkey25 to 192.168.174.114:26379: OK
Migrating testkey73 to 192.168.174.112:26379: OK
Migrating testkey30 to 192.168.174.112:26379: OK
Migrating testkey49 to 192.168.174.112:26379: OK
Migrating testkey58 to 192.168.174.114:26379: OK
Migrating testkey78 to 192.168.174.108:26379: OK
Migrating testkey19 to 192.168.174.112:26379: OK
Migrating testkey2 to 192.168.174.114:26379: OK
Migrating testkey97 to 192.168.174.108:26379: OK
Migrating testkey45 to 192.168.174.108:26379: OK
Migrating testkey66 to 192.168.174.108:26379: OK
Migrating testkey40 to 192.168.174.108:26379: OK
Migrating testkey27 to 192.168.174.112:26379: OK
Migrating testkey60 to 192.168.174.112:26379: OK
Migrating testkey82 to 192.168.174.112:26379: OK
Migrating testkey18 to 192.168.174.114:26379: OK
Migrating testkey57 to 192.168.174.108:26379: OK
Migrating testkey91 to 192.168.174.112:26379: OK
Migrating testkey86 to 192.168.174.112:26379: OK
Migrating testkey37 to 192.168.174.114:26379: OK
Migrating testkey64 to 192.168.174.112:26379: OK
Migrating testkey85 to 192.168.174.108:26379: OK
Migrating testkey6 to 192.168.174.114:26379: OK
Migrating testkey36 to 192.168.174.114:26379: OK
Migrating testkey55 to 192.168.174.112:26379: OK
Migrating testkey31 to 192.168.174.108:26379: OK
Migrating testkey28 to 192.168.174.114:26379: OK
Migrating testkey90 to 192.168.174.114:26379: OK
Migrating testkey23 to 192.168.174.112:26379: OK
Migrating testkey93 to 192.168.174.108:26379: OK
Migrating testkey14 to 192.168.174.114:26379: OK
Migrating testkey35 to 192.168.174.108:26379: OK
Migrating testkey17 to 192.168.174.108:26379: OK
Migrating testkey67 to 192.168.174.108:26379: OK
Migrating testkey21 to 192.168.174.114:26379: OK
Migrating testkey43 to 192.168.174.114:26379: OK
Migrating testkey88 to 192.168.174.108:26379: OK
Migrating testkey87 to 192.168.174.114:26379: OK
Migrating testkey52 to 192.168.174.112:26379: OK
Migrating testkey29 to 192.168.174.114:26379: OK
Migrating testkey59 to 192.168.174.112:26379: OK
Migrating testkey13 to 192.168.174.108:26379: OK
Migrating testkey75 to 192.168.174.108:26379: OK
Migrating testkey7 to 192.168.174.112:26379: OK
Migrating testkey15 to 192.168.174.114:26379: OK
Migrating testkey63 to 192.168.174.108:26379: OK
Migrating testkey92 to 192.168.174.108:26379: OK
Migrating testkey80 to 192.168.174.108:26379: OK
Migrating testkey69 to 192.168.174.114:26379: OK
Migrating testkey98 to 192.168.174.114:26379: OK
Migrating testkey77 to 192.168.174.112:26379: OK
Migrating testkey95 to 192.168.174.112:26379: OK
Migrating testkey65 to 192.168.174.114:26379: OK
Migrating testkey74 to 192.168.174.108:26379: OK
Migrating testkey83 to 192.168.174.114:26379: OK
Migrating testkey46 to 192.168.174.112:26379: OK
Migrating testkey22 to 192.168.174.108:26379: OK
Migrating testkey72 to 192.168.174.114:26379: OK
Migrating testkey53 to 192.168.174.108:26379: OK
Migrating testkey100 to 192.168.174.112:26379: OK
Migrating testkey89 to 192.168.174.108:26379: OK
Migrating testkey61 to 192.168.174.114:26379: OK
Migrating testkey70 to 192.168.174.108:26379: OK
Migrating testkey48 to 192.168.174.108:26379: OK
Migrating testkey44 to 192.168.174.108:26379: OK
Migrating testkey81 to 192.168.174.108:26379: OK
Migrating testkey71 to 192.168.174.108:26379: OK
Migrating testkey33 to 192.168.174.114:26379: OK
Migrating testkey38 to 192.168.174.112:26379: OK
Migrating testkey47 to 192.168.174.114:26379: OK
Migrating testkey94 to 192.168.174.114:26379: OK
Migrating testkey4 to 192.168.174.112:26379: OK
Migrating testkey39 to 192.168.174.108:26379: OK
Migrating testkey8 to 192.168.174.112:26379: OK
Migrating testkey12 to 192.168.174.112:26379: OK
Migrating testkey16 to 192.168.174.112:26379: OK
Migrating testkey56 to 192.168.174.112:26379: OK
Migrating testkey26 to 192.168.174.108:26379: OK
Migrating testkey9 to 192.168.174.108:26379: OK
Migrating testkey54 to 192.168.174.114:26379: OK
Migrating testkey62 to 192.168.174.108:26379: OK
Migrating testkey1 to 192.168.174.108:26379: OK
Migrating testkey50 to 192.168.174.114:26379: OK
Migrating testkey79 to 192.168.174.108:26379: OK
Migrating testkey34 to 192.168.174.112:26379: OK

验证数据

/usr/local/redis/bin/redis-cli -c -p 26379 keys '*'

还原配置信息

在所有节点上执行。
/usr/local/redis/bin/redis-cli  -p 26379  -h 127.0.0.1 config set protected-mode yes
/usr/local/redis/bin/redis-cli  -p 26379 -a 123456 --no-auth-warning -h 192.168.174.108 config set requirepass '123456'

参考文档

https://redis.io/docs/latest/operate/oss_and_stack/management/scaling/

标签:OK,redis,192.168,集群,26379,174.108,迁移,Migrating
From: https://www.cnblogs.com/wangguishe/p/18631195

相关文章

  • hadoop集群部署
    1.前置条件及准备工作SSH免密登录JDK1.8上传tar包远程调用脚本及远程同步脚本远程调用脚本#!/bin/bashp_cnt=$#if((p_cnt<1));then echonoargs; exit;ficuser=`whoami`forhostinnode1node2node3do echo---------$host----------- ssh-p6......
  • redis7.4 集群配置
    集群规划节点规划redis-01192.168.174.108redis-02192.168.174.112redis-03192.168.174.117redis-04192.168.174.114redis-05192.168.174.115redis-06192.168.174.116redis-07192.168.174.118redis-08192.168.174.119redis服务配置redis.conf配置sed-i-e......
  • redis十大数据类型
    redis字符串(String)String(字符串)string是redis最基本的类型,一个key对应一个valuestring类型是二进制安全的,意思是redis的string可以包含任何数据,比如jpg图片或者序列化的对象。string类型是Redis最基本的数据类型,一个redis中字符串value最多可以是512M。redis列表(list)List......
  • 数据同步工具: mysql表级全量同步 / mongodb全量+增量同步 / redis全量+增量同步
    目录数据同步工具方案说明MySql同步方案概述配置说明MongoDB同步方案概述配置说明Redis同步方案概述配置说明启动同步服务文件准备启动服务数据同步工具mysql表级全量同步/mongodb全量+增量同步/redis全量+增量同步源码地址:https://github.com/jiashuaizhang/sync-jobs......
  • centos7.9 安装redis 7.4.1
    redis下载地址:http://download.redis.io/releases/选择自己想要的版本,本次安装的是7.4.1安装redis下载包到服务器wgethttp://download.redis.io/releases/redis-7.4.1.tar.gz下载包到/usr/local/redis解压tar-zxvfredis-7.4.1.tar.gz把解压的文件夹拷贝到默认路......
  • 安装K8s集群
    原文链接:https://blog.liuzijian.com/post/9aa6d426-a01c-05b0-6f7a-5da4343f0f9e.html因阿里云加速服务调整,镜像加速服务自2024年7月起不再支持,拉取镜像,下载网络插件等操作,需要科学上网访问DockerHub。安装全过程均使用ROOT权限。1.安装前准备工作这里采用3台CentO......
  • 从 GitLab.com 到 JihuLab.com 的迁移指南
    本文分享从GitLab.com到JihuLab.com的迁移指南。近期,GitLabInc.针对其SaaS产品做了限制,如果被判定为国内用户,则会建议使用其在国内的发布版本极狐GitLab。从GitLabSaaS产品(GitLab.com)迁移到极狐GitLabSaaS产品(JihuLab.com)非常方便,可以直接使用GitLab提供的直接转......
  • Alluxio 单机和集群部署教程
    目录Alluxio单机和集群部署教程第一部分:Alluxio概述Alluxio的关键特点:第二部分:Alluxio单机部署教程1.安装Alluxio1.1下载并解压Alluxio1.2配置Alluxio1.3启动Alluxio1.4测试功能2.单机案例代码实现(Python)2.1Python示例代码3.常见问题及解决方法3.1A......
  • Logstash 单机与集群部署教程
    目录Logstash单机与集群部署教程第一部分:Logstash概述第二部分:Logstash单机部署教程1.安装Logstash1.1安装依赖1.2配置Logstash1.3启动Logstash2.单机案例代码实现(Python)3.常见问题及解决方法3.1Logstash启动失败3.2无法连接到Elasticsearch第三部分:L......
  • Redis分片集群+MQ处理高并发
    Redis的三大集群模式:主从复制、哨兵模式和Cluster模式。每种模式都有其特点和应用场景,具体如下:主从复制模式:适用于数据备份和读写分离场景,配置简单,但在主节点故障时需要手动切换。哨兵模式:在主从复制的基础上实现自动故障转移,提高高可用性,适用于高可用性要求较高的场景。Clu......