Redis Cluster集群搭建 – 记忆角落

Redis Cluster集群搭建

/ 0评 / 1

Redis Cluster介绍

概念

Redis 集群是一个提供在多个Redis间节点间共享数据的程序集。

Redis集群并不支持处理多个keys的命令,因为这需要在不同的节点间移动数据,从而达不到像Redis那样的性能,在高负载的情况下可能会导致不可预料的错误.

Redis 集群通过分区来提供一定程度的可用性,在实际环境中当某个节点宕机或者不可达的情况下继续处理命令. Redis 集群的优势:

架构

参考官网:https://redis.io/topics/cluster-tutorial/

Redis Cluster 可以看成是由多个 Redis 实例组成的数据集合。客户端不需要关注数

据的子集到底存储在哪个节点,只需要关注这个集合整体。

以 3 主 3 从为例,节点之间两两交互,共享数据分片、节点状态等信息;

在这里插入图片描述

Redis Cluster搭建

部署前提:

高可用Redis cluster集群(20),主从+哨兵一台机器70个服务,每个服务限定10G内存(记得是运存,不是数据盘)

1.上传redis安装包

这里用得是redis-5.0.9.tar.gz

上传文件到 目录/usr/local

或者外网直接下载

wget http://download.redis.io/releases/redis-5.0.9.tar.gz

2.安装GCC

yum install gcc

3.解压并安装

解压

tar xzvf redis-5.0.9.tar.gz

编译安装

cd redis-5.0.9
make
cd src
make install

建立一个软连接

ln -s redis-5.0.9 redis

注:如出现/bin/sh: cc: command not found错误,是因为没有安装 gcc 环境,使用命令yum install gcc安装 gcc 环境即可

image-20210319173020188

 

测试是否安装成功

#进入redis目录
cd redis
# 执行启动命令 读取默认配置文件
redis-server ./redis.conf 
# 连接测试,默认是6379
redis-cli -p 6379

4.创建多个实例

Redis 单机多实例部署方法十分简单,只要复制多个 redis 配置文件即可。需要注意每个实例的端口不能冲突。

mkdir /data/redis-cluster

cd /data/redis-cluster/

#创建 70个文件夹(70个服务)
mkdir 700{1..9}
mkdir 701{0..9}
mkdir 702{0..9}
mkdir 703{0..9}
mkdir 704{0..9}
mkdir 705{0..9}
mkdir 706{0..9}
mkdir 7070

[root@pod3-highapp-a-23 local]# cd /data/redis-cluster/
[root@pod3-highapp-a-23 redis-cluster]# ls
7001  7003  7005  7007  7009  7011  7013  7015  7017  7019  7021  7023  7025  7027  7029  7031  7033  7035  7037  7039  7041  7043  7045  7047  7049  7051  7053  7055  7057  7059  7061  7063  7065  7067  7069
7002  7004  7006  7008  7010  7012  7014  7016  7018  7020  7022  7024  7026  7028  7030  7032  7034  7036  7038  7040  7042  7044  7046  7048  7050  7052  7054  7056  7058  7060  7062  7064  7066  7068  7070

5.配置文件

配置文件信息如下:

# 守护进程模式
daemonize yes 
# pid file 修改pidfile指向路径
pidfile /data/redis-cluster/7001/7001.pid

# 指明日志文件名
logfile "/data/redis-cluster/7001/7001.log"

# 工作目录
dir /data/redis-cluster/7001/
# 监听端口
port 7001

#如果是yes,表示启用集群,否则以单例模式启动
cluster-enabled yes

#请注意,尽管有此选项的名称
cluster-config-file nodes.conf

#Redis群集节点超过不可用的最长时间
cluster-node-timeout 15000

# TCP接收队列长度,受/proc/sys/net/core/somaxconn和tcp_max_syn_backlog这两个内核参数的影响
tcp-backlog 511

# 一个客户端空闲多少秒后关闭连接(0代表禁用,永不关闭)
timeout 0

# 如果非零,则设置SO_KEEPALIVE选项来向空闲连接的客户端发送ACK
tcp-keepalive 300

# 指定服务器调试等级
# 可能值:
# debug (大量信息,对开发/测试有用)
# verbose (很多精简的有用信息,但是不像debug等级那么多)
# notice (适量的信息,基本上是你生产环境中需要的)
# warning (只有很重要/严重的信息会记录下来)
loglevel notice

# 设置数据库个数
databases 16

# 会在指定秒数和数据变化次数之后把数据库写到磁盘上
# 900秒(15分钟)之后,且至少1次变更
# 300秒(5分钟)之后,且至少10次变更
# 60秒之后,且至少10000次变更
save ""
#save 900 1
#save 300 10
#save 60 10000


# 默认如果开启RDB快照(至少一条save指令)并且最新的后台保存失败,Redis将会停止接受写操作
# 这将使用户知道数据没有正确的持久化到硬盘,否则可能没人注意到并且造成一些灾难
stop-writes-on-bgsave-error yes

# 当导出到 .rdb 数据库时是否用LZF压缩字符串对象
rdbcompression yes

# 版本5的RDB有一个CRC64算法的校验和放在了文件的最后。这将使文件格式更加可靠。
rdbchecksum yes

# 持久化数据库的文件名
dbfilename dump.rdb

# 当master服务设置了密码保护时,slav服务连接master的密码
masterauth NBD

# 当一个slave失去和master的连接,或者同步正在进行中,slave的行为可以有两种:
#
# 1) 如果 slave-serve-stale-data 设置为 "yes" (默认值),slave会继续响应客户端请求,
# 可能是正常数据,或者是过时了的数据,也可能是还没获得值的空数据。
# 2) 如果 slave-serve-stale-data 设置为 "no",slave会回复"正在从master同步
# (SYNC with master in progress)"来处理各种请求,除了 INFO 和 SLAVEOF 命令。
slave-serve-stale-data yes

# 你可以配置salve实例是否接受写操作。可写的slave实例可能对存储临时数据比较有用(因为写入salve
# 的数据在同master同步之后将很容易被删除
slave-read-only yes

# 是否在slave套接字发送SYNC之后禁用 TCP_NODELAY?
# 如果你选择“yes”Redis将使用更少的TCP包和带宽来向slaves发送数据。但是这将使数据传输到slave
# 上有延迟,Linux内核的默认配置会达到40毫秒
# 如果你选择了 "no" 数据传输到salve的延迟将会减少但要使用更多的带宽
repl-disable-tcp-nodelay no

# slave的优先级是一个整数展示在Redis的Info输出中。如果master不再正常工作了,哨兵将用它来
# 选择一个slave提升=升为master。
# 优先级数字小的salve会优先考虑提升为master,所以例如有三个slave优先级分别为10,100,25,
# 哨兵将挑选优先级最小数字为10的slave。
# 0作为一个特殊的优先级,标识这个slave不能作为master,所以一个优先级为0的slave永远不会被
# 哨兵挑选提升为master
slave-priority 100


# 密码验证
# 警告:因为Redis太快了,所以外面的人可以尝试每秒150k的密码来试图破解密码。这意味着你需要
# 一个高强度的密码,否则破解太容易了
requirepass NBD

# redis实例最大占用内存,不要用比设置的上限更多的内存。一旦内存使用达到上限,Redis会根据选定的回收策略(参见:
# maxmemmory-policy)删除key
maxmemory 10gb

# 最大内存策略:如果达到内存限制了,Redis如何选择删除key。你可以在下面五个行为里选:
# volatile-lru -> 根据LRU算法删除带有过期时间的key。
# allkeys-lru -> 根据LRU算法删除任何key。
# volatile-random -> 根据过期设置来随机删除key, 具备过期时间的key。 
# allkeys->random -> 无差别随机删, 任何一个key。 
# volatile-ttl -> 根据最近过期时间来删除(辅以TTL), 这是对于有过期时间的key 
# noeviction -> 谁也不删,直接在写操作时返回错误。
maxmemory-policy volatile-lru

# 默认情况下,Redis是异步的把数据导出到磁盘上。这种模式在很多应用里已经足够好,但Redis进程
# 出问题或断电时可能造成一段时间的写操作丢失(这取决于配置的save指令)。
#
# AOF是一种提供了更可靠的替代持久化模式,例如使用默认的数据写入文件策略(参见后面的配置)
# 在遇到像服务器断电或单写情况下Redis自身进程出问题但操作系统仍正常运行等突发事件时,Redis
# 能只丢失1秒的写操作。
#
# AOF和RDB持久化能同时启动并且不会有问题。
# 如果AOF开启,那么在启动时Redis将加载AOF文件,它更能保证数据的可靠性。
appendonly no

# aof文件名
appendfilename "appendonly.aof"

# fsync() 系统调用告诉操作系统把数据写到磁盘上,而不是等更多的数据进入输出缓冲区。
# 有些操作系统会真的把数据马上刷到磁盘上;有些则会尽快去尝试这么做。
#
# Redis支持三种不同的模式:
#
# no:不要立刻刷,只有在操作系统需要刷的时候再刷。比较快。
# always:每次写操作都立刻写入到aof文件。慢,但是最安全。
# everysec:每秒写一次。折中方案。 
appendfsync everysec

