redis-cluster集群搭建

devtools/2024/11/29 1:30:21/

集群节点信息

192.168.222.131:46379 主要节点1
192.168.222.131:46380 从节点1
192.168.222.131:46381 从节点2192.168.222.132:46379 主要节点2
192.168.222.132:46380 从节点1
192.168.222.132:46381 从节点2192.168.222.133:46379 主要节点3
192.168.222.133:46380 从节点1
192.168.222.133:46381 从节点2

集群节点配置

集群主节点配置
[root@localhost redis]# cat redis-46379.conf 
port 46379
cluster-enabled yes
cluster-config-file nodes-46379.conf
cluster-node-timeout 5000
requirepass F3EE4Dk44ddDSLKL
masterauth F3EE4Dk44ddDSLKL
#protected-mode no
daemonize yes
appendonly yes
appendfilename "appendonly.aof"
dbfilename dump-46379.rdb
dir /data/redis/46379
logfile /data/redis/46379/redis.log
集群从节点1 配置
[root@localhost redis]# cat redis-46380.conf 
port 46380
cluster-enabled yes
cluster-config-file nodes-46380.conf
cluster-node-timeout 5000
requirepass F3EE4Dk44ddDSLKL
masterauth F3EE4Dk44ddDSLKL
#protected-mode no
daemonize yes
appendonly yes
appendfilename "appendonly.aof"
dbfilename dump-46380.rdb
dir /data/redis/46380
logfile /data/redis/46380/redis.log
集群从节点2 配置
[root@localhost redis]# cat redis-46381.conf 
port 46381
cluster-enabled yes
cluster-config-file nodes-46381.conf
cluster-node-timeout 5000
requirepass F3EE4Dk44ddDSLKL
masterauth F3EE4Dk44ddDSLKL
#protected-mode no
daemonize yes
appendonly yes
appendfilename "appendonly.aof"
dbfilename dump-46381.rdb
dir /data/redis/46381
logfile /data/redis/46381/redis.log

节点启动命令

/data/redis/redis-stack-server-7.2.0-v8/bin/redis-server /data/redis/redis-46379.conf
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-server /data/redis/redis-46380.conf
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-server /data/redis/redis-46381.conf

节点停止命令

/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -p 46379 -a F3EE4Dk44ddDSLKL shutdown
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -p 46380 -a F3EE4Dk44ddDSLKL shutdown
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -p 46381 -a F3EE4Dk44ddDSLKL shutdown

集群构建

/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster create \
192.168.222.131:46379 192.168.222.131:46380 192.168.222.131:46381 \
192.168.222.132:46379 192.168.222.132:46380 192.168.222.132:46381 \
192.168.222.133:46379 192.168.222.133:46380 192.168.222.133:46381 --cluster-replicas 2

检查集群节点信息

[root@localhost ~]# /data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER NODES
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 192.168.222.133:46379@56379 master - 0 1732698781824 7 connected 10923-16383
c6927c5de96959a24d04defe1227ca338089219e 192.168.222.131:46379@56379 myself,master - 0 1732698781000 1 connected 0-5460
964f27d3abd421ce99d6814cbc33f7efc3bd473d 192.168.222.132:46379@56379 master - 0 1732698779513 4 connected 5461-10922
4870524e9a47506996015387ea67e6491dd3adac 192.168.222.131:46380@56380 slave a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 0 1732698781522 7 connected
4891c05297daa8e310ac616d159b444d54ba7b51 192.168.222.132:46381@56381 slave a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 0 1732698780517 7 connected
0b88544c661dafef8f79c5204a5f6d7a8abde20b 192.168.222.133:46380@56380 slave c6927c5de96959a24d04defe1227ca338089219e 0 1732698780819 1 connected
bf5549f442b6c096efda3c97472813fdfd1338f3 192.168.222.132:46380@56380 slave c6927c5de96959a24d04defe1227ca338089219e 0 1732698780000 1 connected
b4e716e733cfbe3b61130981fe479f9b38ba2f1e 192.168.222.131:46381@56381 slave 964f27d3abd421ce99d6814cbc33f7efc3bd473d 0 1732698780517 4 connected
504cbbeb8a73512127a1566ac91f846145b11a58 192.168.222.133:46381@56381 slave 964f27d3abd421ce99d6814cbc33f7efc3bd473d 0 1732698781000 4 connected

数据写入测试

