redis_cluster-防火墻操作最佳實踐

單實例環(huán)境:

  • redis在做防火墻配置時,只需要打開對應的防火墻端口即可。如配置文件中port指定為6379,那就只要開一個6379.指定6380那就僅僅開個6380即可。

Redis_cluster環(huán)境:

  • 但在redis_cluster集群中,redis的端口必須開二個,一個是配置文件中port所指定的。另一個則必須在port指定端口中加10000整數(shù)后得出。如配置文件中port指定了6379,則在集群環(huán)境中必須開設出16379端口用于通信

不開放高位端口會造成的影響:

  • 在用rdis-trib.rb create 做集群初始配置時,當在確認完集群分配后,等待redis cluster 加入時,一直在等
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster 
aiting for the cluster to join..............................................................

官方給的解釋如下:

Redis Cluster TCP ports

Every Redis Cluster node requires two TCP connections open. The normal Redis TCP port used to serve clients, for example 6379, plus the >port obtained by adding 10000 to the data port, so 16379 in the example.

This second high port is used for the Cluster bus, that is a node-to-node communication channel using a binary protocol. The Cluster bus >is used by nodes for failure detection, configuration update, failover authorization and so forth. Clients should never try to communicate >with the cluster bus port, but always with the normal Redis command port, however make sure you open both ports in your firewall, >otherwise Redis cluster nodes will be not able to communicate.

The command port and cluster bus port offset is fixed and is always 10000.

Note that for a Redis Cluster to work properly you need, for each node:

The normal client communication port (usually 6379) used to communicate with clients to be open to all the clients that need to reach the cluster, plus all the other cluster nodes (that use the client port for keys migrations).
The cluster bus port (the client port + 10000) must be reachable from all the other cluster nodes.

If you don't open both TCP ports, your cluster will not work as expected.

The cluster bus uses a different, binary protocol, for node to node data exchange, which is more suited to exchange information between >nodes using little bandwidth and processing time.

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • 5/15/2017 7:06:35 PM 縱觀各大組件,配置文件占據(jù)極其重要的地位??膳渲没彩钱斚麻_發(fā)的一流行趨...
    愛做夢的胖子閱讀 4,544評論 0 8
  • Redis 配置文件示例 注意:想要讀取配置文件,Redis的第一個參數(shù)必須是文件的路徑 ./redis-serv...
    起個名忒難閱讀 1,364評論 0 1
  • # redis 配置文件示例 # 當你需要為某個配置項指定內存大小的時候,必須要帶上單位, # 通常的格式就是 1...
    iyimao閱讀 910評論 0 2
  • 1 Redis介紹1.1 什么是NoSql為了解決高并發(fā)、高可擴展、高可用、大數(shù)據(jù)存儲問題而產生的數(shù)據(jù)庫解決方...
    克魯?shù)吕?/span>閱讀 5,748評論 0 36
  • 最近想想練字也斷斷續(xù)續(xù)有一段時間了寫篇東西分享一下有益于他人 也望大神不吝賜教 有不對的地方還請周正 俗話說工欲畢...
    你親愛的zz大人閱讀 3,500評論 0 3

友情鏈接更多精彩內容