# 如果AOF的同步策略设置成 "always" 或者 "everysec",并且后台的存储进程(后台存储或写入AOF
# 日志)会产生很多磁盘I/O开销。某些Linux的配置下会使Redis因为 fsync()系统调用而阻塞很久。
# 注意,目前对这个情况还没有完美修正,甚至不同线程的 fsync() 会阻塞我们同步的write(2)调用。
#
# 为了缓解这个问题,可以用下面这个选项。它可以在 BGSAVE 或 BGREWRITEAOF 处理时阻止主进程进行fsync()。
# 
# 这就意味着如果有子进程在进行保存操作,那么Redis就处于"不可同步"的状态。
# 这实际上是说,在最差的情况下可能会丢掉30秒钟的日志数据。(默认Linux设定)
# 
# 如果你有延时问题把这个设置成"yes",否则就保持"no",这是保存持久数据的最安全的方式。
no-appendfsync-on-rewrite yes

# 自动重写AOF文件
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

# AOF文件可能在尾部是不完整的(这跟system关闭有问题,尤其是mount ext4文件系统时
# 没有加上data=ordered选项。只会发生在os死时,redis自己死不会不完整)。
# 那redis重启时load进内存的时候就有问题了。
# 发生的时候,可以选择redis启动报错,并且通知用户和写日志,或者load尽量多正常的数据。
# 如果aof-load-truncated是yes,会自动发布一个log给客户端然后load(默认)。
# 如果是no,用户必须手动redis-check-aof修复AOF文件才可以。
# 注意,如果在读取的过程中,发现这个aof是损坏的,服务器也是会退出的,
# 这个选项仅仅用于当服务器尝试读取更多的数据但又找不到相应的数据时。
aof-load-truncated yes

# Lua 脚本的最大执行时间,毫秒为单位
lua-time-limit 5000

# Redis慢查询日志可以记录超过指定时间的查询
slowlog-log-slower-than 10000

# 这个长度没有限制。只是要主要会消耗内存。你可以通过 SLOWLOG RESET 来回收内存。
slowlog-max-len 128

# redis延时监控系统在运行时会采样一些操作,以便收集可能导致延时的数据根源。
# 通过 LATENCY命令 可以打印一些图样和获取一些报告,方便监控
# 这个系统仅仅记录那个执行时间大于或等于预定时间(毫秒)的操作, 
# 这个预定时间是通过latency-monitor-threshold配置来指定的,
# 当设置为0时,这个监控系统处于停止状态
latency-monitor-threshold 0

# Redis能通知 Pub/Sub 客户端关于键空间发生的事件,默认关闭
notify-keyspace-events ""

# 当hash只有少量的entry时,并且最大的entry所占空间没有超过指定的限制时,会用一种节省内存的
# 数据结构来编码。可以通过下面的指令来设定限制
hash-max-ziplist-entries 512
hash-max-ziplist-value 64


# set有一种特殊编码的情况:当set数据全是十进制64位有符号整型数字构成的字符串时。
# 下面这个配置项就是用来设置set使用这种编码来节省内存的最大长度。
set-max-intset-entries 512

# 与hash和list相似,有序集合也可以用一种特别的编码方式来节省大量空间。
# 这种编码只适合长度和元素都小于下面限制的有序集合
zset-max-ziplist-entries 128
zset-max-ziplist-value 64

# HyperLogLog稀疏结构表示字节的限制。该限制包括
# 16个字节的头。当HyperLogLog使用稀疏结构表示
# 这些限制,它会被转换成密度表示。
# 值大于16000是完全没用的,因为在该点
# 密集的表示是更多的内存效率。
# 建议值是3000左右,以便具有的内存好处, 减少内存的消耗
hll-sparse-max-bytes 3000

# 启用哈希刷新,每100个CPU毫秒会拿出1个毫秒来刷新Redis的主哈希表(顶级键值映射表)
activerehashing yes

# 客户端的输出缓冲区的限制,可用于强制断开那些因为某种原因从服务器读取数据的速度不够快的客户端
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60

# 默认情况下,“hz”的被设定为10。提高该值将在Redis空闲时使用更多的CPU时,但同时当有多个key
# 同时到期会使Redis的反应更灵敏,以及超时可以更精确地处理
hz 10

# 当一个子进程重写AOF文件时,如果启用下面的选项,则文件每生成32M数据会被同步
aof-rewrite-incremental-fsync yes

将配置文件复制到其它文件夹下:

cp redis.conf /data/redis-cluster/7001/
cp redis.conf /data/redis-cluster/7002/
cp redis.conf /data/redis-cluster/7003/
cp redis.conf /data/redis-cluster/7004/
cp redis.conf /data/redis-cluster/7005/
cp redis.conf /data/redis-cluster/7006/
cp redis.conf /data/redis-cluster/7007/
cp redis.conf /data/redis-cluster/7008/
cp redis.conf /data/redis-cluster/7009/
cp redis.conf /data/redis-cluster/7010/

cp redis.conf /data/redis-cluster/7011/
cp redis.conf /data/redis-cluster/7012/
cp redis.conf /data/redis-cluster/7013/
cp redis.conf /data/redis-cluster/7014/
cp redis.conf /data/redis-cluster/7015/
cp redis.conf /data/redis-cluster/7016/
cp redis.conf /data/redis-cluster/7017/
cp redis.conf /data/redis-cluster/7018/
cp redis.conf /data/redis-cluster/7019/
cp redis.conf /data/redis-cluster/7020/

cp redis.conf /data/redis-cluster/7021/
cp redis.conf /data/redis-cluster/7022/
cp redis.conf /data/redis-cluster/7023/
cp redis.conf /data/redis-cluster/7024/
cp redis.conf /data/redis-cluster/7025/
cp redis.conf /data/redis-cluster/7026/
cp redis.conf /data/redis-cluster/7027/
cp redis.conf /data/redis-cluster/7028/
cp redis.conf /data/redis-cluster/7029/

cp redis.conf /data/redis-cluster/7030/
cp redis.conf /data/redis-cluster/7031/
cp redis.conf /data/redis-cluster/7032/
cp redis.conf /data/redis-cluster/7033/
cp redis.conf /data/redis-cluster/7034/
cp redis.conf /data/redis-cluster/7035/
cp redis.conf /data/redis-cluster/7036/
cp redis.conf /data/redis-cluster/7037/
cp redis.conf /data/redis-cluster/7038/
cp redis.conf /data/redis-cluster/7039/

cp redis.conf /data/redis-cluster/7040/
cp redis.conf /data/redis-cluster/7041/
cp redis.conf /data/redis-cluster/7042/
cp redis.conf /data/redis-cluster/7043/
cp redis.conf /data/redis-cluster/7044/
cp redis.conf /data/redis-cluster/7045/
cp redis.conf /data/redis-cluster/7046/
cp redis.conf /data/redis-cluster/7047/
cp redis.conf /data/redis-cluster/7048/
cp redis.conf /data/redis-cluster/7049/

cp redis.conf /data/redis-cluster/7050/
cp redis.conf /data/redis-cluster/7051/
cp redis.conf /data/redis-cluster/7052/
cp redis.conf /data/redis-cluster/7053/
cp redis.conf /data/redis-cluster/7054/
cp redis.conf /data/redis-cluster/7055/
cp redis.conf /data/redis-cluster/7056/
cp redis.conf /data/redis-cluster/7057/
cp redis.conf /data/redis-cluster/7058/
cp redis.conf /data/redis-cluster/7059/

cp redis.conf /data/redis-cluster/7060/
cp redis.conf /data/redis-cluster/7061/
cp redis.conf /data/redis-cluster/7062/
cp redis.conf /data/redis-cluster/7063/
cp redis.conf /data/redis-cluster/7064/
cp redis.conf /data/redis-cluster/7065/
cp redis.conf /data/redis-cluster/7066/
cp redis.conf /data/redis-cluster/7067/
cp redis.conf /data/redis-cluster/7068/
cp redis.conf /data/redis-cluster/7069/
cp redis.conf /data/redis-cluster/7070/

批量替换内容:

sed -i 's/7001/7001/g' 7001/redis.conf
sed -i 's/7001/7002/g' 7002/redis.conf
sed -i 's/7001/7003/g' 7003/redis.conf
sed -i 's/7001/7004/g' 7004/redis.conf
sed -i 's/7001/7005/g' 7005/redis.conf
sed -i 's/7001/7006/g' 7006/redis.conf
sed -i 's/7001/7007/g' 7007/redis.conf
sed -i 's/7001/7008/g' 7008/redis.conf
sed -i 's/7001/7009/g' 7009/redis.conf
sed -i 's/7001/7010/g' 7010/redis.conf

sed -i 's/7001/7011/g' 7011/redis.conf
sed -i 's/7001/7012/g' 7012/redis.conf
sed -i 's/7001/7013/g' 7013/redis.conf
sed -i 's/7001/7014/g' 7014/redis.conf
sed -i 's/7001/7015/g' 7015/redis.conf
sed -i 's/7001/7016/g' 7016/redis.conf
sed -i 's/7001/7017/g' 7017/redis.conf
sed -i 's/7001/7018/g' 7018/redis.conf
sed -i 's/7001/7019/g' 7019/redis.conf
sed -i 's/7001/7020/g' 7020/redis.conf

