elasticsearch 集羣配置

1.elasticsearch新加入節點不能識別問題 
向ES集羣中新加入節點,配置文件也沒有什麼問題,但是就是加不進去,這時候就需要檢查一下防火牆是否開啓.關閉即可 
2.ElasticSearch的集羣可自發現,只要配置相同的集羣名稱,默認爲組播發現機制,默認情況下: 
http 端口:9200 需要打開給調用 
數據傳輸端口:9300 用於集羣之間交換數據 
組播端口(UDP):54328 
上述端口一定不要讓防火牆阻斷,否則,無法完成集羣。 
3.master和data 配置 
1).node.master: true 指定該節點是否有資格被選舉成爲node,默認是true,es是默認集羣中的第一臺機器爲master,如果這臺機掛了就會重新選舉master。 
2).node.data: true 指定該節點是否存儲索引數據,默認爲true。 
4.master和data同時配置會產生一些奇異的效果: 
1) 當master爲false,而data爲true時,會對該節點產生嚴重負荷; 
2) 當master爲true,而data爲false時,該節點作爲一個協調者; 
3) 當master爲false,data也爲false時,該節點就變成了一個負載均衡器。 
ES集羣Master節點配置問題 
ES集羣的主節點發現機制採用單播形式,主要配置有三行,如下:

discovery.zen.minimum_master_nodes: 2 
discovery.zen.ping.multicast.enabled: false 
discovery.zen.ping.unicast.hosts: [“localhost:9001”,”localhost:9101”,”localhost:9701”] 
第一行的配置說明如下:

# Discovery infrastructure ensures nodes can be found within a cluster
# and master node is elected. Multicast discovery is the default.
# Set to ensure a node sees N other master eligible nodes to be considered
# operational within the cluster. This should be set to a quorum/majority of 
# the master-eligible nodes in the cluster.
#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

discovery.zen.minimum_master_nodes: 2

瞭解Zookeeper的話,這個配置就比較容易理解了; 數值取值爲 (有資格當選爲Master的節點個數/2+1), 這樣做是爲了防止腦裂現象, 防止某些主節點自成一個集羣. 考慮到Zookeeper的一些配置, 主節點的個數最好是奇數個,並且不少於3個;但是會帶來一個問題,如必須至少一半以上的主節點是可用的,如果不能滿足這個要求,則系統就會崩潰.

第二行和第三行的配置說明如下:

# Unicast discovery allows to explicitly control which nodes will be used
# to discover the cluster. It can be used when multicast is not present,
# or to restrict the cluster communication-wise.
#
# 1. Disable multicast discovery (enabled by default):
#
discovery.zen.ping.multicast.enabled: false
#
# 2. Configure an initial list of master nodes in the cluster
#    to perform discovery when new nodes (master or data) are started:
#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

discovery.zen.ping.unicast.hosts: [“localhost:9001”,”localhost:9101”,”localhost:9701”]

1.是關閉多播,採用單播;置爲false 
2.是給出所有的Master節點的IP和Port.端口用數據交換接口即可; 
集羣的節點打算分三種角色, master節點,僅充當master作用,不存儲數據; data節點, 僅存儲數據,不能當選爲master節點; observer節點, 既不充當master,也不存儲數據;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章