# cat write-data-redis.py 
from rediscluster import RedisCluster
# 启动节点列表
startup_nodes = [{"host": "192.168.222.131", "port": "46379"}]
# 创建集群连接
rc = RedisCluster(startup_nodes=startup_nodes, decode_responses=True, password='F3EE4Dk44ddDSLKL')
# 写入数据
for i in range(100):# 例如,写入的数据data_size_kb = 1data = 'kjasjkldfjalsdflasdflasdfjllkasjdflasf' * (data_size_kb * 1024 * 1024)  rc.set(f'key:{i}', data)print(f'Written key:{i} with {data_size_kb}KB of data')
print("Data written.")# python3 write-data-redis.py

主机内存查看

[root@localhost ~]# free -htotal        used        free      shared  buff/cache   available
Mem:           7.8G        2.2G        5.5G         11M        120M        5.4G
Swap:          3.6G          0B        3.6G

节点信息查询

# 连接集群
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -c  -p 46379 -h 192.168.222.131# 监控redis服务器的性能
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 --stat# 获取服务器的统计信息
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 INFO# 检查集群状态
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER INFO# 检查集群节点信息
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER NODES

新添加集群节点信息

192.168.222.134:46379
192.168.222.134:46380
192.168.222.134:46381192.168.222.135:46379
192.168.222.135:46380
192.168.222.135:46381192.168.222.136:46379
192.168.222.136:46380
192.168.222.136:46381

添加新节点到集群

  1. 将新节点加入集群
# 添加主节点
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.134:46379 192.168.222.131:46379
# 查询主节点id
[root@localhost ~]# /data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER  NODES |grep 134
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
7e4645f509d071be565d53f7167464456f869094 192.168.222.134:46379@56379 master - 0 1732699138000 0 connected
# 添加从节点
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.134:46380 192.168.222.131:46379 --cluster-slave --cluster-master-id 7e4645f509d071be565d53f7167464456f869094
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.134:46381 192.168.222.131:46379 --cluster-slave --cluster-master-id 7e4645f509d071be565d53f7167464456f869094# 添加主节点
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.135:46379 192.168.222.131:46379
# 查询主节点id
[root@localhost ~]# /data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER  NODES |grep 135
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
68520244e77a3a69122816496f5c9773b50e5277 192.168.222.135:46379@56379 master - 0 1732699237110 11 connected
# 添加从节点
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.135:46380 192.168.222.131:46379 --cluster-slave --cluster-master-id  68520244e77a3a69122816496f5c9773b50e5277
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.135:46381 192.168.222.131:46379 --cluster-slave --cluster-master-id  68520244e77a3a69122816496f5c9773b50e5277# 添加主节点
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.136:46379 192.168.222.131:46379
# 查询主节点id
[root@localhost ~]# /data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER  NODES |grep 136
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
fa79672847de00a6590a0ebb2ee7d93b5ca11c82 192.168.222.136:46379@56379 master - 0 1732699305971 0 connected
# 添加从节点
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.136:46380 192.168.222.131:46379 --cluster-slave --cluster-master-id fa79672847de00a6590a0ebb2ee7d93b5ca11c82
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node 192.168.222.136:46381 192.168.222.131:46379 --cluster-slave --cluster-master-id fa79672847de00a6590a0ebb2ee7d93b5ca11c82

检查集群节点信息