sed -i 's/7001/7021/g' 7021/redis.conf
sed -i 's/7001/7022/g' 7022/redis.conf
sed -i 's/7001/7023/g' 7023/redis.conf
sed -i 's/7001/7024/g' 7024/redis.conf
sed -i 's/7001/7025/g' 7025/redis.conf
sed -i 's/7001/7026/g' 7026/redis.conf
sed -i 's/7001/7027/g' 7027/redis.conf
sed -i 's/7001/7028/g' 7028/redis.conf
sed -i 's/7001/7029/g' 7029/redis.conf
sed -i 's/7001/7030/g' 7030/redis.conf

sed -i 's/7001/7031/g' 7031/redis.conf
sed -i 's/7001/7032/g' 7032/redis.conf
sed -i 's/7001/7033/g' 7033/redis.conf
sed -i 's/7001/7034/g' 7034/redis.conf
sed -i 's/7001/7035/g' 7035/redis.conf
sed -i 's/7001/7036/g' 7036/redis.conf
sed -i 's/7001/7037/g' 7037/redis.conf
sed -i 's/7001/7038/g' 7038/redis.conf
sed -i 's/7001/7039/g' 7039/redis.conf
sed -i 's/7001/7040/g' 7040/redis.conf

sed -i 's/7001/7041/g' 7041/redis.conf
sed -i 's/7001/7042/g' 7042/redis.conf
sed -i 's/7001/7043/g' 7043/redis.conf
sed -i 's/7001/7044/g' 7044/redis.conf
sed -i 's/7001/7045/g' 7045/redis.conf
sed -i 's/7001/7046/g' 7046/redis.conf
sed -i 's/7001/7047/g' 7047/redis.conf
sed -i 's/7001/7048/g' 7048/redis.conf
sed -i 's/7001/7049/g' 7049/redis.conf
sed -i 's/7001/7050/g' 7050/redis.conf

sed -i 's/7001/7051/g' 7051/redis.conf
sed -i 's/7001/7052/g' 7052/redis.conf
sed -i 's/7001/7053/g' 7053/redis.conf
sed -i 's/7001/7054/g' 7054/redis.conf
sed -i 's/7001/7055/g' 7055/redis.conf
sed -i 's/7001/7056/g' 7056/redis.conf
sed -i 's/7001/7057/g' 7057/redis.conf
sed -i 's/7001/7058/g' 7058/redis.conf
sed -i 's/7001/7059/g' 7059/redis.conf
sed -i 's/7001/7060/g' 7060/redis.conf

sed -i 's/7001/7061/g' 7061/redis.conf
sed -i 's/7001/7062/g' 7062/redis.conf
sed -i 's/7001/7063/g' 7063/redis.conf
sed -i 's/7001/7064/g' 7064/redis.conf
sed -i 's/7001/7065/g' 7065/redis.conf
sed -i 's/7001/7066/g' 7066/redis.conf
sed -i 's/7001/7067/g' 7067/redis.conf
sed -i 's/7001/7068/g' 7068/redis.conf
sed -i 's/7001/7069/g' 7069/redis.conf
sed -i 's/7001/7070/g' 7070/redis.conf

复制到其他19台机器:

scp -rp redis-cluster root@10.209.17.101:/data/
scp -rp redis-cluster root@10.209.17.103:/data/
scp -rp redis-cluster root@10.209.17.105:/data/
scp -rp redis-cluster root@10.209.17.106:/data/
scp -rp redis-cluster root@10.209.17.11:/data/
scp -rp redis-cluster root@10.209.17.110:/data/
scp -rp redis-cluster root@10.209.17.117:/data/
scp -rp redis-cluster root@10.209.17.12:/data/
scp -rp redis-cluster root@10.209.17.122:/data/
scp -rp redis-cluster root@10.209.17.13:/data/
scp -rp redis-cluster root@10.209.17.14:/data/
scp -rp redis-cluster root@10.209.17.15:/data/
scp -rp redis-cluster root@10.209.17.16:/data/
scp -rp redis-cluster root@10.209.17.17:/data/
scp -rp redis-cluster root@10.209.17.18:/data/
scp -rp redis-cluster root@10.209.17.19:/data/
scp -rp redis-cluster root@10.209.17.2:/data/
scp -rp redis-cluster root@10.209.17.20:/data/
scp -rp redis-cluster root@10.209.17.21:/data/

6.Redis启动

启动70个redis实例。

建议直接建立一个startRedis.sh

redis-server ./7001/redis.conf
redis-server ./7002/redis.conf
redis-server ./7003/redis.conf
redis-server ./7004/redis.conf
redis-server ./7005/redis.conf
redis-server ./7006/redis.conf
redis-server ./7007/redis.conf
redis-server ./7008/redis.conf
redis-server ./7009/redis.conf
redis-server ./7010/redis.conf
redis-server ./7011/redis.conf
redis-server ./7012/redis.conf
redis-server ./7013/redis.conf
redis-server ./7014/redis.conf
redis-server ./7015/redis.conf
redis-server ./7016/redis.conf
redis-server ./7017/redis.conf
redis-server ./7018/redis.conf
redis-server ./7019/redis.conf
redis-server ./7020/redis.conf
redis-server ./7021/redis.conf
redis-server ./7022/redis.conf
redis-server ./7023/redis.conf
redis-server ./7024/redis.conf
redis-server ./7025/redis.conf
redis-server ./7026/redis.conf
redis-server ./7027/redis.conf
redis-server ./7028/redis.conf
redis-server ./7029/redis.conf
redis-server ./7030/redis.conf
redis-server ./7031/redis.conf
redis-server ./7032/redis.conf
redis-server ./7033/redis.conf
redis-server ./7034/redis.conf
redis-server ./7035/redis.conf
redis-server ./7036/redis.conf
redis-server ./7037/redis.conf
redis-server ./7038/redis.conf
redis-server ./7039/redis.conf
redis-server ./7040/redis.conf
redis-server ./7041/redis.conf
redis-server ./7042/redis.conf
redis-server ./7043/redis.conf
redis-server ./7044/redis.conf
redis-server ./7045/redis.conf
redis-server ./7046/redis.conf
redis-server ./7047/redis.conf
redis-server ./7048/redis.conf
redis-server ./7049/redis.conf
redis-server ./7050/redis.conf
redis-server ./7051/redis.conf
redis-server ./7052/redis.conf
redis-server ./7053/redis.conf
redis-server ./7054/redis.conf
redis-server ./7055/redis.conf
redis-server ./7056/redis.conf
redis-server ./7057/redis.conf
redis-server ./7058/redis.conf
redis-server ./7059/redis.conf
redis-server ./7060/redis.conf
redis-server ./7061/redis.conf
redis-server ./7062/redis.conf
redis-server ./7063/redis.conf
redis-server ./7064/redis.conf
redis-server ./7065/redis.conf
redis-server ./7066/redis.conf
redis-server ./7067/redis.conf
redis-server ./7068/redis.conf
redis-server ./7069/redis.conf
redis-server ./7070/redis.conf

查看进程:

