• Redis+Sentinel


    1、环境介绍

    系统

    服务

    IP

    Centos6.5

    Rzd-01

    10.10.3.111

    Centos6.5

    Rzd-02

    10.10.3.112

    Centos6.5

    Rzd-03

    10.10.3.113

    2、安装Redis

    上传安装包到服务器后进行安装

    [root@uat2-app-01 software]# tar -xzvf /home/software/redis-3.0.7.tar.gz

    [root@uat2-app-01 software]# cd redis-3.0.7

    [root@uat2-app-01 software]# make PREFIX=/usr/local/redis install

    [root@uat2-app-01 software]# make MALLOC=libc PREFIX=/usr/local/redis install

    3、配置Redis+Sentinel

    [root@uat2-app-01 software]# mkdir  /usr/local/redis/{db,logs,conf}

    [root@prd-app-gfs-01 ~]# vi /usr/local/redis/conf/ master_redis.conf #配置redis

    #主redis配置文件(10.10.3.111)

    daemonize yes

    pidfile /var/run/redis-6379.pid

    port 6379

    tcp-backlog 511

    timeout 0

    tcp-keepalive 0

    loglevel notice

    logfile "/usr/local/redis/logs/logfile-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-6379.rdb

    dir /usr/local/redis/db

    slave-serve-stale-data yes

    slave-read-only yes

    repl-diskless-sync no

    repl-diskless-sync-delay 5

    repl-disable-tcp-nodelay no

    slave-priority 100

    requirepass  byxf2016

    maxclients 10000

    maxmemory 1024m

    appendonly no

    appendfilename "appendonly-6379.aof"

    appendfsync everysec

    no-appendfsync-on-rewrite no

    auto-aof-rewrite-percentage 100

    auto-aof-rewrite-min-size 64mb

    aof-load-truncated yes

    lua-time-limit 5000

    slowlog-log-slower-than 10000

    slowlog-max-len 128

    latency-monitor-threshold 0

    notify-keyspace-events ""

    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

    hll-sparse-max-bytes 3000

    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

    aof-rewrite-incremental-fsync yes

    [root@prd-app-gfs-01 ~]# vi /usr/local/redis/conf/slave_redis.conf

    #从redis配置文件(10.10.3.112/10.10.3.113)

    daemonize yes

    pidfile /var/run/redis-6379.pid

    port 6379

    tcp-backlog 511

    timeout 0

    tcp-keepalive 0

    loglevel notice

    logfile "/usr/local/redis/logs/logfile-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-6379.rdb

    dir /usr/local/redis/db

    slaveof 10.10.3.101 6379

    masterauth byxf2016

    slave-serve-stale-data yes

    slave-read-only yes

    repl-diskless-sync no

    repl-diskless-sync-delay 5

    repl-disable-tcp-nodelay no

    slave-priority 100

    requirepass  byxf2016

    maxclients 10000

    maxmemory 1024m

    appendonly no

    appendfilename "appendonly-6379.aof"

    appendfsync everysec

    no-appendfsync-on-rewrite no

    auto-aof-rewrite-percentage 100

    auto-aof-rewrite-min-size 64mb

    aof-load-truncated yes

    lua-time-limit 5000

    slowlog-log-slower-than 10000

    slowlog-max-len 128

    latency-monitor-threshold 0

    notify-keyspace-events ""

    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

    hll-sparse-max-bytes 3000

    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

    aof-rewrite-incremental-fsync yes

    [root@prd-app-gfs-01 ~]# vi /usr/local/redis/conf/sentinel.conf #配置sentinetl

    #主从sentinel配置文件相同

    port 26379

    daemonize yes

    logfile "/usr/local/redis/logs/sentinel.log"

    dir /tmp

    sentinel monitor mymaster 10.10.3.101 6379 2

    sentinel down-after-milliseconds mymaster 30000

    sentinel parallel-syncs mymaster 1

    sentinel failover-timeout mymaster 180000

    [root@prd-app-gfs-01 ~]# 。/redis-server /usr/local/redis/conf/master_redis.conf &    #启动主redis(10.10.3.111)

    [root@prd-app-gfs-01 ~]# ./redis-server /usr/local/redis/conf/slave_redis.conf &    #启动从redis(10.10.3.112/10.10.3.113)

    [root@prd-app-gfs-01 ~]# ./redis-sentinel /usr/local/redis/conf/sentinel.conf &   #启动sentinel(10.10.3.111/112/113)

     

    问题:

    错误:WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

    echo 511 > /proc/sys/net/core/somaxconn

  • 相关阅读:
    vue中使用$router.push跳转新页面
    08、TypeScript 装饰器
    07、TypeScript 命名空间
    06、TypeScript 类型、接口、类、泛型 综合使用,封装一个操作数据库的库
    Java课程总结
    Java第六次上机
    Java第三次上级
    Java第一次上机
    Java第二次实训
    Java第五次上机
  • 原文地址:https://www.cnblogs.com/Leslieblog/p/10435696.html
Copyright © 2020-2023  润新知