1、安装Redis 6.2(两个节点,一主一副本)

dnf -y install redis

2、修改主节点配置

# 修改部分的配置文件
# vim /etc/redis/redis.conf
...
bind 0.0.0.0
timeout 600
daemonize yes
min-replicas-to-write 1
min-replicas-max-lag 10
requirepass password
maxmemory 4G
maxmemory-policy volatile-lru
appendonly yes
...

3、修改副本节点配置

# 修改部分的配置文件
# vim /etc/redis/redis.conf
...
bind 0.0.0.0
timeout 600
daemonize yes
replicaof 10.32.161.130 6379
masterauth password
requirepass password
maxmemory 4G
maxmemory-policy volatile-lru
appendonly yes
...

4、启动服务

systemctl enable --now redis

5、在副本节点上验证

redis-cli -h 127.0.0.1 -p 6379 -a password info Replication

 

posted on 2023-02-28 17:30  a120608yby  阅读(42)  评论(0编辑  收藏  举报