redis集群与主从配置
- redis安装-redis集群管理
- redis主从复制(读写分离)-redis集群管理
- redis主从从架构搭建-redis集群管理
- redis从库只读设置-redis集群管理
- redis主从复制的原理-redis集群管理
- redis sentinel(哨兵) 配置详解-redis集群管理
- redis sentinel.conf详解-redis集群管理
- redis 集群环境搭建-redis集群管理
- redis集群插槽分配-redis集群管理
- redis新增集群节点-redis集群管理
- redis删除集群节点-redis集群管理
- redis集群出现宕机没法访问-redis集群管理
- redis 集群使用主从复制架构-redis集群管理
redis 基础教程
- Redis概述
- 基于linux下redis安装与配置
- 基于window安装redis
- Redis配置文件详解
- 通过redis客户端查看和设置配置
- Redis 客户端连接、密码验证、连接数设置
- 使用info命令获取 redis 服务详细信息
- Redis Desktop Manager客户端使用教程
redis 数据类型
Redis 高级教程
知识点
相关文章
更多最近更新
更多redis sentinel.conf详解-redis集群管理
2019-03-19 22:05|来源: 网路
sentinel.conf详解
# Example sentinel.conf # sentinel 运行的端口 port 26379 # sentinel服务运行时使用的临时文件夹 dir /tmp # sentinel monitor <master-name> <ip> <redis-port> <quorum> # sentinel监视配置,master-name:监控主redis实例的名称,自定义即可,可以使用大小写字母和“.-_”符号;ip:监控的主redis的IP;redis-port:监控的主redis的端口;quorum:而将这个主实例判断为失效至少需要 quorum 个 sentinel进程的同意,只要同意sentinel的数量不达标,自动failover就不会执行 sentinel monitor mymaster 127.0.0.1 6379 2 # sentinel auth-pass <master-name> <password> # 设置sentinel密码 # sentinel auth-pass mymaster MySUPER--secret-0123passw0rd # sentinel down-after-milliseconds <master-name> <milliseconds> # 指定了Sentinel认为Redis实例已经失效所需的毫秒数。 当实例超过该时间没有返回PING,或者直接返回错误,那么Sentinel将这个实例标记为主观下线。只有一个 Sentinel进程将实例标记为主观下线并不一定会引起实例的自动故障迁移:只有在足够数量的Sentinel都将一个实例标记为主观下线之后,实例才会被标记为客观下线,这时自动故障迁移才会执行 # Default is 30 seconds. sentinel down-after-milliseconds mymaster 30000 # sentinel parallel-syncs <master-name> <numslaves> # 指定了在执行故障转移时,最多可以有多少个从Redis实例在同步新的主实例,在从Redis实例较多的情况下这个数字越小,同步的时间越长,完成故障转移所需的时间就越长 sentinel parallel-syncs mymaster 1 # sentinel failover-timeout <master-name> <milliseconds> # 如果在该时间(ms)内未能完成failover操作,则认为该failover失败 # Default is 3 minutes. sentinel failover-timeout mymaster 180000 # SCRIPTS EXECUTION # NOTIFICATION SCRIPT # # sentinel notification-script <master-name> <script-path> # 指定sentinel检测到该监控的redis实例指向的实例异常时,调用的报警脚本。该配置项可选,但是很常用 # sentinel notification-script mymaster /var/redis/notify.sh # CLIENTS RECONFIGURATION SCRIPT # sentinel client-reconfig-script <master-name> <script-path> # sentinel client-reconfig-script mymaster /var/redis/reconfig.sh |
官方完整示例
# Example sentinel.conf # port <sentinel-port> # The port that this sentinel instance will run on port 26379 # sentinel announce-ip <ip> # sentinel announce-port <port> # # The above two configuration directives are useful in environments where, # because of NAT, Sentinel is reachable from outside via a non-local address. # # When announce-ip is provided, the Sentinel will claim the specified IP address # in HELLO messages used to gossip its presence, instead of auto-detecting the # local address as it usually does. # # Similarly when announce-port is provided and is valid and non-zero, Sentinel # will announce the specified TCP port. # # The two options don't need to be used together, if only announce-ip is # provided, the Sentinel will announce the specified IP and the server port # as specified by the "port" option. If only announce-port is provided, the # Sentinel will announce the auto-detected local IP and the specified port. # # Example: # # sentinel announce-ip 1.2.3.4 # dir <working-directory> # Every long running process should have a well-defined working directory. # For Redis Sentinel to chdir to /tmp at startup is the simplest thing # for the process to don't interfere with administrative tasks such as # unmounting filesystems. dir /tmp # sentinel monitor <master-name> <ip> <redis-port> <quorum> # # Tells Sentinel to monitor this master, and to consider it in O_DOWN # (Objectively Down) state only if at least <quorum> sentinels agree. # # Note that whatever is the ODOWN quorum, a Sentinel will require to # be elected by the majority of the known Sentinels in order to # start a failover, so no failover can be performed in minority. # # Slaves are auto-discovered, so you don't need to specify slaves in # any way. Sentinel itself will rewrite this configuration file adding # the slaves using additional configuration options. # Also note that the configuration file is rewritten when a # slave is promoted to master. # # Note: master name should not include special characters or spaces. # The valid charset is A-z 0-9 and the three characters ".-_". sentinel monitor mymaster 127.0.0.1 6379 2 # sentinel auth-pass <master-name> <password> # # Set the password to use to authenticate with the master and slaves. # Useful if there is a password set in the Redis instances to monitor. # # Note that the master password is also used for slaves, so it is not # possible to set a different password in masters and slaves instances # if you want to be able to monitor these instances with Sentinel. # # However you can have Redis instances without the authentication enabled # mixed with Redis instances requiring the authentication (as long as the # password set is the same for all the instances requiring the password) as # the AUTH command will have no effect in Redis instances with authentication # switched off. # # Example: # # sentinel auth-pass mymaster MySUPER--secret-0123passw0rd # sentinel down-after-milliseconds <master-name> <milliseconds> # # Number of milliseconds the master (or any attached slave or sentinel) should # be unreachable (as in, not acceptable reply to PING, continuously, for the # specified period) in order to consider it in S_DOWN state (Subjectively # Down). # # Default is 30 seconds. sentinel down-after-milliseconds mymaster 30000 # sentinel parallel-syncs <master-name> <numslaves> # # How many slaves we can reconfigure to point to the new slave simultaneously # during the failover. Use a low number if you use the slaves to serve query # to avoid that all the slaves will be unreachable at about the same # time while performing the synchronization with the master. sentinel parallel-syncs mymaster 1 # sentinel failover-timeout <master-name> <milliseconds> # # Specifies the failover timeout in milliseconds. It is used in many ways: # # - The time needed to re-start a failover after a previous failover was # already tried against the same master by a given Sentinel, is two # times the failover timeout. # # - The time needed for a slave replicating to a wrong master according # to a Sentinel current configuration, to be forced to replicate # with the right master, is exactly the failover timeout (counting since # the moment a Sentinel detected the misconfiguration). # # - The time needed to cancel a failover that is already in progress but # did not produced any configuration change (SLAVEOF NO ONE yet not # acknowledged by the promoted slave). # # - The maximum time a failover in progress waits for all the slaves to be # reconfigured as slaves of the new master. However even after this time # the slaves will be reconfigured by the Sentinels anyway, but not with # the exact parallel-syncs progression as specified. # # Default is 3 minutes. sentinel failover-timeout mymaster 180000 # SCRIPTS EXECUTION # # sentinel notification-script and sentinel reconfig-script are used in order # to configure scripts that are called to notify the system administrator # or to reconfigure clients after a failover. The scripts are executed # with the following rules for error handling: # # If script exits with "1" the execution is retried later (up to a maximum # number of times currently set to 10). # # If script exits with "2" (or an higher value) the script execution is # not retried. # # If script terminates because it receives a signal the behavior is the same # as exit code 1. # # A script has a maximum running time of 60 seconds. After this limit is # reached the script is terminated with a SIGKILL and the execution retried. # NOTIFICATION SCRIPT # # sentinel notification-script <master-name> <script-path> # # Call the specified notification script for any sentinel event that is # generated in the WARNING level (for instance -sdown, -odown, and so forth). # This script should notify the system administrator via email, SMS, or any # other messaging system, that there is something wrong with the monitored # Redis systems. # # The script is called with just two arguments: the first is the event type # and the second the event description. # # The script must exist and be executable in order for sentinel to start if # this option is provided. # # Example: # # sentinel notification-script mymaster /var/redis/notify.sh # CLIENTS RECONFIGURATION SCRIPT # # sentinel client-reconfig-script <master-name> <script-path> # # When the master changed because of a failover a script can be called in # order to perform application-specific tasks to notify the clients that the # configuration has changed and the master is at a different address. # # The following arguments are passed to the script: # # <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port> # # <state> is currently always "failover" # <role> is either "leader" or "observer" # # The arguments from-ip, from-port, to-ip, to-port are used to communicate # the old address of the master and the new address of the elected slave # (now a master). # # This script should be resistant to multiple invocations. # # Example: # # sentinel client-reconfig-script mymaster /var/redis/reconfig.sh |
redis知识点
redis快速入门
reids常用命令
redis数据结构
java_API_客户端
Jedis
Tlcache
redis_持久化
AOF
RDB
发布订阅(pub/sub)
redis_事件
redis事务
redis通讯协议
RESP(Redis Serialization Protocol)
redis高可用
redis哨兵
监控(Monitoring) 提醒(Notification) 自动故障迁移(Automatic failover)
redis主从复制
-
- 主从复制
- 从从复制
-
- slave向master发送sync命令;
- master开启子进程执行bgsave写入rdb文件;
- master发送缓存和RDB文件给slave;
- master发送数据发送给slave完成复制;
redis集群(Redis_Cluster)
相关问答
更多-
redis怎么使用[2024-01-20]
应用Redis实现数据的读写,同时利用队列处理器定时将数据写入mysql。 同时要注意避免冲突,在redis启动时去mysql读取所有表键值存入redis中,往redis写数据时,对redis主键自增并进行读取,若mysql更新失败,则需要及时清除缓存及同步redis主键。 这样处理,主要是实时读写redis,而mysql数据则通过队列异步处理,缓解mysql压力,不过这种方法应用场景主要基于高并发,而且redis的高可用集群架构相对更复杂,一般不是很推荐。 -
redis sentinel.conf可以监控多个实例吗[2023-12-08]
从GitHub上下载解压redis-monitor-master,修改src/redis_live.conf。 必须配置一个单独的Redis实例存储监控数据,同时可以配置多个要监控的Redis实例。之后启动redis-monitor有些麻烦,需要启动两个前台进程和两个后台进程 -
redis.conf 和 sentinel.conf 怎么用[2024-03-17]
先停止sentinel,然后在修改配置,完成后再启动sentinel 如果没有停止,修改好了,停止的时候sentinel会自动把内存的值同步到配置文档中 回答不容易,希望能帮到您,满意请帮忙采纳一下,谢谢 ! -
redis怎么使用[2022-05-23]
应用Redis实现数据的读写,同时利用队列处理器定时将数据写入mysql。 同时要注意避免冲突,在redis启动时去mysql读取所有表键值存入redis中,往redis写数据时,对redis主键自增并进行读取,若mysql更新失败,则需要及时清除缓存及同步redis主键。 这样处理,主要是实时读写redis,而mysql数据则通过队列异步处理,缓解mysql压力,不过这种方法应用场景主要基于高并发,而且redis的高可用集群架构相对更复杂,一般不是很推荐。 -
REDIS.CONF怎么修改[2022-06-02]
看你需要修改哪些功能。 最基础的修改: 1. bind 即服务地址。改为所在服务器的ip地址即可 2. port 即端口号。默认是6379 其它的高级功能可以酌情修改。 -
redis.conf 和 sentinel.conf 怎么用[2022-03-26]
先停止sentinel,然后在修改配置,完成后再启动sentinel 如果没有停止,修改好了,停止的时候sentinel会自动把内存的值同步到配置文档中 回答不容易,希望能帮到您,满意请帮忙采纳一下,谢谢 ! -
redis sentinel集群最大连接数配置无用[2023-01-09]
先停止sentinel,然后在修改配置,完成后再启动sentinel 如果没有停止,修改好了,停止的时候sentinel会自动把内存的值同步到配置文档中 -
redis sentinel集群最大连接数配置无用[2022-03-13]
先停止sentinel,然后在修改配置,完成后再启动sentinel 如果没有停止,修改好了,停止的时候sentinel会自动把内存的值同步到配置文档中 -
查看您发布的配置文件似乎设置错误,您的群集名称有变化mymaster和redis2尝试以下操作 # Process Info port 26379 daemonize yes pidfile "/var/run/redis/sentinel.pid" # Log files loglevel notice logfile "/var/log/redis/sentinel.log" # Master setup sentinel monitor redis2 10.0.2.94 6379 2 sentin ...
-
Rails,Redis和Sentinel(Rails, Redis and Sentinel)[2022-04-14]
我可能错过了它,但我不知道你可以配置它从奴隶读取? 但是,这是我的主+ 2从属配置: config.cache_store = :redis_store, { url: 'redis://prestwick/1', sentinels: [{host: 'prestwick.i', port: 26379}, {host: 'carnoustie.i', port: 26379}, {host: 'birkdale.i', port: 26379}], role: 'master', ...