zoukankan      html  css  js  c++  java
  • [Redis]-Redis5.x-集群命令

    1.初始化集群

    echo "yes"|redis-cli --cluster create 10.0.0.51:6380 10.0.0.52:6380 10.0.0.53:6380 10.0.0.51:6381 10.0.0.52:6381 10.0.0.53:6381 --cluster-replicas 1
    

    2.扩容节点

    添加主节点:

    redis-cli --cluster add-node 10.0.0.51:6390 10.0.0.51:6380
    

    添加从节点:

    redis-cli --cluster add-node 10.0.0.51:6391 10.0.0.51:6390 --cluster-slave --cluster-master-id $(redis-cli -h 10.0.0.51 -p 6380 cluster nodes|awk '/51:6390/{print $1}')
    

    迁移槽位

    redis-cli --cluster reshard 10.0.0.51:6390 --cluster-from all --cluster-to $(redis-cli -h 10.0.0.51 -p 6380 cluster nodes|awk '/51:6390/{print $1}') --cluster-slots 4096 --cluster-yes 
    

    3.收缩节点

    迁移槽位

    redis-cli --cluster rebalance 10.0.0.51:6380 --cluster-weight $(redis-cli -h 10.0.0.51 -p 6380 cluster nodes|awk '/51:6390/{print $1}')=0 $(redis-cli -h 10.0.0.51 -p 6380 cluster nodes|awk '/51:6380/{print $1}')=1 $(redis-cli -h 10.0.0.51 -p 6380 cluster nodes|awk '/52:6380/{print $1}')=1 $(redis-cli -h 10.0.0.51 -p 6380 cluster nodes|awk '/53:6380/{print $1}')=1
    

    下线节点

    redis-cli --cluster del-node 10.0.0.51:6380 $(redis-cli -h 10.0.0.51 -p 6380 cluster nodes|awk '/51:6390/{print $1}')
    
  • 相关阅读:
    HDU_1711 Number Sequence(KMP)
    快速排序+归并排序
    贪心算法
    HDU_1496 Equations && POJ_1840 Eqs(Hash)
    POJ_1328 Radar Installation(贪心)
    HDU_1055 && POJ_2054 Color a Tree(贪心)
    HDU_1754 I Hate It (线段树)
    哈希(Hash)表学习笔记
    jQuery插件datepicker的使用详解
    json总结
  • 原文地址:https://www.cnblogs.com/alaska/p/12590557.html
Copyright © 2011-2022 走看看