← 返回命令列表

Linux command

redis-sentinel 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start

redis-sentinel [/etc/redis/sentinel.conf]

Start

redis-server [sentinel.conf] --sentinel

List

redis-cli -p [26379] sentinel masters

Get

redis-cli -p [26379] sentinel get-master-addr-by-name [mymaster]

Trigger

redis-cli -p [26379] sentinel failover [mymaster]

说明

Redis Sentinel provides high availability for Redis deployments through continuous monitoring, automatic failover, and notification. It watches master and replica instances, and when a master becomes unreachable and a quorum of Sentinel processes agree it is down, it automatically promotes a replica to master and reconfigures the remaining replicas to use the new master. Sentinel also acts as a configuration provider, allowing clients to discover the current master address for a named service. Multiple Sentinel instances (at least three are recommended) form a distributed system that reaches consensus on failover decisions, preventing split-brain scenarios. A configuration file is mandatory; Sentinel rewrites it on failover to persist the new topology.

参数

--sentinel
When passed to `redis-server`, starts it in Sentinel mode using the provided config file.

FAQ

What is the redis-sentinel command used for?

Redis Sentinel provides high availability for Redis deployments through continuous monitoring, automatic failover, and notification. It watches master and replica instances, and when a master becomes unreachable and a quorum of Sentinel processes agree it is down, it automatically promotes a replica to master and reconfigures the remaining replicas to use the new master. Sentinel also acts as a configuration provider, allowing clients to discover the current master address for a named service. Multiple Sentinel instances (at least three are recommended) form a distributed system that reaches consensus on failover decisions, preventing split-brain scenarios. A configuration file is mandatory; Sentinel rewrites it on failover to persist the new topology.

How do I run a basic redis-sentinel example?

Run `redis-sentinel [/etc/redis/sentinel.conf]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --sentinel do in redis-sentinel?

When passed to `redis-server`, starts it in Sentinel mode using the provided config file.