zoukankan      html  css  js  c++  java
  • redis数据迁移

    1.安装迁移工具

    #1.安装依赖
    [root@db02 ~]# yum install -y automake libtool autoconf bzip2
    
    #2.拉取工具
    [root@db02 ~]# git clone https://github.com/vipshop/redis-migrate-tool
    #或者上传包
    
    #3.安装
    [root@db02 ~]# cd redis-migrate-tool/
    [root@db02 redis-migrate-tool]# autoreconf -fvi
    [root@db02 redis-migrate-tool]# ./configure
    [root@db02 redis-migrate-tool]# make
    

    2.编写数据迁移脚本

    [root@db02 redis-migrate-tool]# vim tocluster.sh
    
    [source]
    type: single
    servers:
     - 172.16.1.52:6381
    
    [target]
    type: redis cluster
    servers:
     - 172.16.1.51:6379
    
    [common]
    listen: 0.0.0.0:8888
    

    3.单节点生成数据

    [root@db03 ~]# vim data.sh 
    #!/bin/bash
    for i in {1001..2000};do
        redis-cli -c -p 6381 -h 172.16.1.52 set k${i} v${i}
    done
    
    [root@db03 ~]# sh data.sh 
    

    4.迁移数据

    [root@db02 redis-migrate-tool]# src/redis-migrate-tool -c tocluster.sh &
    
  • 相关阅读:
    noip2015运输计划
    bzoj3595 方伯伯的oj
    noip模拟赛 #3
    圆方树
    AtCoder AGC #4 Virtual Participation
    noip模拟赛 #2
    AtCoder AGC #3 Virtual Participation
    UNR #1 火车管理
    noip模拟赛
    AtCoder AGC #2 Virtual Participation
  • 原文地址:https://www.cnblogs.com/Applogize/p/13462215.html
Copyright © 2011-2022 走看看