文章目录
下载redis最新版,中文官网 http://www.redis.cn/download.html
wget http://download.redis.io/releases/redis-5.0.0.tar.gz
tar xzf redis-5.0.0.tar.gz
cd redis-5.0.0
make #src目录下生成二进制文件
1,命令行
库操作: 0-15号 | 数据管理: key操作 | |||
---|---|---|---|---|
显示当前的库存量 | dbsize | 显示当前的库所有key | keys * | |
删除当前库所有数据 | flushdb | 添加新数据key | set key1 aaaa | |
选择一个库:默认0 | select 1 | 查询某key的数据 | get key1 | |
-------- | ------- | |||
查看redis 状态 | info | key重命名 | rename key1 key2 | |
保存所有库的数据 | save | 查询某key是否存在 | exsists key1 | |
删除所有库的数据 | flushall | 移动数据到指定的库 | move key1 2 |
list操作 | set操作 | |||
---|---|---|---|---|
头部添加数据 | lpush list1 1 2 3 4 | 添加元素 | sadd set1 1 1 2 2 3 | |
尾部添加数据 | rpush list1 1 2 3 4 | |||
------ | -------- | |||
删除首个元素 | lpop list2 | 删除指定元素 | srem set1 1 2 3 | |
删除最后一个元素 | rpop list2 | |||
------ | -------- | |||
修改某下标的元素 | lset list2 6 777777 | |||
获取某下标的元素 | lindex list1 0 | |||
查看所有元素: | lrange list3 0 -1 | 查看所有元素 | smembers set1 | |
查看总长度 | llen list3 | 查看总长度 | scard set1 |
map操作 | |
---|---|
单个添加kv | hset map1 k1 v1 |
单个获取kv | hget map1 k1 |
批量插入 | hmset map1 k2 v2 k3 v3 |
批量获取 | hmget map1 k1 k2 k3 |
2,redis集群搭建 (后台启动)
a,进入redis解压目录: 单机模拟集群创建
cd /soft/redis-5.0.0/
#创建目录: 存放不同的配置文件
cp redis.conf redis.conf.bak
cat > redis.conf<<EOF
bind 0.0.0.0
port 6379
#服务后台启动,默认pid /var/run/redis.pid
daemonize yes
protected-mode no
pidfile /var/run/redis_6379.pid
logfile /var/log/redis_6379.log
requirepass 123456
masterauth 123456
dir /var/lib/redis/6379
dbfilename dump.rdb
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
EOF
mkdir -p cluster-conf/637{1,2,3,4,5,6}
for i in 637{1..6}
do
mkdir -p /var/lib/redis/$i
cp redis.conf cluster-conf/$i/redis.conf
sed -i "s@6379@637$i@g" cluster-conf/$i/redis.conf
#sed -i "s@bind 127.0.0.1@bind 192.168.56.111@g" cluster-conf/$i/redis.conf
#sed -i "s@daemonize no@daemonize yes@g" cluster-conf/$i/redis.conf
#sed -i "s@protected-mode yes@protected-mode no@g" cluster-conf/$i/redis.conf
done
b,启动所有节点,并创建集群
cd cluster-conf/
find ../src/ -executable -type f -exec cp {} . \;
echo '
dir=$(readlink -f . )
for i in 637{1..6}
do
$dir/redis-server $dir/$i/redis.conf
done' >> cluster-start.sh
chmod +x cluster-start.sh
./cluster-start.sh
#创建集群
./redis-cli --cluster create \
192.168.56.111:7006 \
192.168.56.111:7001 \
192.168.56.111:7002 \
192.168.56.111:7003 \
192.168.56.111:7004 \
192.168.56.111:7005 \
--cluster-replicas 1
查看集群管理帮助:
日志和数据目录
# 数据目录
[root1@c7-docker cluster-conf]# ./redis-cli -p 6376 -a 123456 -c --cluster check localhost:6371^C
[root1@c7-docker cluster-conf]# find / -name nodes.conf
/var/lib/redis/6371/nodes.conf
/var/lib/redis/6372/nodes.conf
...
[root1@c7-docker cluster-conf]# cat /var/lib/redis/6371/nodes.conf
ca3e596089a14dfeefc5a3692ef2115621158c41 192.168.56.117:6376@16376 slave dd9e5dac6dffb4254b94d96955f0e37567fd18fa 0 1611103744000 6 connected
dd9e5dac6dffb4254b94d96955f0e37567fd18fa 192.168.56.117:6371@16371 myself,master - 0 1611103742000 1 connected 500-5460
7211856e71c08c3f9829bd99cabbf484e1560593 192.168.56.117:6372@16372 master - 0 1611103744538 7 connected 0-499 5461-11422
537439290adc5117a2adbb307edab0136bb56e30 192.168.56.117:6374@16374 slave 7211856e71c08c3f9829bd99cabbf484e1560593 0 1611103744643 7 connected
f51471685e486c0b199a1943d7b5091c7299fbe8 192.168.56.117:6373@16373 master,fail - 1611103717657 1611103716000 3 disconnected
4887290b3d69f29269a95de932a5eac92af4fb7e 192.168.56.117:6375@16375 master - 0 1611103743600 9 connected 11423-16383
vars currentEpoch 9 lastVoteEpoch 9
[root1@c7-docker cluster-conf]# ls /var/lib/redis/6371/
appendonly.aof dump.rdb nodes.conf
# 日志查看
[root1@c7-docker cluster-conf]# tailf /var/log/redis
redis_6371.log redis_6372.log redis_6373.log
redis_6374.log redis_6375.log redis_6376.log redis_6377.log
[root1@c7-docker cluster-conf]# tailf /var/log/redis_6371.log
4086:M 19 Jan 2021 16:57:59.453 # Creating Server TCP listening socket 0.0.0.0:6371: bind: Address already in use
4170:C 19 Jan 2021 16:58:10.249 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
4170:C 19 Jan 2021 16:58:10.249 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=4170, just started
4170:C 19 Jan 2021 16:58:10.249 # Configuration loaded
4171:M 19 Jan 2021 16:58:10.250 # Creating Server TCP listening socket 0.0.0.0:6371: bind: Address already in use
31678:M 20 Jan 2021 08:48:44.222 # Failover auth denied to 4887290b3d69f29269a95de932a5eac92af4fb7e: its master is up
31678:M 20 Jan 2021 08:48:45.132 * Marking node f51471685e486c0b199a1943d7b5091c7299fbe8 as failing (quorum reached).
31678:M 20 Jan 2021 08:48:45.132 # Cluster state changed: fail
31678:M 20 Jan 2021 08:49:04.860 # Failover auth granted to 4887290b3d69f29269a95de932a5eac92af4fb7e for epoch 9
31678:M 20 Jan 2021 08:49:04.900 # Cluster state changed: ok
命令行:查看集群所有key
[root@c73 redis]# ./redis-cli -p 7001 -c -h 192.168.56.73 --cluster call 192.168.56.73:7001 keys \*
>>> Calling keys *
192.168.56.73:7001:
192.168.56.73:7004: ttt
192.168.56.73:7003:
192.168.56.73:7005: 11
aa
192.168.56.73:7006: aa
11
192.168.56.73:7002: ttt
管理集群和节点:
#查看集群id,角色分布
./redis-cli -a 123456 --cluster check localhost:6371
#登录客户端,查看集群信息
#./redis-cli -c -p 6371
#localhost:6371> cluster info
#localhost:6371> cluster nodes
#添加节点: 192.168.56.117:6377 已经存在的IP:port
./redis-cli -a 123456 --cluster add-node 192.168.56.117:6377 192.168.56.117:6371 \
--cluster-slave --cluster-master-id f51471685e486c0b199a1943d7b5091c7299fbe8
#重新shard( 删除Master节点前,不能有分配slot, 需要reshard)
[root1@c7-docker cluster-conf]# ./redis-cli -p 6371 -a 123456 -c --cluster reshard 192.168.56.117:6372
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing Cluster Check (using node 192.168.56.117:6372)
M: 7211856e71c08c3f9829bd99cabbf484e1560593 192.168.56.117:6372
slots: (0 slots) master
M: dd9e5dac6dffb4254b94d96955f0e37567fd18fa 192.168.56.117:6371
slots:[0-16383] (16384 slots) master
3 additional replica(s)
....
How many slots do you want to move (from 1 to 16384)? 8192
What is the receiving node ID? 7211856e71c08c3f9829bd99cabbf484e1560593
Please enter all the source node IDs.
Type 'all' to use all the nodes as source nodes for the hash slots.
Type 'done' once you entered all the source nodes IDs.
Source node #1: all
Ready to move 8192 slots.
Source nodes:
M: dd9e5dac6dffb4254b94d96955f0e37567fd18fa 192.168.56.117:6371
slots:[0-16383] (16384 slots) master
3 additional replica(s)
Destination node:
M: 7211856e71c08c3f9829bd99cabbf484e1560593 192.168.56.117:6372
slots: (0 slots) master
Resharding plan:
Moving slot 0 from dd9e5dac6dffb4254b94d96955f0e37567fd18fa
Moving slot 1 from dd9e5dac6dffb4254b94d96955f0e37567fd18fa
.....
#删除(备)节点 192.168.56.117:6377 nodeid
./redis-cli -p 6376 -a 123456 -c --cluster del-node 192.168.56.117:6377 c3c40b57f1bb4617f93d382e20198facede9f71d
3,java aip读写redis
添加maven依赖,使用scala编写程序
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
import java.util.*;
import java.io.*;
import redis.clients.jedis.Jedis;
public class Test {
@org.junit.Test
public void test1() throws SQLException, IOException {
Set<HostAndPort> nodes = new HashSet<>();
nodes.add(new HostAndPort("192.168.56.117", 6371));
nodes.add(new HostAndPort("192.168.56.117", 6372));
//Set<HostAndPort> jedisClusterNode,
// int connectionTimeout,
// int soTimeout,
// int maxAttempts,
// String password,
// final GenericObjectPoolConfig poolConfig
JedisCluster cluster = new JedisCluster(nodes,
1000,
1000,
1,
"123456",
new GenericObjectPoolConfig());
String name = cluster.get("1");
System.out.println("name:"+name);
if(null!=cluster){
cluster.close();
}
}
@org.junit.Test
public void test2() throws IOException {
//读取图片
BufferedInputStream br = new BufferedInputStream(new FileInputStream("C:\\Users\\MK\\Pictures\\cm_service.png"));
byte[] buf=new byte[1024];
int len=0;
//转存到redis
Jedis jedis = new Jedis("s101",6379);
ByteArrayOutputStream out = new ByteArrayOutputStream();
while( len!= -1){
out.write(buf, 0, len);
len=br.read(buf) ;
}
out.close();
jedis.set("jpg".getBytes(),out.toByteArray());
//关闭资源
out.close();
jedis.close();
}
}
4,redis主从 :sentinel模式
哨兵的作用:https://www.redis.com.cn/topics/sentinel.html
本次测试,所有服务均在一台主机上: c73( 192.168.56.73 )
角色 | ip:port | 数据目录 |
---|---|---|
redis-master | c73:7004 | ./data4 |
redis-slave | c73:7005 | ./data5 |
redis-slave | c73:7006 | ./data6 |
- | - | - |
哨兵-1 | c73:26374 | ./data4 |
哨兵-2 | c73:26375 | ./data5 |
哨兵-3 | c73:26376 | ./data6 |
a, 搭建普通redis主从集群
#redis集群
[root@c73 redis-5.0.4-packs-3]# pwd
/root/kuai-prepar/redis-5.0.4-packs-3
[root@c73 redis-5.0.4-packs-3]# ls
conf data4 data5 data6 redis
[root@c73 redis-5.0.4-packs-3]# ls data4/
[root@c73 redis-5.0.4-packs-3]# ls data5
[root@c73 redis-5.0.4-packs-3]# ls data6
[root@c73 redis-5.0.4-packs-3]#
[root@c73 redis-5.0.4-packs-3]# ls conf/
redis-7004.conf redis-7004sentinel.conf redis-7005.conf redis-7005sentinel.conf redis-7006.conf redis-7006sentinel.conf
[root@c73 redis-5.0.4-packs-3]# cat conf/redis-7004.conf
port 7004
bind 0.0.0.0
daemonize yes
logfile "/var/log/redis-7004.log"
pidfile "/var/run/redis-7004.pid"
dir "/root/kuai-prepar/redis-5.0.4-packs-3/data4"
[root@c73 redis-5.0.4-packs-3]# cat conf/redis-7005.conf
port 7005
bind 0.0.0.0
daemonize yes
logfile "/var/log/redis-7005.log"
pidfile "/var/run/redis-7005.pid"
dir "/root/kuai-prepar/redis-5.0.4-packs-3/data5"
slaveof 192.168.56.73 7004
[root@c73 redis-5.0.4-packs-3]# cat conf/redis-7006.conf
port 7006
bind 0.0.0.0
daemonize yes
logfile "/var/log/redis-7006.log"
pidfile "/var/run/redis-7006.pid"
dir "/root/kuai-prepar/redis-5.0.4-packs-3/data6"
slaveof 192.168.56.73 7004
### 启动
#启动集群
[root@c73 redis-5.0.4-packs-3]# ./redis/redis-server conf/redis-7004.conf
[root@c73 redis-5.0.4-packs-3]# ./redis/redis-server conf/redis-7005.conf
[root@c73 redis-5.0.4-packs-3]# ./redis/redis-server conf/redis-7006.conf
[root@c73 redis-5.0.4-packs-3]# ps -ef |grep redis
root 14597 1 0 17:43 ? 00:00:00 ./redis/redis-server 0.0.0.0:7004
root 14620 1 0 17:43 ? 00:00:00 ./redis/redis-server 0.0.0.0:7005
root 14638 1 0 17:43 ? 00:00:00 ./redis/redis-server 0.0.0.0:7006
root 14662 2916 0 17:43 pts/0 00:00:00 grep --color=auto redis
[root@c73 redis-5.0.4-packs-3]# tail /var/log/redis-7004.log
14597:M 02 Dec 2021 17:43:12.661 * Background saving terminated with success
14597:M 02 Dec 2021 17:43:12.661 * Synchronization with replica 192.168.56.73:7005 succeeded
14597:M 02 Dec 2021 17:43:15.224 * Replica 192.168.56.73:7006 asks for synchronization
14597:M 02 Dec 2021 17:43:15.224 * Full resync requested by replica 192.168.56.73:7006
14597:M 02 Dec 2021 17:43:15.224 * Starting BGSAVE for SYNC with target: disk
14597:M 02 Dec 2021 17:43:15.225 * Background saving started by pid 14642
14642:C 02 Dec 2021 17:43:15.226 * DB saved on disk
14642:C 02 Dec 2021 17:43:15.226 * RDB: 2 MB of memory used by copy-on-write
14597:M 02 Dec 2021 17:43:15.272 * Background saving terminated with success
14597:M 02 Dec 2021 17:43:15.272 * Synchronization with replica 192.168.56.73:7006 succeeded
[root@c73 redis-5.0.4-packs-3]# tail /var/log/redis-7005.log
14620:S 02 Dec 2021 17:43:12.601 * Connecting to MASTER 192.168.56.73:7004
14620:S 02 Dec 2021 17:43:12.601 * MASTER <-> REPLICA sync started
14620:S 02 Dec 2021 17:43:12.601 * Non blocking connect for SYNC fired the event.
14620:S 02 Dec 2021 17:43:12.601 * Master replied to PING, replication can continue...
14620:S 02 Dec 2021 17:43:12.601 * Partial resynchronization not possible (no cached master)
14620:S 02 Dec 2021 17:43:12.602 * Full resync from master: 50e4df52b6fdb4c774461cd8232e4800243f05c4:0
14620:S 02 Dec 2021 17:43:12.661 * MASTER <-> REPLICA sync: receiving 175 bytes from master
14620:S 02 Dec 2021 17:43:12.661 * MASTER <-> REPLICA sync: Flushing old data
14620:S 02 Dec 2021 17:43:12.661 * MASTER <-> REPLICA sync: Loading DB in memory
14620:S 02 Dec 2021 17:43:12.661 * MASTER <-> REPLICA sync: Finished with success
b, 配置并启动哨兵
#哨兵配置 sentinel.conf
[root@c73 redis-5.0.4-packs-3]# cat conf/redis-7004sentinel.conf
sentinel monitor mymaster 192.168.56.73 7004 2
sentinel down-after-milliseconds mymaster 10000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 15000
bind 0.0.0.0
port 26374
daemonize yes
logfile "/var/log/redis-7004sentinel.log"
dir "/root/kuai-prepar/redis-5.0.4-packs-3/data4"
[root@c73 redis-5.0.4-packs-3]# cat conf/redis-7005sentinel.conf
sentinel monitor mymaster 192.168.56.73 7004 2
sentinel down-after-milliseconds mymaster 10000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 15000
bind 0.0.0.0
port 26375
daemonize yes
logfile "/var/log/redis-7005sentinel.log"
dir "/root/kuai-prepar/redis-5.0.4-packs-3/data5"
[root@c73 redis-5.0.4-packs-3]# cat conf/redis-7006sentinel.conf
sentinel monitor mymaster 192.168.56.73 7004 2
sentinel down-after-milliseconds mymaster 10000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 15000
bind 0.0.0.0
port 26376
daemonize yes
logfile "/var/log/redis-7006sentinel.log"
dir "/root/kuai-prepar/redis-5.0.4-packs-3/data6"
#启动哨兵
[root@c73 redis-5.0.4-packs-3]# ./redis/redis-server conf/redis-7004sentinel.conf --sentinel
[root@c73 redis-5.0.4-packs-3]# tail /var/log/redis-7004sentinel.log
15128:X 02 Dec 2021 17:44:32.988 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
15128:X 02 Dec 2021 17:44:32.988 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=15128, just started
15128:X 02 Dec 2021 17:44:32.988 # Configuration loaded
15129:X 02 Dec 2021 17:44:32.989 * Increased maximum number of open files to 10032 (it was originally set to 1024).
15129:X 02 Dec 2021 17:44:32.989 * Running mode=sentinel, port=26374.
15129:X 02 Dec 2021 17:44:32.989 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
15129:X 02 Dec 2021 17:44:32.990 # Sentinel ID is 3947f94bc21db8490545493889113d5ac3941be7
15129:X 02 Dec 2021 17:44:32.990 # +monitor master mymaster 192.168.56.73 7004 quorum 2
15129:X 02 Dec 2021 17:44:32.991 * +slave slave 192.168.56.73:7005 192.168.56.73 7005 @ mymaster 192.168.56.73 7004
15129:X 02 Dec 2021 17:44:32.992 * +slave slave 192.168.56.73:7006 192.168.56.73 7006 @ mymaster 192.168.56.73 7004
[root@c73 redis-5.0.4-packs-3]# ./redis/redis-server conf/redis-7005sentinel.conf --sentinel
[root@c73 redis-5.0.4-packs-3]# tail /var/log/redis-7005sentinel.log
15244:X 02 Dec 2021 17:44:50.360 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=15244, just started
15244:X 02 Dec 2021 17:44:50.360 # Configuration loaded
15245:X 02 Dec 2021 17:44:50.361 * Increased maximum number of open files to 10032 (it was originally set to 1024).
15245:X 02 Dec 2021 17:44:50.361 * Running mode=sentinel, port=26375.
15245:X 02 Dec 2021 17:44:50.361 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
15245:X 02 Dec 2021 17:44:50.362 # Sentinel ID is b355cbcb695771b7231ac49ebcde67cc1401772a
15245:X 02 Dec 2021 17:44:50.362 # +monitor master mymaster 192.168.56.73 7004 quorum 2
15245:X 02 Dec 2021 17:44:50.363 * +slave slave 192.168.56.73:7005 192.168.56.73 7005 @ mymaster 192.168.56.73 7004
15245:X 02 Dec 2021 17:44:50.364 * +slave slave 192.168.56.73:7006 192.168.56.73 7006 @ mymaster 192.168.56.73 7004
15245:X 02 Dec 2021 17:44:51.261 * +sentinel sentinel 3947f94bc21db8490545493889113d5ac3941be7 192.168.56.73 26374 @ mymaster 192.168.56.73 7004
[root@c73 redis-5.0.4-packs-3]# ./redis/redis-server conf/redis-7006sentinel.conf --sentinel
[root@c73 redis-5.0.4-packs-3]# tail /var/log/redis-7006sentinel.log
15310:X 02 Dec 2021 17:45:00.552 # Configuration loaded
15311:X 02 Dec 2021 17:45:00.553 * Increased maximum number of open files to 10032 (it was originally set to 1024).
15311:X 02 Dec 2021 17:45:00.553 * Running mode=sentinel, port=26376.
15311:X 02 Dec 2021 17:45:00.553 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
15311:X 02 Dec 2021 17:45:00.554 # Sentinel ID is ffb6f147e5fb360ae58b4618e50d2d922cf08684
15311:X 02 Dec 2021 17:45:00.554 # +monitor master mymaster 192.168.56.73 7004 quorum 2
15311:X 02 Dec 2021 17:45:00.555 * +slave slave 192.168.56.73:7005 192.168.56.73 7005 @ mymaster 192.168.56.73 7004
15311:X 02 Dec 2021 17:45:00.556 * +slave slave 192.168.56.73:7006 192.168.56.73 7006 @ mymaster 192.168.56.73 7004
15311:X 02 Dec 2021 17:45:01.399 * +sentinel sentinel 3947f94bc21db8490545493889113d5ac3941be7 192.168.56.73 26374 @ mymaster 192.168.56.73 7004
15311:X 02 Dec 2021 17:45:02.576 * +sentinel sentinel b355cbcb695771b7231ac49ebcde67cc1401772a 192.168.56.73 26375 @ mymaster 192.168.56.73 7004
[root@c73 redis-5.0.4-packs-3]# ps -ef |grep redis
root 14597 1 0 17:43 ? 00:00:00 ./redis/redis-server 0.0.0.0:7004
root 14620 1 0 17:43 ? 00:00:00 ./redis/redis-server 0.0.0.0:7005
root 14638 1 0 17:43 ? 00:00:00 ./redis/redis-server 0.0.0.0:7006
root 15129 1 0 17:44 ? 00:00:00 ./redis/redis-server 0.0.0.0:26374 [sentinel]
root 15245 1 0 17:44 ? 00:00:00 ./redis/redis-server 0.0.0.0:26375 [sentinel]
root 15311 1 0 17:45 ? 00:00:00 ./redis/redis-server 0.0.0.0:26376 [sentinel]
root 15737 2916 0 17:46 pts/0 00:00:00 grep --color=auto redis
[root@c73 redis-5.0.4-packs-3]#
c, 连接测试
kill redis-master进程,哨兵会自动选举master
#命令行连接集群
[root@c73 redis-5.0.4-packs-3]# ./redis/redis-cli -p 7004
127.0.0.1:7004> keys *
(empty list or set)
127.0.0.1:7004> set a b
OK
127.0.0.1:7004> keys *
1) "a"
127.0.0.1:7004>
[root@c73 redis-5.0.4-packs-3]# ./redis/redis-cli -p 7005
127.0.0.1:7005> keys *
1) "a"
127.0.0.1:7005> set 111 222
(error) READONLY You can't write against a read only replica.
127.0.0.1:7005>
127.0.0.1:7004> info replication
# Replication
role:master
connected_slaves:2
slave0:ip=192.168.56.73,port=7005,state=online,offset=43616,lag=1
slave1:ip=192.168.56.73,port=7006,state=online,offset=43757,lag=0
master_replid:50e4df52b6fdb4c774461cd8232e4800243f05c4
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:43757
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:43757
5, redis集群可视化工具: RedisView
项目地址:https://gitee.com/cc20110101/RedisView
使用说明:https://blog.csdn.net/cc20110101/article/details/87301562