# Example sentinel.conf
# *** IMPORTANT ***
#
# By default Sentinel will not be reachable from interfaces different than
# localhost, either use the 'bind' directive to bind to a list of network
# interfaces, or disable protected mode with "protected-mode no" by
# adding it to this configuration file.
#
# Before doing that MAKE SURE the instance is protected from the outside
# world via firewalling or other means.
#
# For example you may use one of the following:
#
# bind 127.0.0.1 192.168.1.1
#
# protected-mode no
# sentinel監(jiān)聽端口
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 /Users/leon/develop/redis/tmp
pidfile "/app/redis/run/REDIS_CLUSTER_SEN_01.pid"
# 告訴sentinel去監(jiān)聽地址為ip:port的一個(gè)master,這里的master-name可以自定義,quorum是一個(gè)數(shù)字,
# 指明當(dāng)有多少個(gè)sentinel認(rèn)為一個(gè)master失效時(shí),master才算真正失效。master-name只能包含英文字母,
# 數(shù)字,和“.-_”這三個(gè)字符需要注意的是master-ip 要寫真實(shí)的ip地址而不要用回環(huán)地址(127.0.0.1)。
sentinel monitor mymaster 127.0.0.1 6379 2
# 設(shè)置連接master和slave時(shí)的密碼,注意的是sentinel不能分別為master和slave設(shè)置不同的密碼,因此master和slave的密碼應(yīng)該設(shè)置相同。
# Example:
# sentinel auth-pass mymaster MySUPER--secret-0123passw0rd
# 這個(gè)配置項(xiàng)指定了需要多少失效時(shí)間,一個(gè)master才會(huì)被這個(gè)sentinel主觀地認(rèn)為是不可用的。 單位是毫秒,默認(rèn)為30秒
sentinel down-after-milliseconds mymaster 30000
# 這個(gè)配置項(xiàng)指定了在發(fā)生failover主備切換時(shí)最多可以有多少個(gè)slave同時(shí)對(duì)新的master進(jìn)行 同步,
# 這個(gè)數(shù)字越小,完成failover所需的時(shí)間就越長(zhǎng),但是如果這個(gè)數(shù)字越大,就意味著越 多的slave因
# 為replication而不可用。可以通過將這個(gè)值設(shè)為 1 來保證每次只有一個(gè)slave 處于不能處理命令請(qǐng)求的狀態(tài)。
sentinel parallel-syncs mymaster 1
# sentinel failover-timeout <master-name> <milliseconds>
#
# - 同一個(gè)sentinel對(duì)同一個(gè)master兩次failover之間的間隔時(shí)間。
# - 當(dāng)一個(gè)slave從一個(gè)錯(cuò)誤的master那里同步數(shù)據(jù)開始計(jì)算時(shí)間。直到slave被糾正為向正確的master那里同步數(shù)據(jù)時(shí)。
# - 當(dāng)想要取消一個(gè)正在進(jìn)行的failover所需要的時(shí)間。
# - 當(dāng)進(jìn)行failover時(shí),配置所有slaves指向新的master所需的最大時(shí)間。不過,即使過了這個(gè)超時(shí),
# slaves依然會(huì)被正確配置為指向master,但是就不按parallel-syncs所配置的規(guī)則來了。
sentinel failover-timeout mymaster 180000
# 腳本
#
# sentinel的notification-script和reconfig-script是用來配置當(dāng)某一事件發(fā)生時(shí)所需要執(zhí)行的
# 腳本,可以通過腳本來通知管理員,例如當(dāng)系統(tǒng)運(yùn)行不正常時(shí)發(fā)郵件通知相關(guān)人員。對(duì)于腳本的運(yùn)行結(jié)果
# 有以下規(guī)則:
#
# - 若腳本執(zhí)行后返回1,那么該腳本稍后將會(huì)被再次執(zhí)行,重復(fù)次數(shù)目前默認(rèn)為10
# - 若腳本執(zhí)行后返回2,或者比2更高的一個(gè)返回值,腳本將不會(huì)重復(fù)執(zhí)行。
# - 如果腳本在執(zhí)行過程中由于收到系統(tǒng)中斷信號(hào)被終止了,則同返回值為1時(shí)的行為相同。
# - 一個(gè)腳本的最大執(zhí)行時(shí)間為60s,如果超過這個(gè)時(shí)間,腳本將會(huì)被一個(gè)SIGKILL信號(hào)終止,之后重新執(zhí)行
# 通知腳本:
#
# 當(dāng)sentinel有任何警告級(jí)別的事件發(fā)生時(shí)(比如說redis實(shí)例的主觀失效和客觀失效等等),將會(huì)去調(diào)用
# 這個(gè)腳本,這時(shí)這個(gè)腳本應(yīng)該通過郵件,SMS等方式去通知系統(tǒng)管理員關(guān)于系統(tǒng)不正常運(yùn)行的信息。調(diào)用該
# 腳本時(shí),將傳給腳本兩個(gè)參數(shù),一個(gè)是事件的類型,一個(gè)是事件的描述。如果sentinel.conf配置文件中
# 配置了這個(gè)腳本路徑,那么必須保證這個(gè)腳本存在于這個(gè)路徑,并且是可執(zhí)行的,否則sentinel無法正常
# 啟動(dòng)成功。
# sentinel notification-script mymaster /var/redis/notify.sh
# 配置腳本:
#
# 當(dāng)一個(gè)master由于failover而發(fā)生改變時(shí),這個(gè)腳本將會(huì)被調(diào)用,通知相關(guān)的客戶端關(guān)于master地址已
# 經(jīng)發(fā)生改變的信息。以下參數(shù)將會(huì)在調(diào)用腳本時(shí)傳給腳本:
#
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
# 目前<state>總是“failover”, <role>是“l(fā)eader”或者“observer”中的一個(gè)。
# 參數(shù) from-ip, from-port, to-ip, to-port是用來和舊的master和新的master(即舊的slave)
# 通信的。這個(gè)腳本應(yīng)該是通用的,能被多次調(diào)用,不是針對(duì)性的。
# sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
redis-sentinel.conf
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
推薦閱讀更多精彩內(nèi)容
- 1、Units單位 配置大小單位,開頭定義了一些基本的度量單位,只支持bytes,不支持bit 對(duì)大小寫不敏感 2...
- Redis官方文檔對(duì)VM的使用提出了一些建議:當(dāng)key很小而value很大時(shí),使用VM的效果會(huì)比較好.因?yàn)檫@樣節(jié)約...
- linux 啟動(dòng) redis:cd /usr/local/redis-3.2.0src/redis-server ...
- By default Redis does not run as a daemon. Use 'yes' if y...