Redis主从配置详细

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
    
主从关系
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。