アリ雲ECSはRedis主備哨兵集団を配置して出会った問題

2081 ワード

一、配置
詳細な導入手順:https://blog.csdn.net/lihongtai/article/details/82826809
Redis5.0バージョンで注意すべきパラメータ構成:https://www.cnblogs.com/ibethfy/p/9965902.html
 
二、出会った問題
1、bindパブリックネットワークIPアドレスの場合、異常:【Cannot assign requested address】
まずbindの意味を理解します.https://blog.csdn.net/cw_hello1/article/details/83444013
理由:ここでbindパブリックネットワークIPアドレスができないのは、ECSのローカルIPがNAT技術によってパブリックネットワークIPに変換されたためである.すなわち、パブリックネットワークIPはECSのいずれかのネットワークカード上のIPではない
ソリューション:bind 0.0.0.0、アリクラウドプライベートネットワークにかかわらず、パブリックネットワークにアクセスできます.
2、SpringBootはRedis主備哨兵集団を配置した後、接続できない
理由:ECSインスタンスはプライベートネットワークのIPアドレスをバインドして、同じくパブリックネットワークのIPアドレスをバインドして、歩哨は監視するRedisインスタンスのIPアドレスを収集して管理して、bind 0.0.0.0を設置した後に、歩哨はこの2つのIPアドレスを収集することができて、接続する時使用するのはプライベートネットワークのIPアドレスで、だから接続することができません
解決策:哨兵プロファイルsentinelを変更します.conf,【sentinel announce-ip哨兵がいる公網IP】
announce-ip構成項目の公式解釈は以下の通りである.
# sentinel announce-ip 
# sentinel announce-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.

NATネットワークの存在を考慮して、非ローカルIPを設定すると、哨兵は正常に外部にアクセスすることができる.
同時に、哨兵が起動した後、配置ファイルsentinelを観察する.confは、RedisインスタンスのプライベートネットワークIPが収集されていないことを発見した.
最後にSpringBootはRedis主備哨兵集団を正常に接続できる
 
注意:上記のシーンは1主3備2哨兵で、1主1備1哨兵は同じECSインスタンスにあり、2備1哨兵は別のECSインスタンスにあり、この2つのECSインスタンスは同じ領域にあり、同じプライベートセグメントに属し、いずれもパブリックネットワークIPをバインドしている.