私の連絡先情報
郵便メール:
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
方法があっても技術がなければ、それでも技術を求めることができ、技術があっても方法がなければ、技術で止まってしまいます。
このシリーズの Redis バージョン 7.2.5
ソースコードのアドレス: https://gitee.com/pearl-organization/study-redis-demo
解凍されたソース コード ファイルで、Sentinel 構成ファイルを確認できます。 sentinel.conf
:
# Example sentinel.conf
# By default protected mode is disabled in sentinel mode. Sentinel is reachable
# from interfaces different than localhost. Make sure the sentinel instance is
# protected from the outside world via firewalling or other means.
protected-mode no
# port <sentinel-port>
# The port that this sentinel instance will run on
port 26379
# By default Redis Sentinel does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis-sentinel.pid when
# daemonized.
daemonize no
# When running daemonized, Redis Sentinel writes a pid file in
# /var/run/redis-sentinel.pid by default. You can specify a custom pid file
# location here.
pidfile /var/run/redis-sentinel.pid
# Specify the server verbosity level.
# This can be one of:
# debug (a lot of information, useful for development/testing)
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
# nothing (nothing is logged)
loglevel notice
# Specify the log file name. Also the empty string can be used to force
# Sentinel to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile ""
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
# syslog-enabled no
# Specify the syslog identity.
# syslog-ident sentinel
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# syslog-facility local0
# 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.
#
# Replicas are auto-discovered, so you don't need to specify replicas in
# any way. Sentinel itself will rewrite this configuration file adding
# the replicas using additional configuration options.
# Also note that the configuration file is rewritten when a
# replica 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 replicas.
# Useful if there is a password set in the Redis instances to monitor.
#
# Note that the master password is also used for replicas, so it is not
# possible to set a different password in masters and replicas 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 auth-user <master-name> <username>
#
# This is useful in order to authenticate to instances having ACL capabilities,
# that is, running Redis 6.0 or greater. When just auth-pass is provided the
# Sentinel instance will authenticate to Redis using the old "AUTH <pass>"
# method. When also an username is provided, it will use "AUTH <user> <pass>".
# In the Redis servers side, the ACL to provide just minimal access to
# Sentinel instances, should be configured along the following lines:
#
# user sentinel-user >somepassword +client +subscribe +publish
# +ping +info +multi +slaveof +config +client +exec on
# sentinel down-after-milliseconds <master-name> <milliseconds>
#
# Number of milliseconds the master (or any attached replica 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
# IMPORTANT NOTE: starting with Redis 6.2 ACL capability is supported for
# Sentinel mode, please refer to the Redis website https://redis.io/topics/acl
# for more details.
# Sentinel's ACL users are defined in the following format:
#
# user <username> ... acl rules ...
#
# For example:
#
# user worker +@admin +@connection ~* on >ffa9203c493aa99
#
# For more information about ACL configuration please refer to the Redis
# website at https://redis.io/topics/acl and redis server configuration
# template redis.conf.
# ACL LOG
#
# The ACL Log tracks failed commands and authentication events associated
# with ACLs. The ACL Log is useful to troubleshoot failed commands blocked
# by ACLs. The ACL Log is stored in memory. You can reclaim memory with
# ACL LOG RESET. Define the maximum entry length of the ACL Log below.
acllog-max-len 128
# Using an external ACL file
#
# Instead of configuring users here in this file, it is possible to use
# a stand-alone file just listing users. The two methods cannot be mixed:
# if you configure users here and at the same time you activate the external
# ACL file, the server will refuse to start.
#
# The format of the external ACL user file is exactly the same as the
# format that is used inside redis.conf to describe users.
#
# aclfile /etc/redis/sentinel-users.acl
# requirepass <password>
#
# You can configure Sentinel itself to require a password, however when doing
# so Sentinel will try to authenticate with the same password to all the
# other Sentinels. So you need to configure all your Sentinels in a given
# group with the same "requirepass" password. Check the following documentation
# for more info: https://redis.io/topics/sentinel
#
# IMPORTANT NOTE: starting with Redis 6.2 "requirepass" is a compatibility
# layer on top of the ACL system. The option effect will be just setting
# the password for the default user. Clients will still authenticate using
# AUTH <password> as usually, or more explicitly with AUTH default <password>
# if they follow the new protocol: both will work.
#
# New config files are advised to use separate authentication control for
# incoming connections (via ACL), and for outgoing connections (via
# sentinel-user and sentinel-pass)
#
# The requirepass is not compatible with aclfile option and the ACL LOAD
# command, these will cause requirepass to be ignored.
# sentinel sentinel-user <username>
#
# You can configure Sentinel to authenticate with other Sentinels with specific
# user name.
# sentinel sentinel-pass <password>
#
# The password for Sentinel to authenticate with other Sentinels. If sentinel-user
# is not configured, Sentinel will use 'default' user with sentinel-pass to authenticate.
# sentinel parallel-syncs <master-name> <numreplicas>
#
# How many replicas we can reconfigure to point to the new replica simultaneously
# during the failover. Use a low number if you use the replicas to serve query
# to avoid that all the replicas 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 replica 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 replica).
#
# - The maximum time a failover in progress waits for all the replicas to be
# reconfigured as replicas of the new master. However even after this time
# the replicas 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 "start"
# <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 replica
# (now a master).
#
# This script should be resistant to multiple invocations.
#
# Example:
#
# sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
# SECURITY
#
# By default SENTINEL SET will not be able to change the notification-script
# and client-reconfig-script at runtime. This avoids a trivial security issue
# where clients can set the script to anything and trigger a failover in order
# to get the program executed.
sentinel deny-scripts-reconfig yes
# REDIS COMMANDS RENAMING (DEPRECATED)
#
# WARNING: avoid using this option if possible, instead use ACLs.
#
# Sometimes the Redis server has certain commands, that are needed for Sentinel
# to work correctly, renamed to unguessable strings. This is often the case
# of CONFIG and SLAVEOF in the context of providers that provide Redis as
# a service, and don't want the customers to reconfigure the instances outside
# of the administration console.
#
# In such case it is possible to tell Sentinel to use different command names
# instead of the normal ones. For example if the master "mymaster", and the
# associated replicas, have "CONFIG" all renamed to "GUESSME", I could use:
#
# SENTINEL rename-command mymaster CONFIG GUESSME
#
# After such configuration is set, every time Sentinel would use CONFIG it will
# use GUESSME instead. Note that there is no actual need to respect the command
# case, so writing "config guessme" is the same in the example above.
#
# SENTINEL SET can also be used in order to perform this configuration at runtime.
#
# In order to set a command back to its original name (undo the renaming), it
# is possible to just rename a command to itself:
#
# SENTINEL rename-command mymaster CONFIG CONFIG
# HOSTNAMES SUPPORT
#
# Normally Sentinel uses only IP addresses and requires SENTINEL MONITOR
# to specify an IP address. Also, it requires the Redis replica-announce-ip
# keyword to specify only IP addresses.
#
# You may enable hostnames support by enabling resolve-hostnames. Note
# that you must make sure your DNS is configured properly and that DNS
# resolution does not introduce very long delays.
#
SENTINEL resolve-hostnames no
# When resolve-hostnames is enabled, Sentinel still uses IP addresses
# when exposing instances to users, configuration files, etc. If you want
# to retain the hostnames when announced, enable announce-hostnames below.
#
SENTINEL announce-hostnames no
# When master_reboot_down_after_period is set to 0, Sentinel does not fail over
# when receiving a -LOADING response from a master. This was the only supported
# behavior before version 7.0.
#
# Otherwise, Sentinel will use this value as the time (in ms) it is willing to
# accept a -LOADING response after a master has been rebooted, before failing
# over.
SENTINEL master-reboot-down-after-period mymaster 0
プロテクトモードを有効にするかどうかを設定します。
protected-mode no
デフォルトは no
実稼働環境では、ローカル ホスト以外の他のアドレスにもアクセスできるため、ファイアウォールなどの手段で保護する必要があります。Sentinel
インスタンスを停止し、外部ネットワークへのアクセスを禁止します。
センチネル ノードの実行ポートを構成します。
port 26379
バックグラウンド実行 (デーモンプロセスとして実行) を許可するかどうかを構成します。デフォルトは no
、推奨設定はyes
、いつRedis Sentinel
デーモンとして実行する場合、/var/run/redis-sentinel.pid
書くPID
書類。
daemonize no
構成 Redis Sentinel
デーモンとして実行する場合、PID
ファイルの場所と名前。
pidfile /var/run/redis-sentinel.pid
ログレベルを設定します。
loglevel notice
設定可能な項目:
debug
: 開発/テストに役立つ情報が満載verbose
: あまり有益ではないが、あまり役に立たない情報がたくさんあります。debug
レベルがわかりにくいnotice
: 中程度の冗長性。おそらく実稼働環境で必要なものです。warning
:非常に重要/重大なメッセージのみをログに記録しますnothing
:何も記録しませんログファイル名を設定します。空の文字列を使用して強制します Sentinel
標準出力にログオンします。
logfile ""
システムログを有効にするかどうかを設定します。
# syslog-enabled no
システム ログの ID を構成します。
# syslog-ident sentinel
システムログ用のデバイスを指定します。でなければなりません USER
またはLOCAL0-LOCAL7
その間の1つ。
# syslog-facility local0
現在の値を指定しますSentinel
ノーダルIP
アドレスとポート。スレーブ ノードが配置されている場合など、特定のネットワーク構成または展開シナリオで役立ちます。NAT
後で、またはコンテナ/仮想化テクノロジが使用されるとき。
sentinel announce-ip <ip>
sentinel announce-port <port>
作業ディレクトリを構成します。Redis Sentinel
たとえば、次のように切り替えます。 /tmp
ディレクトリは、他のファイル システムなどの管理タスクの干渉を避けるための最も簡単な方法です。
dir /tmp
を定義するために使用される主要な構成アイテムです。 Sentinel
監視されているRedis
マスターサーバー、少なくとも次の場合にのみ<quorum>
個人的なSentinel
同意がある場合のみ、O_DOWN
(目標オフライン) ステータス。
# sentinel monitor <master-name> <ip> <redis-port> <quorum>
sentinel monitor mymaster 127.0.0.1 6379 2
パラメータの説明:
<master-name>
: Redis
マスターノードで指定された名前です。Sentinel
設定と通知に使用されます。 <ip>
: マスターノードのIP
住所。<redis-port>
: マスターノードのリスニングポート。<quorum>
: 意味 Sentinel
マスター サーバーが利用できないとみなすために必要な最小投票数 (通常はセンチネル数の半分以上が推奨されます)。たとえば、欲しい Sentine
l という名前のファイルを監視します mymaster
のRedis
マスターノード、サーバーのIP
住所は192.168.1.1
、ポートは 6379
少なくとも 2 つ必要です Sentinel
メインサーバーが利用できないことが合意された場合にのみ、客観的にオフラインとしてマークされます。
sentinel monitor mymaster 127.0.0.1 6379 2
予防:
Sentinel
追加の構成オプションを追加することで、それ自体がこの構成ファイルをオーバーライドしてスレーブ ノードを含めます。A-z 0-9
そして.
、-
、_
。O_DOWN
定足数を把握する必要があるSentinel
過半数が選出されるまでフェイルオーバーを開始できないため、少数の場合はフェイルオーバーを実行できません。監視したい場合 Redis
インスタンスにはパスワードが設定されており、sentinel auth-pass
マスターノードとスレーブノードの認証用のパスワードを設定します。マスター ノードのパスワードはスレーブ ノードでも使用されるため、マスター ノードとスレーブ ノードのパスワードは一致している必要があることに注意してください。認証が有効になっていない場合Redis
インスタンス、実行AUTH
このコマンドは効果がありません。
sentinel auth-pass <master-name> <password>
ユーザー名を構成することもできます。
sentinel auth-user <master-name> <username>
するために Sentinel
インスタンスは最小限のアクセスを提供するため、次のように構成する必要があります。ACL
:
user sentinel-user >somepassword +client +subscribe +publish
+ping +info +multi +slaveof +config +client +exec on
で >somepassword
ユーザーに設定されたパスワード、client
、subscribe
実行を待つ Sentinel
監視に必要な最低限のコマンドの権限、on
このキーワードは、これらのアクセス許可がすべてのデータベースに有効であることを示します。
存在する Sentinel
マスター/スレーブノードに送信PING
コマンド後、一定のミリ秒以内に応答がない場合、次のようにマークされます。S_DOWN
ステータス (主観的にはオフライン)。
設定するミリ秒数
# sentinel down-after-milliseconds <master-name> <milliseconds>
sentinel down-after-milliseconds mymaster 30000
デフォルト値は次のとおりです 30
秒、この時間内に応答できない場合、Sentinel
フェイルオーバー プロセスをトリガーする必要があるかどうかはさらに評価されます。
から Redis 6.2
スタート、センチネルモードのサポートACL
(アクセス制御リスト) 機能により、マスター/スレーブ ノードを構成できます ACL
ユーザー名と権限。
# user <用户名> ... ACL规则 ...
# user <username> ... acl rules ...
user worker +@admin +@connection ~* on >ffa9203c493aa99
例のパラメータの説明:
>ffa9203c493aa99
ユーザーのパスワードです+@admin、+@connection
ユーザーに与えられる手段 worker
特定のコマンド セットへのアクセス~*
すべてのキーへのアクセスを表しますon
これらの権限がすべてのデータベースに対して有効であることを示します構成 ACL
ログの最大エントリ長。
acllog-max-len 128
ACL
ログ追跡とACL
(アクセス制御リスト) 関連の失敗したコマンドと認証イベント。調査のためACL
ブロックされた失敗したコマンドは非常に便利です。ACL
ログはメモリに保存され、利用可能ACL LOG RESET
メモリを再利用するコマンド。
ログの最大エントリ長を調整することで、ログが占有するメモリ量を制御し、必要に応じてログをリセットすることでメモリを解放できます。これはメンテナンスに役立ちます Redis
サーバーのパフォーマンスとセキュリティは、管理者が潜在的なアクセス制御の問題をタイムリーに検出して解決するのに役立つため、重要です。
を除いて sentinel.conf
ファイル内でユーザーを構成するだけでなく、外部的にユーザーを構成することもできます。ACL
ファイルを作成する場合、これら 2 つの方法を混合することはできません。混合しない場合、サーバーは起動を拒否します。
# aclfile /etc/redis/sentinel-users.acl
外部の ACL
ファイルの形式は次のとおりです。redis.conf
ファイルで使用される形式はまったく同じです。
構成 Sentinel
設定後にパスワード自体を検証する必要がありますSentine
他のパスワードと同じパスワードを使用しようとします Sentinel
認証する。
requirepass <password>
そして aclfile
構成とACL LOAD
コマンドに互換性がないため、requirepass
無視される。
構成 Sentinel
他の人とSentinel
認証用のユーザー名とパスワード。
sentinel sentinel-user <username>
sentinel sentinel-pass <password>
設定されていない場合 sentinel-user
、使用しますdefault
ユーザーとsentinel-pass
認証する。
いつ制御するか Redis Sentinel
マスター ノードの障害が検出され、フェイルオーバーが必要な場合、同時に新しいマスター ノードとの同期を試行できるスレーブ ノードの数。その目的は、フェールオーバー プロセス中の新しいプライマリ ノードの同期速度とネットワーク リソースの使用のバランスを取ることです。
# sentinel parallel-syncs <master-name> <numreplicas>
sentinel parallel-syncs mymaster 1
フェイルオーバー プロセス中に、選択された新しいマスター ノードは書き込み操作の受け入れを開始し、他のスレーブ ノードは新しいマスター ノードと同期してデータ セットを更新する必要があります。すべてのスレーブ ノードが同時に同期を開始すると、ネットワークと新しいマスター ノードに大きな負荷がかかる可能性があります。
フェイルオーバーのタイムアウトをミリ秒単位で指定します。デフォルト値は次のとおりです。 3
分(すなわち、180000
ミリ秒)。
sentinel failover-timeout <master-name> <milliseconds>
指定時間内であれば、Sentinel
フェイルオーバーに必要なすべての手順 (新しいマスター ノードの選択、スレーブ ノードのレプリケーション構成の更新など) を完了できない場合、フェイルオーバー操作は失敗したとみなされます。
ユーザーがスクリプトを指定できるようにします。 Sentinel
ノードは重要なイベントを検出します (例:Redis
インスタンスに主観的障害または客観的障害などが発生すると、このスクリプトが自動的に呼び出され、システム管理者に通知するか、自動障害処理が実行されます。
sentinel notification-script <master-name> <script-path>
中の誰にとっても WARNING
生成されたレベルSentinel
イベント (たとえば、-sdown
、-odown
など)、指定された通知スクリプトを呼び出します。このスクリプトは、電子メール、SMS、またはその他のメッセージング システムを介してシステム管理者に監視対象のメッセージを通知します。 Redis
システムに問題があります。
例:
sentinel notification-script mymaster /var/redis/notify.sh
上の例は、という名前のファイルに対して、 mymaster
メインサーバーの場合、WARNING
レベルイベント、Sentinel
電話します/var/redis/notify.sh
スクリプトを実行し、イベント タイプとイベントの説明をパラメーターとして渡します。
通知スクリプトおよびその他のスクリプトの最大実行時間は次のとおりです。 60
この制限に達すると、スクリプトは通過します。SIGKILL
Signal は終了し、再度実行を試みます。スクリプトの実行は、次のエラー処理ルールに従います。
1
」を実行して終了すると、実行は後で再試行されます (再試行の最大回数は現在 に設定されています)10
二流)。2
」(またはそれ以上)の場合、スクリプトの実行は再試行されません。1
同時。ユーザーがスクリプトを指定できるようにします。 Sentinel
このスクリプトは、マスター ノードのフェイルオーバーが完了した後に自動的に呼び出され、構成が変更されたことをクライアントに通知するために必要な操作を実行できます。
sentinel client-reconfig-script <master-name> <script-path>
通常、このスクリプトの主な機能は次のとおりです。
いつ Sentine
電話します sentinel client-reconfig-script
スクリプトを指定する場合、一連のパラメータがスクリプトに渡されます。これらのパラメータには、通常次のようなフェイルオーバー結果情報が含まれます。
IP
住所。IP
住所。例:
sentinel client-reconfig-script mymaster /var/redis/reconfig.sh
上の例は、名前が mymaster
フェイルオーバーにより のプライマリサーバーが変更された場合、Sentinel
電話します/var/redis/reconfig.sh
スクリプトを作成し、マスター サーバーの名前、役割、ステータス、および元のマスター サーバーの名前を渡します。IP
およびポート、新しいマスターサーバーIP
およびポートパラメータ。
通行を許可するかどうかを制御するために使用されます SENTINEL SET
コマンドの変更notification-script
そしてclient-reconfig-script
構成。
sentinel deny-scripts-reconfig yes
として設定され yes
(デフォルト)、追い越しが禁止されていることを示しますSENTINEL SET
スクリプト構成を変更するコマンドは、システムのセキュリティを強化し、不正な変更を防ぐのに役立ちます。
コマンドの名前を変更します (非推奨)。
SENTINEL rename-command mymaster CONFIG GUESSME
いつもの Sentinel
IP アドレスのみを使用し、SENTINEL MONITOR
を指定しますIP
住所。さらに、次のことが必要ですRedis
のreplica-announce-ip
のみ指定してくださいIP
住所。
次の方法で有効にできます resolve-hostnames
ホスト名をサポートするため (hostname
), Sentinel
ホスト名を直接使用するのではなく、ホスト名を解決しようとします。IP
特定するアドレスRedis
例。
SENTINEL resolve-hostnames no
必ず次のことを確認する必要があることに注意してください。 DNS
正しく設定されており、DNS
解析では、それほど長い遅延は発生しません。次のようなコンテナ化されたデプロイメントを使用する場合Docker
またはKubernetes
)、 そして Redis
実例IP
アドレスが変更される可能性があります。有効にしてくださいSENTINEL resolve-hostnames
良い解決策になるかもしれません。
Sentinel がホスト名を使用するかどうかを制御するために使用されます (hostnames
) の代わりに IP
住所。
SENTINEL announce-hostnames no
有効時 resolve-hostnames
時間、Sentinel
インスタンスをユーザーやプロファイルなどに公開するときに引き続き使用されます。IP
住所。このオプションが に設定されている場合、no
Sentinel がマスター/スレーブ ノードの変更通知またはその他の関連情報を公開する場合、IP
ホスト名の代わりにアドレス。
再起動によりマスター ノードが一時的にアクセス不能になったと見なす前にセンチネルが待機するミリ秒数を構成します。これは、システムのメンテナンスまたはアップグレードによる再起動の必要性に対処するのに役立ちます。 Redis
これは、サーバー シナリオで特に役立ちます。
SENTINEL master-reboot-down-after-period mymaster 0
システムの再起動やネットワークの一時的な問題など、特定の状況では、Redis
実際にサーバーが故障しているのではなく、サーバーが一時的にアクセス不能になっている可能性があります。この構成で指定するのは、Sentinel
マスターサーバーを客観的にオフラインとしてマークするまでに待機する必要がある時間の長さ。