当前位置:网站首页>redis集群三主三从redis-cli
redis集群三主三从redis-cli
2022-08-08 23:30:00 【牵着骆驼迷神】
命令记录
redis配置
port 7000
dir /usr/local/redisdata
daemonize yes
logfile 7000.log
dbfilename dump-7000.rdb
cluster-enabled yes
cluster-node-timeout 15000
cluster-config-file nodes-7000.conf
cluster-require-full-coverage no 表示当负责一个插槽的主库下线且没有相应的从库进行故障恢复时,集群仍然可用,下面论证该情况。
启动六个redis,三主三从
redis-server redis7000.conf
redis-server redis7001.conf
redis节点相互通信命令
- redis-cli -h 127.0.0.1 -p 7000 cluster meet 127.0.0.1 7001
- redis-cli -h 127.0.0.1 -p 7000 cluster meet 127.0.0.1 7002
- redis-cli -h 127.0.0.1 -p 7000 cluster meet 127.0.0.1 7003 #4,5
redis分配槽
redis-cli -h 127.0.0.1 -p 7000 cluster addslots {0…5461}
edis-cli -h 127.0.0.1 -p 7001 cluster addslots {5462…10922}
edis-cli -h 127.0.0.1 -p 7002 cluster addslots {10923…16383}
设置主从
#cluster replicate node-id
redis-cli -h 127.0.0.1 -p 7003 cluster replicate ${node-id-7000}
redis-cli -h 127.0.0.1 -p 7004 cluster replicate ${node-id-7001}
redis-cli -h 127.0.0.1 -p 7005 cluster replicate ${node-id-7002}
查看分布信息
redis-cli -p 7000 cluster info #集群信息
redis-cli -p 7000 cluster nodes #集群节点信息
redis-cli -p 7000 cluster slots #具体分配槽位
redis-cli -c -p 7000 #登录
分配槽位的脚本
./xxx.sh 0 5461 7000执行方法
#!/bin/bash
start=$1
end=$2
port=$3
for slot in `seq ${start} ${end}`
do
echo "${port}:${slot}"
redis-cli -h 127.0.0.1 -p ${port} cluster addslots ${slot}
done
边栏推荐
- 最详树莓派4B装机流程及ifconfig不到wlan0的解决办法
- 每日一R「01」跟着大佬学 Rust
- 【Tensorflow2】tensorflow1.x-tensorflow2.x一些接口的转变
- WeChat applet develops some function usage methods
- 用工具实现 Mock API 的整个流程
- (2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)
- (2022杭电多校三)1009.Package Delivery(贪心)
- 2021 RoboCom 世界机器人开发者大赛-本科组(决赛)7-4猛犸不上 Ban(最短路)
- 2022牛客多校六 M-Z-Game on grid(动态规划)
- STM8L 液晶数码管驱动,温度计液晶屏显示
猜你喜欢
Binary tree level traversal and examples
WeChat applet wx:for loop output example
STM8L LCD digital tube driver, thermometer LCD display
JS中的作用域与作用域链
(Codeforce 757)E. Bash Plays with Functions(积性函数)
洛谷P4197 Peaks 线段树合并
Application Layer Protocol - RADIUS
(2022牛客多校四)N-Particle Arts(思维)
(2022牛客多校四)K-NIO‘s Sword(思维)
使用Mongoose populate实现多表关联存储与查询,内附完整代码
随机推荐
Porting ucos2 code from stm32 to GD32
循环神经网络实现股票预测
Manacher(求解最长回文子串)
ndk和JNI的使用初探
51nod1798 打怪兽
JS中的作用域与作用域链
深拷贝与浅拷贝
2022牛客多校六 M-Z-Game on grid(动态规划)
bp神经网络的学习心得
(2022牛客多校五)D-Birds in the tree(树形DP)
Share | design based on MCU P0 mouth to drive the LED flashing
[PP-YOLOv2] Training a custom dataset
(2022牛客多校四)A-Task Computing (排序+动态规划)
(2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)
域前置通信过程和溯源思路
makefile automatically compiles C files in directories and subdirectories
用模态框 实现 注册 登陆
(2022牛客多校四)H-Wall Builder II(思维)
【瑞吉外卖】day04:员工分页查询、启用/禁用员工账号、编辑员工信息
sess.restore() 和 tf.import_meta_graph() 在使用时的一些关联