[root@pod3-highapp-a-23 redis-cluster]# ps -ef | grep redis
root      27936      1  2 15:50 ?        00:02:59 redis-server *:7001 [cluster]
root      27941      1  3 15:50 ?        00:03:27 redis-server *:7002 [cluster]
root      27946      1  3 15:50 ?        00:03:16 redis-server *:7003 [cluster]
root      27951      1  3 15:50 ?        00:03:22 redis-server *:7004 [cluster]
root      27956      1  3 15:50 ?        00:03:02 redis-server *:7005 [cluster]
root      27961      1  3 15:50 ?        00:03:07 redis-server *:7006 [cluster]
root      27966      1  3 15:50 ?        00:03:14 redis-server *:7007 [cluster]
root      27971      1  3 15:50 ?        00:03:07 redis-server *:7008 [cluster]
root      27976      1  3 15:50 ?        00:03:23 redis-server *:7009 [cluster]
root      27981      1  3 15:50 ?        00:03:17 redis-server *:7010 [cluster]
root      27986      1  3 15:50 ?        00:03:11 redis-server *:7011 [cluster]
root      27991      1  3 15:50 ?        00:03:12 redis-server *:7012 [cluster]
root      27996      1  3 15:50 ?        00:03:07 redis-server *:7013 [cluster]
root      28001      1  3 15:50 ?        00:03:08 redis-server *:7014 [cluster]
root      28006      1  3 15:50 ?        00:03:16 redis-server *:7015 [cluster]
root      28011      1  3 15:50 ?        00:03:10 redis-server *:7016 [cluster]
root      28023      1  3 15:50 ?        00:03:24 redis-server *:7017 [cluster]
root      28028      1  3 15:50 ?        00:03:02 redis-server *:7018 [cluster]
root      28033      1  3 15:50 ?        00:03:17 redis-server *:7019 [cluster]
root      28039      1  3 15:50 ?        00:03:16 redis-server *:7020 [cluster]
root      28082      1  3 15:50 ?        00:03:13 redis-server *:7021 [cluster]
root      28087      1  3 15:50 ?        00:03:33 redis-server *:7022 [cluster]
root      28089      1  3 15:50 ?        00:03:16 redis-server *:7023 [cluster]
root      28097      1  3 15:50 ?        00:03:18 redis-server *:7024 [cluster]
root      28100      1  3 15:50 ?        00:03:31 redis-server *:7025 [cluster]
root      28107      1  3 15:50 ?        00:03:03 redis-server *:7026 [cluster]
root      28112      1  3 15:50 ?        00:03:29 redis-server *:7027 [cluster]
root      28117      1  3 15:50 ?        00:03:12 redis-server *:7028 [cluster]
root      28122      1  3 15:50 ?        00:03:01 redis-server *:7029 [cluster]
root      28127      1  3 15:50 ?        00:03:09 redis-server *:7030 [cluster]
root      28132      1  3 15:50 ?        00:03:20 redis-server *:7031 [cluster]
root      28137      1  2 15:50 ?        00:02:52 redis-server *:7032 [cluster]
root      28142      1  3 15:50 ?        00:03:19 redis-server *:7033 [cluster]
root      28147      1  3 15:50 ?        00:03:13 redis-server *:7034 [cluster]
root      28152      1  3 15:50 ?        00:03:15 redis-server *:7035 [cluster]
root      28157      1  3 15:50 ?        00:03:09 redis-server *:7036 [cluster]
root      28162      1  3 15:50 ?        00:03:08 redis-server *:7037 [cluster]
root      28168      1  3 15:50 ?        00:03:12 redis-server *:7038 [cluster]
root      28173      1  3 15:50 ?        00:03:11 redis-server *:7039 [cluster]
root      28178      1  3 15:50 ?        00:03:20 redis-server *:7040 [cluster]
root      28231      1  3 15:51 ?        00:03:02 redis-server *:7041 [cluster]
root      28236      1  3 15:51 ?        00:03:18 redis-server *:7042 [cluster]
root      28241      1  3 15:51 ?        00:03:25 redis-server *:7043 [cluster]
root      28246      1  3 15:51 ?        00:03:19 redis-server *:7044 [cluster]
root      28251      1  3 15:51 ?        00:03:38 redis-server *:7045 [cluster]
root      28256      1  3 15:51 ?        00:03:31 redis-server *:7046 [cluster]
root      28261      1  3 15:51 ?        00:03:20 redis-server *:7047 [cluster]
root      28266      1  3 15:51 ?        00:03:29 redis-server *:7048 [cluster]
root      28272      1  3 15:51 ?        00:03:29 redis-server *:7049 [cluster]
root      28277      1  3 15:51 ?        00:03:05 redis-server *:7050 [cluster]
root      28282      1  3 15:51 ?        00:03:25 redis-server *:7051 [cluster]
root      28287      1  3 15:51 ?        00:03:01 redis-server *:7052 [cluster]
root      28292      1  3 15:51 ?        00:03:20 redis-server *:7053 [cluster]
root      28299      1  3 15:51 ?        00:03:03 redis-server *:7054 [cluster]
root      28304      1  3 15:51 ?        00:03:25 redis-server *:7055 [cluster]
root      28309      1  3 15:51 ?        00:03:15 redis-server *:7056 [cluster]
root      28314      1  3 15:51 ?        00:03:12 redis-server *:7057 [cluster]
root      28319      1  3 15:51 ?        00:03:11 redis-server *:7058 [cluster]
root      28324      1  3 15:51 ?        00:03:03 redis-server *:7059 [cluster]
root      28329      1  3 15:51 ?        00:03:03 redis-server *:7060 [cluster]
root      28356      1  3 15:51 ?        00:03:21 redis-server *:7061 [cluster]
root      28361      1  3 15:51 ?        00:03:15 redis-server *:7062 [cluster]
root      28366      1  2 15:51 ?        00:02:54 redis-server *:7063 [cluster]
root      28372      1  3 15:51 ?        00:03:02 redis-server *:7064 [cluster]
root      28377      1  3 15:51 ?        00:03:03 redis-server *:7065 [cluster]
root      28382      1  3 15:51 ?        00:03:15 redis-server *:7066 [cluster]
root      28387      1  3 15:51 ?        00:03:12 redis-server *:7067 [cluster]
root      28392      1  3 15:51 ?        00:03:16 redis-server *:7068 [cluster]
root      28397      1  3 15:51 ?        00:03:17 redis-server *:7069 [cluster]
root      28402      1  3 15:51 ?        00:03:28 redis-server *:7070 [cluster]
root      41658  15689  0 17:31 pts/1    00:00:00 grep --color=auto redis

7.启动集群

