zoukankan      html  css  js  c++  java
  • redis哨兵-5

    #地址:
    https://www.cnblogs.com/PatrickLiu/p/8444546.html
    
    
    #常用架构
    redis1主1从+3哨兵  实现redis高可用
    
    
    #redis主从
    ###############################主######################################
    daemonize yes
    protected-mode no
    pidfile "/var/run/redis_6379.pid"
    port 6379
    bind 0.0.0.0
    timeout 0
    tcp-keepalive 0
    loglevel notice
    logfile "/opt/redis/logs/redis_6379.log"
    databases 16
    save 900 1
    save 300 10
    save 60 10000
    stop-writes-on-bgsave-error yes
    rdbcompression yes
    rdbchecksum yes
    dbfilename "dump.rdb"
    dir "/opt/redis/data/6379"
    appendonly no
    appendfsync everysec
    no-appendfsync-on-rewrite no
    auto-aof-rewrite-percentage 100
    auto-aof-rewrite-min-size 64mb
    lua-time-limit 5000
    slowlog-log-slower-than 10000
    slowlog-max-len 128
    hash-max-ziplist-entries 512
    hash-max-ziplist-value 64
    list-max-ziplist-entries 512
    list-max-ziplist-value 64
    set-max-intset-entries 512
    zset-max-ziplist-entries 128
    zset-max-ziplist-value 64
    activerehashing yes
    client-output-buffer-limit normal 0 0 0
    client-output-buffer-limit slave 256mb 64mb 60
    client-output-buffer-limit pubsub 32mb 8mb 60
    hz 10
    slave-read-only yes
    
    
    ################################从##########################################
    daemonize yes
    protected-mode no
    pidfile "/var/run/redis_6379.pid"
    port 6379
    bind 0.0.0.0
    timeout 0
    tcp-keepalive 0
    loglevel notice
    logfile "/opt/redis/logs/redis_6379.log"
    databases 16
    save 900 1
    save 300 10
    save 60 10000
    stop-writes-on-bgsave-error yes
    rdbcompression yes
    rdbchecksum yes
    dbfilename "dump.rdb"
    dir "/opt/redis/data/6379"
    appendonly no
    appendfsync everysec
    no-appendfsync-on-rewrite no
    auto-aof-rewrite-percentage 100
    auto-aof-rewrite-min-size 64mb
    lua-time-limit 5000
    slowlog-log-slower-than 10000
    slowlog-max-len 128
    hash-max-ziplist-entries 512
    hash-max-ziplist-value 64
    list-max-ziplist-entries 512
    list-max-ziplist-value 64
    set-max-intset-entries 512
    zset-max-ziplist-entries 128
    zset-max-ziplist-value 64
    activerehashing yes
    client-output-buffer-limit normal 0 0 0
    client-output-buffer-limit slave 256mb 64mb 60
    client-output-buffer-limit pubsub 32mb 8mb 60
    hz 10
    #主的连接
    slaveof 172.16.0.22 6379
    
    
    
    #####################################redis哨兵配置################################################
    port 16379
    dir /opt/redis/data/
    daemonize yes
    protected-mode no
    logfile "/opt/redis/logs/redis_16379.log"
    pidfile "/var/run/redis_16379.pid"
    #Sentinel(哨兵)进程去监视一个名为 mymaster 的主服务器,这个主服务器的 IP 地址为 172.16.0.23 , 端口号为 6379,而将这个主服务器判断为失效至少需要 1 个 Sentinel(哨兵)进程的同意
    #注意:
    #1.如果2个哨兵,有1个哨兵挂了,那么主从是不会切换的,状态都会在odwon(客观下线状态),所以要哨兵高可用,至少要3个哨兵
    #2.如果只有1个哨兵 最后面的1是无所谓的。状态会是sdown(主观下线状态)。
    sentinel monitor mymaster  172.16.0.23 6379 1     
    #(哨兵)进程判断服务器已经掉线所需的毫秒数
    sentinel down-after-milliseconds mymaster 3000
    #在执行故障转移时,最多可以有多少个从服务器同时对新的主服务器进行同步,这个数字越小,完成故障转移所需的时间就越长。(一般设置为1)
    sentinel parallel-syncs mymaster 1
    #实现主从切换,完成故障转移的所需要的最大时间值。若Sentinel(哨兵)进程在该配置值内未能完成故障转移的操作(即故障时master/slave自动切换),则认为本次故障转移操作失败
    sentinel failover-timeout mymaster 60000
    
    
    ###############哨兵启动
    /opt/redis/bin/redis-server /opt/redis/16379.conf --sentinel


    ###sping boot配置连接哨兵

    spring.redis.database=xxx

    spring.redis.sentinel.master=mymaster

      spring.redis.sentinel.nodes=10.150.0.104:26379,10.150.0.104:26380,10.150.0.105:26379

  • 相关阅读:
    signalfx的中间件监控指标so cool
    XE6 & IOS开发之免证书真机调试(1):颁发属于自己的App签名证书(有图有真相)
    [教学] Delphi Berlin 10.1 开发 Windows 10 平板 App 远程调试
    XE8 & IOS开发之免费证书真机调试:开发证书、AppID、开发授权profile的申请,附Debug真机调试演示(XCode7 Beta版或以上版本适用,有图有真相)
    Delphi for iOS开发指南(8):在iOS应用程序中使用Tab组件来显示分页
    Delphi for iOS开发指南(7):在iOS应用程序中使用WebBrowser组件
    Delphi for iOS开发指南(6):在iOS应用程序中使用ComboBox组件来从列表中选择某一项
    Delphi for iOS开发指南(5):在iOS应用程序中使用Calendar组件来选择日期
    Delphi for iOS开发指南(4):在iOS应用程序中使用不同风格的Button组件
    Delphi for iOS开发指南(3):创建一个FireMonkey iOS应用程序
  • 原文地址:https://www.cnblogs.com/hanxiaohui/p/8997975.html
Copyright © 2011-2022 走看看