[root@localhost ~]# /data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER  NODES 
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
849bcb37b280614a2314a989114f204546f17d7d 192.168.222.134:46380@56380 slave 7e4645f509d071be565d53f7167464456f869094 0 1732699378000 12 connected
fa79672847de00a6590a0ebb2ee7d93b5ca11c82 192.168.222.136:46379@56379 master - 0 1732699377568 0 connected
c530f5086b3c5da80e3d8351d5572880f74a8761 192.168.222.136:46380@56380 slave fa79672847de00a6590a0ebb2ee7d93b5ca11c82 0 1732699377000 0 connected
bf534fe091be5239c268d0aa90a4fb937c493f72 192.168.222.136:46381@56381 slave fa79672847de00a6590a0ebb2ee7d93b5ca11c82 0 1732699377000 0 connected
964f27d3abd421ce99d6814cbc33f7efc3bd473d 192.168.222.132:46379@56379 master - 0 1732699378071 4 connected 5461-10922
bbb3838d05683746ff5a848a0b4ef08fee49c1fb 192.168.222.135:46381@56381 slave 68520244e77a3a69122816496f5c9773b50e5277 0 1732699377065 11 connected
4ea5c56c01a07f9cec7d6ba2c7b7e3b2a0743642 192.168.222.134:46381@56381 slave 7e4645f509d071be565d53f7167464456f869094 0 1732699377000 12 connected
bf5549f442b6c096efda3c97472813fdfd1338f3 192.168.222.132:46380@56380 slave c6927c5de96959a24d04defe1227ca338089219e 0 1732699378372 1 connected
68520244e77a3a69122816496f5c9773b50e5277 192.168.222.135:46379@56379 master - 0 1732699378000 11 connected
a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 192.168.222.133:46379@56379 master - 0 1732699377568 7 connected 10923-16383
c6927c5de96959a24d04defe1227ca338089219e 192.168.222.131:46379@56379 myself,master - 0 1732699377000 1 connected 0-5460
4891c05297daa8e310ac616d159b444d54ba7b51 192.168.222.132:46381@56381 slave a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 0 1732699378575 7 connected
4870524e9a47506996015387ea67e6491dd3adac 192.168.222.131:46380@56380 slave a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 0 1732699378574 7 connected
0b88544c661dafef8f79c5204a5f6d7a8abde20b 192.168.222.133:46380@56380 slave c6927c5de96959a24d04defe1227ca338089219e 0 1732699377568 1 connected
7e4645f509d071be565d53f7167464456f869094 192.168.222.134:46379@56379 master - 0 1732699378575 12 connected
b4e716e733cfbe3b61130981fe479f9b38ba2f1e 192.168.222.131:46381@56381 slave 964f27d3abd421ce99d6814cbc33f7efc3bd473d 0 1732699377366 4 connected
504cbbeb8a73512127a1566ac91f846145b11a58 192.168.222.133:46381@56381 slave 964f27d3abd421ce99d6814cbc33f7efc3bd473d 0 1732699377568 4 connected
9343f98f07ee8a0f442bdfd5197ee13c40e5e203 192.168.222.135:46380@56380 slave 68520244e77a3a69122816496f5c9773b50e5277 0 1732699378575 11 connected

槽位重新分配

a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 192.168.222.133:46379@56379 master - 0 1732699377568 7 connected 10923-16383
一共是0-16383 个槽位,平均分布在3个节点上,我现在需要平局分布在6个节点上,每个节点大概是2730个槽位,也可以把现有主节点槽位移动一半到没有槽位的主节点上
迁移到哪里去
7e4645f509d071be565d53f7167464456f869094 192.168.222.134:46379@56379 master - 0 1732699378575 12 connected
68520244e77a3a69122816496f5c9773b50e5277 192.168.222.135:46379@56379 master - 0 1732699378000 11 connected
fa79672847de00a6590a0ebb2ee7d93b5ca11c82 192.168.222.136:46379@56379 master - 0 1732699377568 0 connected从哪里迁移
c6927c5de96959a24d04defe1227ca338089219e 192.168.222.131:46379@56379 myself,master - 0 1732699377000 1 connected 0-5460
964f27d3abd421ce99d6814cbc33f7efc3bd473d 192.168.222.132:46379@56379 master - 0 1732699378071 4 connected 5461-10922
a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 192.168.222.133:46379@56379 master - 0 1732699377568 7 connected 10923-16383迁移的命令
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster reshard 192.168.222.131:46379
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster reshard 192.168.222.132:46379
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster reshard 192.168.222.133:46379fa79672847de00a6590a0ebb2ee7d93b5ca11c82 192.168.222.136:46379@56379 master - 0 1732700418532 0 connected
b4e716e733cfbe3b61130981fe479f9b38ba2f1e 192.168.222.131:46381@56381 master - 0 1732700419538 19 connected 5461-10922

槽位置迁移示范

[root@localhost ~]# /data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster reshard 192.168.222.131:46379
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.222.131:46379)
M: c6927c5de96959a24d04defe1227ca338089219e 192.168.222.131:46379slots:[0-5460] (5461 slots) master2 additional replica(s)
...........
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
How many slots do you want to move (from 1 to 16384)? 2730
What is the receiving node ID? 7e4645f509d071be565d53f7167464456f869094
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: c6927c5de96959a24d04defe1227ca338089219e
Source node #2: done
...........
Moving slot 2729 from c6927c5de96959a24d04defe1227ca338089219e
Do you want to proceed with the proposed reshard plan (yes/no)? yes
...........
Moving slot 2729 from 192.168.222.131:46379 to 192.168.222.134:46379:

检查集群节点信息