redis-cli -a NBD --cluster create --cluster-replicas 1 10.209.17.10:7001 10.209.17.10:7002 10.209.17.10:7003 10.209.17.10:7004 10.209.17.10:7005 10.209.17.10:7006 10.209.17.10:7007 10.209.17.10:7008 10.209.17.10:7009 10.209.17.10:7010 10.209.17.10:7011 10.209.17.10:7012 10.209.17.10:7013 10.209.17.10:7014 10.209.17.10:7015 10.209.17.10:7016 10.209.17.10:7017 10.209.17.10:7018 10.209.17.10:7019 10.209.17.10:7020 10.209.17.10:7021 10.209.17.10:7022 10.209.17.10:7023 10.209.17.10:7024 10.209.17.10:7025 10.209.17.10:7026 10.209.17.10:7027 10.209.17.10:7028 10.209.17.10:7029 10.209.17.10:7030 10.209.17.10:7031 10.209.17.10:7032 10.209.17.10:7033 10.209.17.10:7034 10.209.17.10:7035 10.209.17.10:7036 10.209.17.10:7037 10.209.17.10:7038 10.209.17.10:7039 10.209.17.10:7040 10.209.17.10:7041 10.209.17.10:7042 10.209.17.10:7043 10.209.17.10:7044 10.209.17.10:7045 10.209.17.10:7046 10.209.17.10:7047 10.209.17.10:7048 10.209.17.10:7049 10.209.17.10:7050 10.209.17.10:7051 10.209.17.10:7052 10.209.17.10:7053 10.209.17.10:7054 10.209.17.10:7055 10.209.17.10:7056 10.209.17.10:7057 10.209.17.10:7058 10.209.17.10:7059 10.209.17.10:7060 10.209.17.10:7061 10.209.17.10:7062 10.209.17.10:7063 10.209.17.10:7064 10.209.17.10:7065 10.209.17.10:7066 10.209.17.10:7067 10.209.17.10:7068 10.209.17.10:7069 10.209.17.10:7070 10.209.17.101:7001 10.209.17.101:7002 10.209.17.101:7003 10.209.17.101:7004 10.209.17.101:7005 10.209.17.101:7006 10.209.17.101:7007 10.209.17.101:7008 10.209.17.101:7009 10.209.17.101:7010 10.209.17.101:7011 10.209.17.101:7012 10.209.17.101:7013 10.209.17.101:7014 10.209.17.101:7015 10.209.17.101:7016 10.209.17.101:7017 10.209.17.101:7018 10.209.17.101:7019 10.209.17.101:7020 10.209.17.101:7021 10.209.17.101:7022 10.209.17.101:7023 10.209.17.101:7024 10.209.17.101:7025 10.209.17.101:7026 10.209.17.101:7027 10.209.17.101:7028 10.209.17.101:7029 10.209.17.101:7030 10.209.17.101:7031 10.209.17.101:7032 10.209.17.101:7033 10.209.17.101:7034 10.209.17.101:7035 10.209.17.101:7036 10.209.17.101:7037 10.209.17.101:7038 10.209.17.101:7039 10.209.17.101:7040 10.209.17.101:7041 10.209.17.101:7042 10.209.17.101:7043 10.209.17.101:7044 10.209.17.101:7045 10.209.17.101:7046 10.209.17.101:7047 10.209.17.101:7048 10.209.17.101:7049 10.209.17.101:7050 10.209.17.101:7051 10.209.17.101:7052 10.209.17.101:7053 10.209.17.101:7054 10.209.17.101:7055 10.209.17.101:7056 10.209.17.101:7057 10.209.17.101:7058 10.209.17.101:7059 10.209.17.101:7060 10.209.17.101:7061 10.209.17.101:7062 10.209.17.101:7063 10.209.17.101:7064 10.209.17.101:7065 10.209.17.101:7066 10.209.17.101:7067 10.209.17.101:7068 10.209.17.101:7069 10.209.17.101:7070 10.209.17.103:7001 10.209.17.103:7002 10.209.17.103:7003 10.209.17.103:7004 10.209.17.103:7005 10.209.17.103:7006 10.209.17.103:7007 10.209.17.103:7008 10.209.17.103:7009 10.209.17.103:7010 10.209.17.103:7011 10.209.17.103:7012 10.209.17.103:7013 10.209.17.103:7014 10.209.17.103:7015 10.209.17.103:7016 10.209.17.103:7017 10.209.17.103:7018 10.209.17.103:7019 10.209.17.103:7020 10.209.17.103:7021 10.209.17.103:7022 10.209.17.103:7023 10.209.17.103:7024 10.209.17.103:7025 10.209.17.103:7026 10.209.17.103:7027 10.209.17.103:7028 10.209.17.103:7029 10.209.17.103:7030 10.209.17.103:7031 10.209.17.103:7032 10.209.17.103:7033 10.209.17.103:7034 10.209.17.103:7035 10.209.17.103:7036 10.209.17.103:7037 10.209.17.103:7038 10.209.17.103:7039 10.209.17.103:7040 10.209.17.103:7041 10.209.17.103:7042 10.209.17.103:7043 10.209.17.103:7044 10.209.17.103:7045 10.209.17.103:7046 10.209.17.103:7047 10.209.17.103:7048 10.209.17.103:7049 10.209.17.103:7050 10.209.17.103:7051 10.209.17.103:7052 10.209.17.103:7053 10.209.17.103:7054 10.209.17.103:7055 10.209.17.103:7056 10.209.17.103:7057 10.209.17.103:7058 10.209.17.103:7059 10.209.17.103:7060 10.209.17.103:7061 10.209.17.103:7062 10.209.17.103:7063 10.209.17.103:7064 10.209.17.103:7065 10.209.17.103:7066 10.209.17.103:7067 10.209.17.103:7068 10.209.17.103:7069 10.209.17.103:7070 10.209.17.105:7001 10.209.17.105:7002 10.209.17.105:7003 10.209.17.105:7004 10.209.17.105:7005 10.209.17.105:7006 10.209.17.105:7007 10.209.17.105:7008 10.209.17.105:7009 10.209.17.105:7010 10.209.17.105:7011 10.209.17.105:7012 10.209.17.105:7013 10.209.17.105:7014 10.209.17.105:7015 10.209.17.105:7016 10.209.17.105:7017 10.209.17.105:7018 10.209.17.105:7019 10.209.17.105:7020 10.209.17.105:7021 10.209.17.105:7022 10.209.17.105:7023 10.209.17.105:7024 10.209.17.105:7025 10.209.17.105:7026 10.209.17.105:7027 10.209.17.105:7028 10.209.17.105:7029 10.209.17.105:7030 10.209.17.105:7031 10.209.17.105:7032 10.209.17.105:7033 10.209.17.105:7034 10.209.17.105:7035 10.209.17.105:7036 10.209.17.105:7037 10.209.17.105:7038 10.209.17.105:7039 10.209.17.105:7040 10.209.17.105:7041 10.209.17.105:7042 10.209.17.105:7043 10.209.17.105:7044 10.209.17.105:7045 10.209.17.105:7046 10.209.17.105:7047 10.209.17.105:7048 10.209.17.105:7049 10.209.17.105:7050 10.209.17.105:7051 10.209.17.105:7052 10.209.17.105:7053 10.209.17.105:7054 10.209.17.105:7055 10.209.17.105:7056 10.209.17.105:7057 10.209.17.105:7058 10.209.17.105:7059 10.209.17.105:7060 10.209.17.105:7061 10.209.17.105:7062 10.209.17.105:7063 10.209.17.105:7064 10.209.17.105:7065 10.209.17.105:7066 10.209.17.105:7067 10.209.17.105:7068 10.209.17.105:7069 10.209.17.105:7070 10.209.17.106:7001 10.209.17.106:7002 10.209.17.106:7003 10.209.17.106:7004 10.209.17.106:7005 10.209.17.106:7006 10.209.17.106:7007 10.209.17.106:7008 10.209.17.106:7009 10.209.17.106:7010 10.209.17.106:7011 10.209.17.106:7012 10.209.17.106:7013 10.209.17.106:7014 10.209.17.106:7015 10.209.17.106:7016 10.209.17.106:7017 10.209.17.106:7018 10.209.17.106:7019 10.209.17.106:7020 10.209.17.106:7021 10.209.17.106:7022 10.209.17.106:7023 10.209.17.106:7024 10.209.17.106:7025 10.209.17.106:7026 10.209.17.106:7027 10.209.17.106:7028 10.209.17.106:7029 10.209.17.106:7030 10.209.17.106:7031 10.209.17.106:7032 10.209.17.106:7033 10.209.17.106:7034 10.209.17.106:7035 10.209.17.106:7036 10.209.17.106:7037 10.209.17.106:7038 10.209.17.106:7039 10.209.17.106:7040 10.209.17.106:7041 10.209.17.106:7042 10.209.17.106:7043 10.209.17.106:7044 10.209.17.106:7045 10.209.17.106:7046 10.209.17.106:7047 10.209.17.106:7048 10.209.17.106:7049 10.209.17.106:7050 10.209.17.106:7051 10.209.17.106:7052 10.209.17.106:7053 10.209.17.106:7054 10.209.17.106:7055 10.209.17.106:7056 10.209.17.106:7057 10.209.17.106:7058 10.209.17.106:7059 10.209.17.106:7060 10.209.17.106:7061 10.209.17.106:7062 10.209.17.106:7063 10.209.17.106:7064 10.209.17.106:7065 10.209.17.106:7066 10.209.17.106:7067 10.209.17.106:7068 10.209.17.106:7069 10.209.17.106:7070 10.209.17.11:7001 10.209.17.11:7002 10.209.17.11:7003 10.209.17.11:7004 10.209.17.11:7005 10.209.17.11:7006 10.209.17.11:7007 10.209.17.11:7008 10.209.17.11:7009 10.209.17.11:7010 10.209.17.11:7011 10.209.17.11:7012 10.209.17.11:7013 10.209.17.11:7014 10.209.17.11:7015 10.209.17.11:7016 10.209.17.11:7017 10.209.17.11:7018 10.209.17.11:7019 10.209.17.11:7020 10.209.17.11:7021 10.209.17.11:7022 10.209.17.11:7023 10.209.17.11:7024 10.209.17.11:7025 10.209.17.11:7026 10.209.17.11:7027 10.209.17.11:7028 10.209.17.11:7029 10.209.17.11:7030 10.209.17.11:7031 10.209.17.11:7032 10.209.17.11:7033 10.209.17.11:7034 10.209.17.11:7035 10.209.17.11:7036 10.209.17.11:7037 10.209.17.11:7038 10.209.17.11:7039 10.209.17.11:7040 10.209.17.11:7041 10.209.17.11:7042 10.209.17.11:7043 10.209.17.11:7044 10.209.17.11:7045 10.209.17.11:7046 10.209.17.11:7047 10.209.17.11:7048 10.209.17.11:7049 10.209.17.11:7050 10.209.17.11:7051 10.209.17.11:7052 10.209.17.11:7053 10.209.17.11:7054 10.209.17.11:7055 10.209.17.11:7056 10.209.17.11:7057 10.209.17.11:7058 10.209.17.11:7059 10.209.17.11:7060 10.209.17.11:7061 10.209.17.11:7062 10.209.17.11:7063 10.209.17.11:7064 10.209.17.11:7065 10.209.17.11:7066 10.209.17.11:7067 10.209.17.11:7068 10.209.17.11:7069 10.209.17.11:7070 10.209.17.110:7001 10.209.17.110:7002 10.209.17.110:7003 10.209.17.110:7004 10.209.17.110:7005 10.209.17.110:7006 10.209.17.110:7007 10.209.17.110:7008 10.209.17.110:7009 10.209.17.110:7010 10.209.17.110:7011 10.209.17.110:7012 10.209.17.110:7013 10.209.17.110:7014 10.209.17.110:7015 10.209.17.110:7016 10.209.17.110:7017 10.209.17.110:7018 10.209.17.110:7019 10.209.17.110:7020 10.209.17.110:7021 10.209.17.110:7022 10.209.17.110:7023 10.209.17.110:7024 10.209.17.110:7025 10.209.17.110:7026 10.209.17.110:7027 10.209.17.110:7028 10.209.17.110:7029 10.209.17.110:7030 10.209.17.110:7031 10.209.17.110:7032 10.209.17.110:7033 10.209.17.110:7034 10.209.17.110:7035 10.209.17.110:7036 10.209.17.110:7037 10.209.17.110:7038 10.209.17.110:7039 10.209.17.110:7040 10.209.17.110:7041 10.209.17.110:7042 10.209.17.110:7043 10.209.17.110:7044 10.209.17.110:7045 10.209.17.110:7046 10.209.17.110:7047 10.209.17.110:7048 10.209.17.110:7049 10.209.17.110:7050 10.209.17.110:7051 10.209.17.110:7052 10.209.17.110:7053 10.209.17.110:7054 10.209.17.110:7055 10.209.17.110:7056 10.209.17.110:7057 10.209.17.110:7058 10.209.17.110:7059 10.209.17.110:7060 10.209.17.110:7061 10.209.17.110:7062 10.209.17.110:7063 10.209.17.110:7064 10.209.17.110:7065 10.209.17.110:7066 10.209.17.110:7067 10.209.17.110:7068 10.209.17.110:7069 10.209.17.110:7070 10.209.17.117:7001 10.209.17.117:7002 10.209.17.117:7003 10.209.17.117:7004 10.209.17.117:7005 10.209.17.117:7006 10.209.17.117:7007 10.209.17.117:7008 10.209.17.117:7009 10.209.17.117:7010 10.209.17.117:7011 10.209.17.117:7012 10.209.17.117:7013 10.209.17.117:7014 10.209.17.117:7015 10.209.17.117:7016 10.209.17.117:7017 10.209.17.117:7018 10.209.17.117:7019 10.209.17.117:7020 10.209.17.117:7021 10.209.17.117:7022 10.209.17.117:7023 10.209.17.117:7024 10.209.17.117:7025 10.209.17.117:7026 10.209.17.117:7027 10.209.17.117:7028 10.209.17.117:7029 10.209.17.117:7030 10.209.17.117:7031 10.209.17.117:7032 10.209.17.117:7033 10.209.17.117:7034 10.209.17.117:7035 10.209.17.117:7036 10.209.17.117:7037 10.209.17.117:7038 10.209.17.117:7039 10.209.17.117:7040 10.209.17.117:7041 10.209.17.117:7042 10.209.17.117:7043 10.209.17.117:7044 10.209.17.117:7045 10.209.17.117:7046 10.209.17.117:7047 10.209.17.117:7048 10.209.17.117:7049 10.209.17.117:7050 10.209.17.117:7051 10.209.17.117:7052 10.209.17.117:7053 10.209.17.117:7054 10.209.17.117:7055 10.209.17.117:7056 10.209.17.117:7057 10.209.17.117:7058 10.209.17.117:7059 10.209.17.117:7060 10.209.17.117:7061 10.209.17.117:7062 10.209.17.117:7063 10.209.17.117:7064 10.209.17.117:7065 10.209.17.117:7066 10.209.17.117:7067 10.209.17.117:7068 10.209.17.117:7069 10.209.17.117:7070 10.209.17.12:7001 10.209.17.12:7002 10.209.17.12:7003 10.209.17.12:7004 10.209.17.12:7005 10.209.17.12:7006 10.209.17.12:7007 10.209.17.12:7008 10.209.17.12:7009 10.209.17.12:7010 10.209.17.12:7011 10.209.17.12:7012 10.209.17.12:7013 10.209.17.12:7014 10.209.17.12:7015 10.209.17.12:7016 10.209.17.12:7017 10.209.17.12:7018 10.209.17.12:7019 10.209.17.12:7020 10.209.17.12:7021 10.209.17.12:7022 10.209.17.12:7023 10.209.17.12:7024 10.209.17.12:7025 10.209.17.12:7026 10.209.17.12:7027 10.209.17.12:7028 10.209.17.12:7029 10.209.17.12:7030 10.209.17.12:7031 10.209.17.12:7032 10.209.17.12:7033 10.209.17.12:7034 10.209.17.12:7035 10.209.17.12:7036 10.209.17.12:7037 10.209.17.12:7038 10.209.17.12:7039 10.209.17.12:7040 10.209.17.12:7041 10.209.17.12:7042 10.209.17.12:7043 10.209.17.12:7044 10.209.17.12:7045 10.209.17.12:7046 10.209.17.12:7047 10.209.17.12:7048 10.209.17.12:7049 10.209.17.12:7050 10.209.17.12:7051 10.209.17.12:7052 10.209.17.12:7053 10.209.17.12:7054 10.209.17.12:7055 10.209.17.12:7056 10.209.17.12:7057 10.209.17.12:7058 10.209.17.12:7059 10.209.17.12:7060 10.209.17.12:7061 10.209.17.12:7062 10.209.17.12:7063 10.209.17.12:7064 10.209.17.12:7065 10.209.17.12:7066 10.209.17.12:7067 10.209.17.12:7068 10.209.17.12:7069 10.209.17.12:7070 10.209.17.122:7001 10.209.17.122:7002 10.209.17.122:7003 10.209.17.122:7004 10.209.17.122:7005 10.209.17.122:7006 10.209.17.122:7007 10.209.17.122:7008 10.209.17.122:7009 10.209.17.122:7010 10.209.17.122:7011 10.209.17.122:7012 10.209.17.122:7013 10.209.17.122:7014 10.209.17.122:7015 10.209.17.122:7016 10.209.17.122:7017 10.209.17.122:7018 10.209.17.122:7019 10.209.17.122:7020 10.209.17.122:7021 10.209.17.122:7022 10.209.17.122:7023 10.209.17.122:7024 10.209.17.122:7025 10.209.17.122:7026 10.209.17.122:7027 10.209.17.122:7028 10.209.17.122:7029 10.209.17.122:7030 10.209.17.122:7031 10.209.17.122:7032 10.209.17.122:7033 10.209.17.122:7034 10.209.17.122:7035 10.209.17.122:7036 10.209.17.122:7037 10.209.17.122:7038 10.209.17.122:7039 10.209.17.122:7040 10.209.17.122:7041 10.209.17.122:7042 10.209.17.122:7043 10.209.17.122:7044 10.209.17.122:7045 10.209.17.122:7046 10.209.17.122:7047 10.209.17.122:7048 10.209.17.122:7049 10.209.17.122:7050 10.209.17.122:7051 10.209.17.122:7052 10.209.17.122:7053 10.209.17.122:7054 10.209.17.122:7055 10.209.17.122:7056 10.209.17.122:7057 10.209.17.122:7058 10.209.17.122:7059 10.209.17.122:7060 10.209.17.122:7061 10.209.17.122:7062 10.209.17.122:7063 10.209.17.122:7064 10.209.17.122:7065 10.209.17.122:7066 10.209.17.122:7067 10.209.17.122:7068 10.209.17.122:7069 10.209.17.122:7070 10.209.17.13:7001 10.209.17.13:7002 10.209.17.13:7003 10.209.17.13:7004 10.209.17.13:7005 10.209.17.13:7006 10.209.17.13:7007 10.209.17.13:7008 10.209.17.13:7009 10.209.17.13:7010 10.209.17.13:7011 10.209.17.13:7012 10.209.17.13:7013 10.209.17.13:7014 10.209.17.13:7015 10.209.17.13:7016 10.209.17.13:7017 10.209.17.13:7018 10.209.17.13:7019 10.209.17.13:7020 10.209.17.13:7021 10.209.17.13:7022 10.209.17.13:7023 10.209.17.13:7024 10.209.17.13:7025 10.209.17.13:7026 10.209.17.13:7027 10.209.17.13:7028 10.209.17.13:7029 10.209.17.13:7030 10.209.17.13:7031 10.209.17.13:7032 10.209.17.13:7033 10.209.17.13:7034 10.209.17.13:7035 10.209.17.13:7036 10.209.17.13:7037 10.209.17.13:7038 10.209.17.13:7039 10.209.17.13:7040 10.209.17.13:7041 10.209.17.13:7042 10.209.17.13:7043 10.209.17.13:7044 10.209.17.13:7045 10.209.17.13:7046 10.209.17.13:7047 10.209.17.13:7048 10.209.17.13:7049 10.209.17.13:7050 10.209.17.13:7051 10.209.17.13:7052 10.209.17.13:7053 10.209.17.13:7054 10.209.17.13:7055 10.209.17.13:7056 10.209.17.13:7057 10.209.17.13:7058 10.209.17.13:7059 10.209.17.13:7060 10.209.17.13:7061 10.209.17.13:7062 10.209.17.13:7063 10.209.17.13:7064 10.209.17.13:7065 10.209.17.13:7066 10.209.17.13:7067 10.209.17.13:7068 10.209.17.13:7069 10.209.17.13:7070 10.209.17.14:7001 10.209.17.14:7002 10.209.17.14:7003 10.209.17.14:7004 10.209.17.14:7005 10.209.17.14:7006 10.209.17.14:7007 10.209.17.14:7008 10.209.17.14:7009 10.209.17.14:7010 10.209.17.14:7011 10.209.17.14:7012 10.209.17.14:7013 10.209.17.14:7014 10.209.17.14:7015 10.209.17.14:7016 10.209.17.14:7017 10.209.17.14:7018 10.209.17.14:7019 10.209.17.14:7020 10.209.17.14:7021 10.209.17.14:7022 10.209.17.14:7023 10.209.17.14:7024 10.209.17.14:7025 10.209.17.14:7026 10.209.17.14:7027 10.209.17.14:7028 10.209.17.14:7029 10.209.17.14:7030 10.209.17.14:7031 10.209.17.14:7032 10.209.17.14:7033 10.209.17.14:7034 10.209.17.14:7035 10.209.17.14:7036 10.209.17.14:7037 10.209.17.14:7038 10.209.17.14:7039 10.209.17.14:7040 10.209.17.14:7041 10.209.17.14:7042 10.209.17.14:7043 10.209.17.14:7044 10.209.17.14:7045 10.209.17.14:7046 10.209.17.14:7047 10.209.17.14:7048 10.209.17.14:7049 10.209.17.14:7050 10.209.17.14:7051 10.209.17.14:7052 10.209.17.14:7053 10.209.17.14:7054 10.209.17.14:7055 10.209.17.14:7056 10.209.17.14:7057 10.209.17.14:7058 10.209.17.14:7059 10.209.17.14:7060 10.209.17.14:7061 10.209.17.14:7062 10.209.17.14:7063 10.209.17.14:7064 10.209.17.14:7065 10.209.17.14:7066 10.209.17.14:7067 10.209.17.14:7068 10.209.17.14:7069 10.209.17.14:7070 10.209.17.15:7001 10.209.17.15:7002 10.209.17.15:7003 10.209.17.15:7004 10.209.17.15:7005 10.209.17.15:7006 10.209.17.15:7007 10.209.17.15:7008 10.209.17.15:7009 10.209.17.15:7010 10.209.17.15:7011 10.209.17.15:7012 10.209.17.15:7013 10.209.17.15:7014 10.209.17.15:7015 10.209.17.15:7016 10.209.17.15:7017 10.209.17.15:7018 10.209.17.15:7019 10.209.17.15:7020 10.209.17.15:7021 10.209.17.15:7022 10.209.17.15:7023 10.209.17.15:7024 10.209.17.15:7025 10.209.17.15:7026 10.209.17.15:7027 10.209.17.15:7028 10.209.17.15:7029 10.209.17.15:7030 10.209.17.15:7031 10.209.17.15:7032 10.209.17.15:7033 10.209.17.15:7034 10.209.17.15:7035 10.209.17.15:7036 10.209.17.15:7037 10.209.17.15:7038 10.209.17.15:7039 10.209.17.15:7040 10.209.17.15:7041 10.209.17.15:7042 10.209.17.15:7043 10.209.17.15:7044 10.209.17.15:7045 10.209.17.15:7046 10.209.17.15:7047 10.209.17.15:7048 10.209.17.15:7049 10.209.17.15:7050 10.209.17.15:7051 10.209.17.15:7052 10.209.17.15:7053 10.209.17.15:7054 10.209.17.15:7055 10.209.17.15:7056 10.209.17.15:7057 10.209.17.15:7058 10.209.17.15:7059 10.209.17.15:7060 10.209.17.15:7061 10.209.17.15:7062 10.209.17.15:7063 10.209.17.15:7064 10.209.17.15:7065 10.209.17.15:7066 10.209.17.15:7067 10.209.17.15:7068 10.209.17.15:7069 10.209.17.15:7070 10.209.17.16:7001 10.209.17.16:7002 10.209.17.16:7003 10.209.17.16:7004 10.209.17.16:7005 10.209.17.16:7006 10.209.17.16:7007 10.209.17.16:7008 10.209.17.16:7009 10.209.17.16:7010 10.209.17.16:7011 10.209.17.16:7012 10.209.17.16:7013 10.209.17.16:7014 10.209.17.16:7015 10.209.17.16:7016 10.209.17.16:7017 10.209.17.16:7018 10.209.17.16:7019 10.209.17.16:7020 10.209.17.16:7021 10.209.17.16:7022 10.209.17.16:7023 10.209.17.16:7024 10.209.17.16:7025 10.209.17.16:7026 10.209.17.16:7027 10.209.17.16:7028 10.209.17.16:7029 10.209.17.16:7030 10.209.17.16:7031 10.209.17.16:7032 10.209.17.16:7033 10.209.17.16:7034 10.209.17.16:7035 10.209.17.16:7036 10.209.17.16:7037 10.209.17.16:7038 10.209.17.16:7039 10.209.17.16:7040 10.209.17.16:7041 10.209.17.16:7042 10.209.17.16:7043 10.209.17.16:7044 10.209.17.16:7045 10.209.17.16:7046 10.209.17.16:7047 10.209.17.16:7048 10.209.17.16:7049 10.209.17.16:7050 10.209.17.16:7051 10.209.17.16:7052 10.209.17.16:7053 10.209.17.16:7054 10.209.17.16:7055 10.209.17.16:7056 10.209.17.16:7057 10.209.17.16:7058 10.209.17.16:7059 10.209.17.16:7060 10.209.17.16:7061 10.209.17.16:7062 10.209.17.16:7063 10.209.17.16:7064 10.209.17.16:7065 10.209.17.16:7066 10.209.17.16:7067 10.209.17.16:7068 10.209.17.16:7069 10.209.17.16:7070 10.209.17.17:7001 10.209.17.17:7002 10.209.17.17:7003 10.209.17.17:7004 10.209.17.17:7005 10.209.17.17:7006 10.209.17.17:7007 10.209.17.17:7008 10.209.17.17:7009 10.209.17.17:7010 10.209.17.17:7011 10.209.17.17:7012 10.209.17.17:7013 10.209.17.17:7014 10.209.17.17:7015 10.209.17.17:7016 10.209.17.17:7017 10.209.17.17:7018 10.209.17.17:7019 10.209.17.17:7020 10.209.17.17:7021 10.209.17.17:7022 10.209.17.17:7023 10.209.17.17:7024 10.209.17.17:7025 10.209.17.17:7026 10.209.17.17:7027 10.209.17.17:7028 10.209.17.17:7029 10.209.17.17:7030 10.209.17.17:7031 10.209.17.17:7032 10.209.17.17:7033 10.209.17.17:7034 10.209.17.17:7035 10.209.17.17:7036 10.209.17.17:7037 10.209.17.17:7038 10.209.17.17:7039 10.209.17.17:7040 10.209.17.17:7041 10.209.17.17:7042 10.209.17.17:7043 10.209.17.17:7044 10.209.17.17:7045 10.209.17.17:7046 10.209.17.17:7047 10.209.17.17:7048 10.209.17.17:7049 10.209.17.17:7050 10.209.17.17:7051 10.209.17.17:7052 10.209.17.17:7053 10.209.17.17:7054 10.209.17.17:7055 10.209.17.17:7056 10.209.17.17:7057 10.209.17.17:7058 10.209.17.17:7059 10.209.17.17:7060 10.209.17.17:7061 10.209.17.17:7062 10.209.17.17:7063 10.209.17.17:7064 10.209.17.17:7065 10.209.17.17:7066 10.209.17.17:7067 10.209.17.17:7068 10.209.17.17:7069 10.209.17.17:7070 10.209.17.18:7001 10.209.17.18:7002 10.209.17.18:7003 10.209.17.18:7004 10.209.17.18:7005 10.209.17.18:7006 10.209.17.18:7007 10.209.17.18:7008 10.209.17.18:7009 10.209.17.18:7010 10.209.17.18:7011 10.209.17.18:7012 10.209.17.18:7013 10.209.17.18:7014 10.209.17.18:7015 10.209.17.18:7016 10.209.17.18:7017 10.209.17.18:7018 10.209.17.18:7019 10.209.17.18:7020 10.209.17.18:7021 10.209.17.18:7022 10.209.17.18:7023 10.209.17.18:7024 10.209.17.18:7025 10.209.17.18:7026 10.209.17.18:7027 10.209.17.18:7028 10.209.17.18:7029 10.209.17.18:7030 10.209.17.18:7031 10.209.17.18:7032 10.209.17.18:7033 10.209.17.18:7034 10.209.17.18:7035 10.209.17.18:7036 10.209.17.18:7037 10.209.17.18:7038 10.209.17.18:7039 10.209.17.18:7040 10.209.17.18:7041 10.209.17.18:7042 10.209.17.18:7043 10.209.17.18:7044 10.209.17.18:7045 10.209.17.18:7046 10.209.17.18:7047 10.209.17.18:7048 10.209.17.18:7049 10.209.17.18:7050 10.209.17.18:7051 10.209.17.18:7052 10.209.17.18:7053 10.209.17.18:7054 10.209.17.18:7055 10.209.17.18:7056 10.209.17.18:7057 10.209.17.18:7058 10.209.17.18:7059 10.209.17.18:7060 10.209.17.18:7061 10.209.17.18:7062 10.209.17.18:7063 10.209.17.18:7064 10.209.17.18:7065 10.209.17.18:7066 10.209.17.18:7067 10.209.17.18:7068 10.209.17.18:7069 10.209.17.18:7070 10.209.17.19:7001 10.209.17.19:7002 10.209.17.19:7003 10.209.17.19:7004 10.209.17.19:7005 10.209.17.19:7006 10.209.17.19:7007 10.209.17.19:7008 10.209.17.19:7009 10.209.17.19:7010 10.209.17.19:7011 10.209.17.19:7012 10.209.17.19:7013 10.209.17.19:7014 10.209.17.19:7015 10.209.17.19:7016 10.209.17.19:7017 10.209.17.19:7018 10.209.17.19:7019 10.209.17.19:7020 10.209.17.19:7021 10.209.17.19:7022 10.209.17.19:7023 10.209.17.19:7024 10.209.17.19:7025 10.209.17.19:7026 10.209.17.19:7027 10.209.17.19:7028 10.209.17.19:7029 10.209.17.19:7030 10.209.17.19:7031 10.209.17.19:7032 10.209.17.19:7033 10.209.17.19:7034 10.209.17.19:7035 10.209.17.19:7036 10.209.17.19:7037 10.209.17.19:7038 10.209.17.19:7039 10.209.17.19:7040 10.209.17.19:7041 10.209.17.19:7042 10.209.17.19:7043 10.209.17.19:7044 10.209.17.19:7045 10.209.17.19:7046 10.209.17.19:7047 10.209.17.19:7048 10.209.17.19:7049 10.209.17.19:7050 10.209.17.19:7051 10.209.17.19:7052 10.209.17.19:7053 10.209.17.19:7054 10.209.17.19:7055 10.209.17.19:7056 10.209.17.19:7057 10.209.17.19:7058 10.209.17.19:7059 10.209.17.19:7060 10.209.17.19:7061 10.209.17.19:7062 10.209.17.19:7063 10.209.17.19:7064 10.209.17.19:7065 10.209.17.19:7066 10.209.17.19:7067 10.209.17.19:7068 10.209.17.19:7069 10.209.17.19:7070 10.209.17.2:7001 10.209.17.2:7002 10.209.17.2:7003 10.209.17.2:7004 10.209.17.2:7005 10.209.17.2:7006 10.209.17.2:7007 10.209.17.2:7008 10.209.17.2:7009 10.209.17.2:7010 10.209.17.2:7011 10.209.17.2:7012 10.209.17.2:7013 10.209.17.2:7014 10.209.17.2:7015 10.209.17.2:7016 10.209.17.2:7017 10.209.17.2:7018 10.209.17.2:7019 10.209.17.2:7020 10.209.17.2:7021 10.209.17.2:7022 10.209.17.2:7023 10.209.17.2:7024 10.209.17.2:7025 10.209.17.2:7026 10.209.17.2:7027 10.209.17.2:7028 10.209.17.2:7029 10.209.17.2:7030 10.209.17.2:7031 10.209.17.2:7032 10.209.17.2:7033 10.209.17.2:7034 10.209.17.2:7035 10.209.17.2:7036 10.209.17.2:7037 10.209.17.2:7038 10.209.17.2:7039 10.209.17.2:7040 10.209.17.2:7041 10.209.17.2:7042 10.209.17.2:7043 10.209.17.2:7044 10.209.17.2:7045 10.209.17.2:7046 10.209.17.2:7047 10.209.17.2:7048 10.209.17.2:7049 10.209.17.2:7050 10.209.17.2:7051 10.209.17.2:7052 10.209.17.2:7053 10.209.17.2:7054 10.209.17.2:7055 10.209.17.2:7056 10.209.17.2:7057 10.209.17.2:7058 10.209.17.2:7059 10.209.17.2:7060 10.209.17.2:7061 10.209.17.2:7062 10.209.17.2:7063 10.209.17.2:7064 10.209.17.2:7065 10.209.17.2:7066 10.209.17.2:7067 10.209.17.2:7068 10.209.17.2:7069 10.209.17.2:7070 10.209.17.20:7001 10.209.17.20:7002 10.209.17.20:7003 10.209.17.20:7004 10.209.17.20:7005 10.209.17.20:7006 10.209.17.20:7007 10.209.17.20:7008 10.209.17.20:7009 10.209.17.20:7010 10.209.17.20:7011 10.209.17.20:7012 10.209.17.20:7013 10.209.17.20:7014 10.209.17.20:7015 10.209.17.20:7016 10.209.17.20:7017 10.209.17.20:7018 10.209.17.20:7019 10.209.17.20:7020 10.209.17.20:7021 10.209.17.20:7022 10.209.17.20:7023 10.209.17.20:7024 10.209.17.20:7025 10.209.17.20:7026 10.209.17.20:7027 10.209.17.20:7028 10.209.17.20:7029 10.209.17.20:7030 10.209.17.20:7031 10.209.17.20:7032 10.209.17.20:7033 10.209.17.20:7034 10.209.17.20:7035 10.209.17.20:7036 10.209.17.20:7037 10.209.17.20:7038 10.209.17.20:7039 10.209.17.20:7040 10.209.17.20:7041 10.209.17.20:7042 10.209.17.20:7043 10.209.17.20:7044 10.209.17.20:7045 10.209.17.20:7046 10.209.17.20:7047 10.209.17.20:7048 10.209.17.20:7049 10.209.17.20:7050 10.209.17.20:7051 10.209.17.20:7052 10.209.17.20:7053 10.209.17.20:7054 10.209.17.20:7055 10.209.17.20:7056 10.209.17.20:7057 10.209.17.20:7058 10.209.17.20:7059 10.209.17.20:7060 10.209.17.20:7061 10.209.17.20:7062 10.209.17.20:7063 10.209.17.20:7064 10.209.17.20:7065 10.209.17.20:7066 10.209.17.20:7067 10.209.17.20:7068 10.209.17.20:7069 10.209.17.20:7070 10.209.17.21:7001 10.209.17.21:7002 10.209.17.21:7003 10.209.17.21:7004 10.209.17.21:7005 10.209.17.21:7006 10.209.17.21:7007 10.209.17.21:7008 10.209.17.21:7009 10.209.17.21:7010 10.209.17.21:7011 10.209.17.21:7012 10.209.17.21:7013 10.209.17.21:7014 10.209.17.21:7015 10.209.17.21:7016 10.209.17.21:7017 10.209.17.21:7018 10.209.17.21:7019 10.209.17.21:7020 10.209.17.21:7021 10.209.17.21:7022 10.209.17.21:7023 10.209.17.21:7024 10.209.17.21:7025 10.209.17.21:7026 10.209.17.21:7027 10.209.17.21:7028 10.209.17.21:7029 10.209.17.21:7030 10.209.17.21:7031 10.209.17.21:7032 10.209.17.21:7033 10.209.17.21:7034 10.209.17.21:7035 10.209.17.21:7036 10.209.17.21:7037 10.209.17.21:7038 10.209.17.21:7039 10.209.17.21:7040 10.209.17.21:7041 10.209.17.21:7042 10.209.17.21:7043 10.209.17.21:7044 10.209.17.21:7045 10.209.17.21:7046 10.209.17.21:7047 10.209.17.21:7048 10.209.17.21:7049 10.209.17.21:7050 10.209.17.21:7051 10.209.17.21:7052 10.209.17.21:7053 10.209.17.21:7054 10.209.17.21:7055 10.209.17.21:7056 10.209.17.21:7057 10.209.17.21:7058 10.209.17.21:7059 10.209.17.21:7060 10.209.17.21:7061 10.209.17.21:7062 10.209.17.21:7063 10.209.17.21:7064 10.209.17.21:7065 10.209.17.21:7066 10.209.17.21:7067 10.209.17.21:7068 10.209.17.21:7069 10.209.17.21:7070

