美文网首页
Redis主从配置详细

Redis主从配置详细

作者: 我把今生当成了来世 | 来源:发表于2019-06-19 11:01 被阅读0次

Redis主从配置

主配置
  • 修改/etc/redis/redis.conf

    sudo vi redis.conf
    bind your <ip>
    
  • 重启Redis服务

    ps aux | grep redis
    
    # kill process
    sudo kill -9 <process pid>
    # start
    sudo redis-server /etc/redis/redis.conf
    
开启redis服务
从配置
  • 复制/etc/redis/redis.conf

    sudp cp redis.conf ./slave.conf
    
  • 修改redis/slave.conf

    sudo vi slave.conf
    
    # 编辑内容
    bind <your ip>
    slaveof <your ip> <your port>
    port <slave new port>
    
  • 开启redis服务

     sudo redis-server slave.conf
    
开启redis服务
  • 查看主从关系

    redis-cli -h <your ip> info Replication
    
主从关系

相关文章

网友评论

      本文标题:Redis主从配置详细

      本文链接:https://www.haomeiwen.com/subject/fuehqctx.html