# 迁移完成
[root@localhost ~]# /data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER  NODES 
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
849bcb37b280614a2314a989114f204546f17d7d 192.168.222.134:46380@56380 slave 7e4645f509d071be565d53f7167464456f869094 0 1732700757000 25 connected
fa79672847de00a6590a0ebb2ee7d93b5ca11c82 192.168.222.136:46379@56379 master - 0 1732700756000 27 connected 5461-8190
c530f5086b3c5da80e3d8351d5572880f74a8761 192.168.222.136:46380@56380 slave fa79672847de00a6590a0ebb2ee7d93b5ca11c82 0 1732700757583 27 connected
bf534fe091be5239c268d0aa90a4fb937c493f72 192.168.222.136:46381@56381 slave fa79672847de00a6590a0ebb2ee7d93b5ca11c82 0 1732700758085 27 connected
964f27d3abd421ce99d6814cbc33f7efc3bd473d 192.168.222.132:46379@56379 slave b4e716e733cfbe3b61130981fe479f9b38ba2f1e 0 1732700757482 19 connected
bbb3838d05683746ff5a848a0b4ef08fee49c1fb 192.168.222.135:46381@56381 slave 68520244e77a3a69122816496f5c9773b50e5277 0 1732700757000 26 connected
4ea5c56c01a07f9cec7d6ba2c7b7e3b2a0743642 192.168.222.134:46381@56381 slave 7e4645f509d071be565d53f7167464456f869094 0 1732700756000 25 connected
bf5549f442b6c096efda3c97472813fdfd1338f3 192.168.222.132:46380@56380 slave c6927c5de96959a24d04defe1227ca338089219e 0 1732700757583 1 connected
68520244e77a3a69122816496f5c9773b50e5277 192.168.222.135:46379@56379 master - 0 1732700756476 26 connected 10923-13652
a2b16bfa39fafe9b536ac6c952ae2dec58a8e35e 192.168.222.133:46379@56379 slave 4870524e9a47506996015387ea67e6491dd3adac 0 1732700758085 17 connected
c6927c5de96959a24d04defe1227ca338089219e 192.168.222.131:46379@56379 myself,master - 0 1732700757000 1 connected 2730-5460
4891c05297daa8e310ac616d159b444d54ba7b51 192.168.222.132:46381@56381 slave 4870524e9a47506996015387ea67e6491dd3adac 0 1732700758085 17 connected
4870524e9a47506996015387ea67e6491dd3adac 192.168.222.131:46380@56380 master - 0 1732700757079 17 connected 13653-16383
0b88544c661dafef8f79c5204a5f6d7a8abde20b 192.168.222.133:46380@56380 slave c6927c5de96959a24d04defe1227ca338089219e 0 1732700756000 1 connected
7e4645f509d071be565d53f7167464456f869094 192.168.222.134:46379@56379 master - 0 1732700756000 25 connected 0-2729
b4e716e733cfbe3b61130981fe479f9b38ba2f1e 192.168.222.131:46381@56381 master - 0 1732700758085 19 connected 8191-10922
504cbbeb8a73512127a1566ac91f846145b11a58 192.168.222.133:46381@56381 slave b4e716e733cfbe3b61130981fe479f9b38ba2f1e 0 1732700757000 19 connected
9343f98f07ee8a0f442bdfd5197ee13c40e5e203 192.168.222.135:46380@56380 slave 68520244e77a3a69122816496f5c9773b50e5277 0 1732700756000 26 connected

查看节点内存使用信息

# 原先节点
[root@localhost ~]# free -htotal        used        free      shared  buff/cache   available
Mem:           7.8G        1.2G        6.5G         11M        121M        6.4G
Swap:          3.6G          0B        3.6G# 新增节点
[root@localhost ~]# free -htotal        used        free      shared  buff/cache   available
Mem:           7.8G        1.2G        6.5G         11M        112M        6.4G
Swap:          3.6G          0B        3.6G

集群各种操作命令

