wjun0

1,修改 /etc/redis/redis.conf 文件,

cd /etc/redis
vim redis.conf
bind 192.168.59.128   #绑定主机的IP地址

2,重启redis服务

service redis stop    #先停止redis服务
redis-server redis.conf        #指定配置文件启动

3,配置从数据库

cp redis.conf ./slave.conf
vim slave.conf    

bind 192.168.59.129     从数据库的地址
port 6378
slaveof 192.168.59.129 6379   #主数据库的地址和端口#

4,启动从数据库

redis-server slave.conf  #启动从数据库
redis-cli -h 192.168.59.129 info Relication #查看主从关系

 

 5,在主数据库上写入数据,在从数据库上进行读取进行验证。

redis-cli -h 192.168.59.129 -p 6379  #进入主数据库
set aa aa
redis-cli -h 192.168.59.129 -p 6378    #进入从数据库
get aa

 

分类:

技术点:

相关文章:

  • 2020-04-11
  • 2019-06-12
  • 2021-11-14
  • 2022-01-05
  • 2018-03-16
  • 2021-06-23
  • 2021-10-10
  • 2018-03-25
猜你喜欢
  • 2018-08-24
  • 2018-06-12
  • 2021-04-30
  • 2021-12-26
  • 2021-04-19
  • 2021-11-04
  • 2021-08-20
相关资源
相似解决方案