系统会给出一个集群的预分配方案,没有问题,直接yes,继续操作。

重置集群的方式是在每个节点上个执行cluster reset,然后重新创建集群.

如果加了密码,那么创建集群时就需要加-a NBD参数

不然会报以下错误:

[ERR] Node 10.209.17.10:7001 NOAUTH Authentication required.

8.查看集群信息并且验证

因为节点太多所以显示不全:

[root@wzy-cloud redis_cluster]# redis-cli -c -p 7001
127.0.0.1:7001> auth NBD
OK
127.0.0.1:7001> cluster nodes
....
efc817d0ac1c618cac2488e6b0d0b1dc2aa3ff9e 10.209.17.13:7051@17051 slave c0b20d79a24b7ddc92d9c57841630443e4fd3d3a 0 1616142660000 751 connected
259c1bd8c636b591ddb20449d2a6597a96da71d3 10.209.17.18:7015@17015 master - 0 1616142661000 1065 connected 6905-6927
11c304110820055891f6edbcf6f3014a7615626d 10.209.17.13:7010@17010 master - 0 1616142660000 710 connected 4447-4469
0d19121bc7c131d62456bab5f4baea343bb20b2e 10.209.17.117:7061@17061 slave 512899081690267e773eb3e25e0013442555c735 0 1616142659000 551 connected
b52b6d0b19604ff6b6fd4592659182651ebbec00 10.209.17.2:7014@17014 master - 0 1616142660000 1204 connected 6483-6506
e71b0002c2744cd4a7718f088e9fb663994037f5 10.209.17.2:7033@17033 master - 0 1616142658000 1223 connected 15377-15400
f11c898127be2107941eab0913ec394f6cbee5ca 10.209.17.20:7059@17059 slave 9139ffe08bde8e077ed741e3da49d497a9937541 0 1616142659000 1319 connected
0c4bcd830ab65a3bee615e280594f93d1f8294bf 10.209.17.18:7063@17063 slave 65bd7c5e63a9e95c2fa0d627941543330cb3824c 0 1616142659000 1113 connected
3e35ac8a0f49ef6ca05c29612cf2886d72eaa2de 10.209.17.20:7023@17023 master - 0 1616142660000 1283 connected 10720-10742
127.0.0.1:7001> set name hcxt_test
-> Redirected to slot [5798] located at 10.209.17.117:7013
(error) NOAUTH Authentication required.
10.209.17.117:7013> auth NBD
OK
10.209.17.117:7013> set name hcxt_test
OK
10.209.17.117:7013> get name
"hcxt_test"
10.209.17.117:7013> 

