• redis 哨兵集群搭建


    redis 哨兵搭建
    1、主库配置参数(redis.conf)
    daemonize yes #daemonize:yes:redis采用的是单进程多线程的模式。当redis.conf中选项daemonize设置成yes时,代表开启守护进程模式。在该模式下,redis会在后台运行,并将进程pid号写入至redis.conf选项pidfile设置的文件中,此时redis将一直运行,除非手动kill该进程。
    #daemonize:no: 当daemonize选项设置成no时,当前界面将进入redis的命令行界面,exit强制退出或者关闭连接工具(putty,xshell等)都会导致redis进程退出。
    port 6380
    timeout 30 #Client 端空闲断开连接的时间
    bind 10.120.126.122 #绑定IP地址
    appendonly yes #默认值是No,意思是不使用AOF增量持久化的方式,使用RDB全量持久化的方式。把No值改成Yes,使用AOF增量持久化的方式
    appendfsync always #appendfsync always:总是写入aof文件,并完成磁盘同步
    #appendfsync everysec:每一秒写入aof文件,并完成磁盘同步
    #appendfsync no:写入aof文件,不等待磁盘同步。
    dir /data/redis/data/
    2、从库配置参数(redis.conf)
    daemonize yes
    port 6381
    timeout 30
    bind 10.120.126.123
    appendonly yes
    appendfsync always
    dir /data/redis/data/
    slaveof 10.120.126.122 6380
    slave-serve-stale-data no
    3、哨兵配置参数(sentinel.conf)#两个库都配置#
    port 26379  #可保持不变
    dir /data/redis/log/    #哨兵日志路径
    sentinel monitor mymaster 10.120.126.122 6380 1
    sentinel down-after-milliseconds mymaster 5000  #超过5000毫秒(5秒)视为服务器已经断线
    sentinel parallel-syncs mymaster 1 #选项指定了在执行故障转移时, 最多可以有多少个从服务器同时对新的主服务器进行同步, 这个数字越小, 完成故障转移所需的时间就越长,但越大就意味着越多的从服务器因为复制而不可用。可以通过将这个值设为 1 来保证每次只有一个从服务器处于不能处理命令请求的状态。
    sentinel failover-timeout mymaster 60000  #failover过期时间,当failover开始后,在此时间内仍然没有触发任何failover操作,当前sentinel  将会认为此次failoer失败
    4、分别启动主库、从库、哨兵即可
    启动哨兵命令
    redis-sentinel sentinel.conf
    redis-server sentinel.conf --sentinel
  • 相关阅读:
    初步掌握HDFS的架构及原理
    Hadoop 生态系统
    安装Hadoop,让word count飞起来
    十分钟看透MapReduce
    初识Hadoop
    线性回归-理论篇
    逻辑回归
    hdu 4848 Wow! Such Conquering! (floyd dfs)
    hdu 4856 Tunnels (记忆化搜索)
    poj 3237 Tree [LCA] (树链剖分)
  • 原文地址:https://www.cnblogs.com/Knight7971/p/9700647.html
Copyright © 2020-2023  润新知