# 连接集群
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -c  -p 46379 -h 192.168.222.131# 维护集群
# 监控命令:
# 监控redis服务器的性能
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 --stat# 获取服务器的统计信息
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 INFO# 检查集群状态和节点信息
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER INFO
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CLUSTER NODES# 动态配置修改命令:
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 CONFIG SET <配置项> <># 扩展集群(添加新节点):
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster add-node <新节点IP>:<新节点端口> <已存在节点IP>:<已存在节点端口># 缩减集群(删除节点):
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster del-node <已存在节点IP>:<已存在节点端口> <节点ID>
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster del-node 192.168.222.134:46379 05ddef40e900862d61ea895568dc0b65b562eb99
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster del-node 192.168.222.134:46380 1f02da1cd8339ae877f50ab7b24a46b2de0a4c2d
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster del-node 192.168.222.134:46381 eb0eb008856d63c7ae7671f70050939aac36a64f# 故障恢复
# 手动干预修复集群:
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL --cluster fix <任意节点IP>:<任意节点端口># 备份(在每个节点上执行):
/data/redis/redis-stack-server-7.2.0-v8/bin/redis-cli -a F3EE4Dk44ddDSLKL -p 46379 -h 192.168.222.131 BGSAVE# 恢复(假设你有一个 RDB 快照文件):
# 恢复通常涉及将 RDB 文件复制到 Redis 数据目录并重启 Redis 服务。确保在恢复之前关闭 Redis 服务。
cp /path/to/your/backup.rdb /var/lib/redis/dump.rdb
/data/redis/bin/redis-server /etc/redis/redis.conf查看日志:
Redis 日志文件的位置根据你的安装和配置可能不同,但通常你可以这样查看:
tail -f /var/log/redis/redis-server.log

http://www.ppmy.cn/devtools/137798.html

相关文章

前端学习笔记

vue3的数据绑定 参考资料&#xff1a; https://blog.csdn.net/h8062651/article/details/143254339?spm1001.2014.3001.5506 Vue 3 提供了 reactive 和 ref 两个主要函数来创建响应式对象。 reactive&#xff1a; 用于创建包含多个属性的响应式对象。 当对象的属性发生变化时…

Easyui datagrid formatter 删除行失败解决

Easyui datagrid formatter 删除行失败解决 问题现象 使用formatter 为每行新增一个删除操作&#xff0c;,删除第一个行的时候没问题&#xff0c;如果存在多行的时候&#xff0c;当删除行时&#xff0c;提示错误 问题原因 因为是使用 formatter 相当于每行在渲染的时候ind…

(长期更新)《零基础入门 ArcGIS(ArcMap) 》实验二----网络分析(超超超详细!!!)

相信实验一大家已经完成了&#xff0c;对Arcgis已进一步熟悉了&#xff0c;现在开启第二个实验 ArcMap实验--网络分析 目录 ArcMap实验--网络分析 1.1 网络分析介绍 1.2 实验内容及目的 1.2.1 实验内容 1.2.2 实验目的 2.2 实验方案 2.3 实验流程 2.3.1 实验准备 2.3.2 空间校正…

python学opencv|读取图像

【1】引言 前序学习了使用matplotlib模块进行画图&#xff0c;今天开始我们逐步尝试探索使用opencv来处理图片。 【2】学习资源 官网的学习链接如下&#xff1a; OpenCV: Getting Started with Images 不过读起来是英文版&#xff0c;可能略有难度&#xff0c;所以另推荐一…

YOLOv7论文讲解和代码复现

✨✨ 欢迎大家来访Srlua的博文&#xff08;づ&#xffe3;3&#xffe3;&#xff09;づ╭❤&#xff5e;✨✨ &#x1f31f;&#x1f31f; 欢迎各位亲爱的读者&#xff0c;感谢你们抽出宝贵的时间来阅读我的文章。 我是Srlua小谢&#xff0c;在这里我会分享我的知识和经验。&am…

物联网实验室建设方案

一、物联网实验室建设 (1) 基础理论教学云平台 唯众基础理论教学云平台是一个专为物联网相关专业教学打造的综合性在线教学平台。该平台凭借先进的技术架构和丰富的教学资源&#xff0c;为师生提供了一个高效、便捷、互动的学习环境。以下是该平台的主要特点和功能描述&#…

Oracle-伪劣rowid和rownumber的用法

-- 伪列 ROWID 物理地址 -- 使用ROWID可以快速的定位表中的某一行 -- ROWID值唯一 用来删除重复数据 -- 建表造数测试 -- rowid 的用法 select rowid,d.* from dept_test d; -- 删除重复数据 select a.deptno,min(rowid) as rd from dept_test a group by a.deptno; sele…

STM32完全学习——使用标准库完成PWM输出

一、TIM2初始化 我这里使用的是STM32F407ZGT6这个芯片&#xff0c;我这里使用的是定时器TIM2来完成PWM输出&#xff0c;由于这里没有使用中断&#xff0c;因此不需要初始化NVIC&#xff0c;下面先来进行定时器的相关初始化 TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct;R…