6.Redis的三种启动方式、停止

redis的启动方式

1.直接启动

进入redis根目录,执行命令:
#加上‘&’号使redis以后台程序方式运行

redis-server &
2.通过指定配置文件启动

可以为redis服务启动指定配置文件,例如配置为/etc/redis/6379.conf
进入redis根目录,输入命令:

redis-server /data//redis/xxx/redis.conf

#如果更改了端口,使用redis-cli客户端连接时,也需要指定端口,例如:

redis-cli -p 6380 
3.启动指定IP的redis-cli(-h IP地址、-p 端口、-a 密码)
redis-cli -h 127.0.0.1 -p 6379 -a 12345


redis-cli  -p 6379 -a NBD
4.停止执行命令:
redis-cli -p 7068 shutdown -a testmaster123
redis-cli -p 7000  -a NBD shutdown
#哨兵
redis-cli -p 26379  -a testmaster123 shutdown
5.redis集群删除
#!/bin/bash
pid_name="redis"
echo "杀死的进程名称:" $pid_name
 
pid=$(ps -ef|grep $pid_name|grep -v grep|awk '{print $2}')
 
echo "pid列表:" $pid
 
for item in $pid
do
  echo "杀死进程pid=" $item
  kill -9 $item
done

参考:

https://redis.io/documentation

https://blog.csdn.net/aloneno/article/details/96370167

https://blog.csdn.net/qq_33996921/article/details/105462595

https://blog.csdn.net/qq_35887546/article/details/104799272

发表评论

您的电子邮箱地址不会被公开。