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,也不存储数据;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值