# 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監聽端口
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去監聽地址為ip:port的一個master,這里的master-name可以自定義,quorum是一個數字,
# 指明當有多少個sentinel認為一個master失效時,master才算真正失效。master-name只能包含英文字母,
# 數字,和“.-_”這三個字符需要注意的是master-ip 要寫真實的ip地址而不要用回環地址(127.0.0.1)。
sentinel monitor mymaster 127.0.0.1 6379 2
# 設置連接master和slave時的密碼,注意的是sentinel不能分別為master和slave設置不同的密碼,因此master和slave的密碼應該設置相同。
# Example:
# sentinel auth-pass mymaster MySUPER--secret-0123passw0rd
# 這個配置項指定了需要多少失效時間,一個master才會被這個sentinel主觀地認為是不可用的。 單位是毫秒,默認為30秒
sentinel down-after-milliseconds mymaster 30000
# 這個配置項指定了在發生failover主備切換時最多可以有多少個slave同時對新的master進行 同步,
# 這個數字越小,完成failover所需的時間就越長,但是如果這個數字越大,就意味著越 多的slave因
# 為replication而不可用??梢酝ㄟ^將這個值設為 1 來保證每次只有一個slave 處于不能處理命令請求的狀態。
sentinel parallel-syncs mymaster 1
# sentinel failover-timeout <master-name> <milliseconds>
#
# - 同一個sentinel對同一個master兩次failover之間的間隔時間。
# - 當一個slave從一個錯誤的master那里同步數據開始計算時間。直到slave被糾正為向正確的master那里同步數據時。
# - 當想要取消一個正在進行的failover所需要的時間。
# - 當進行failover時,配置所有slaves指向新的master所需的最大時間。不過,即使過了這個超時,
# slaves依然會被正確配置為指向master,但是就不按parallel-syncs所配置的規則來了。
sentinel failover-timeout mymaster 180000
# 腳本
#
# sentinel的notification-script和reconfig-script是用來配置當某一事件發生時所需要執行的
# 腳本,可以通過腳本來通知管理員,例如當系統運行不正常時發郵件通知相關人員。對于腳本的運行結果
# 有以下規則:
#
# - 若腳本執行后返回1,那么該腳本稍后將會被再次執行,重復次數目前默認為10
# - 若腳本執行后返回2,或者比2更高的一個返回值,腳本將不會重復執行。
# - 如果腳本在執行過程中由于收到系統中斷信號被終止了,則同返回值為1時的行為相同。
# - 一個腳本的最大執行時間為60s,如果超過這個時間,腳本將會被一個SIGKILL信號終止,之后重新執行
# 通知腳本:
#
# 當sentinel有任何警告級別的事件發生時(比如說redis實例的主觀失效和客觀失效等等),將會去調用
# 這個腳本,這時這個腳本應該通過郵件,SMS等方式去通知系統管理員關于系統不正常運行的信息。調用該
# 腳本時,將傳給腳本兩個參數,一個是事件的類型,一個是事件的描述。如果sentinel.conf配置文件中
# 配置了這個腳本路徑,那么必須保證這個腳本存在于這個路徑,并且是可執行的,否則sentinel無法正常
# 啟動成功。
# sentinel notification-script mymaster /var/redis/notify.sh
# 配置腳本:
#
# 當一個master由于failover而發生改變時,這個腳本將會被調用,通知相關的客戶端關于master地址已
# 經發生改變的信息。以下參數將會在調用腳本時傳給腳本:
#
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
# 目前<state>總是“failover”, <role>是“leader”或者“observer”中的一個。
# 參數 from-ip, from-port, to-ip, to-port是用來和舊的master和新的master(即舊的slave)
# 通信的。這個腳本應該是通用的,能被多次調用,不是針對性的。
# sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
redis-sentinel.conf
最后編輯于 :
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
- 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事?!?“怎么了?”我有些...
- 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
- 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
推薦閱讀更多精彩內容
- 1、Units單位 配置大小單位,開頭定義了一些基本的度量單位,只支持bytes,不支持bit 對大小寫不敏感 2...
- linux 啟動 redis:cd /usr/local/redis-3.2.0src/redis-server ...
- By default Redis does not run as a daemon. Use 'yes' if y...