文章目录
1. ELK启动报错如下
master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [node-1] to bootstrap a cluster。
尚未发现主节点,该节点先前尚未加入自举(v7 +)集群,并且该节点必须发现符合主节点条件的节点[node-1]来引导集群。
2. 报错原因
ELK集群配置中,node.master: true
表示该节点有作为master节点的资格。一个ELK集群,可以有多个节点拥有该资格,然后通过自举的方式确定哪个节点是master节点。
上述报错是因为在ELK集群中,无法通过自举的方式在有资格成为master节点的节点中,自举出master节点,导致集群无法发现master节点。
3. 报错解决
在/etc/elasticsearch/elasticsearch.yml
文件中加入:cluster.initial_master_nodes: ["master","node"]
具体配置如下:
# 第一个节点
cluster.name: ELK_GZ
node.name: master
node.master: true
node.data: true
network.host: 192.168.80.136
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.80.136","192.168.80.133"]
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 2
cluster.initial_master_nodes: ["master","node"] # 集群初始化master节点,用于引导集群。
# 第二个节点
cluster.name: ELK_GZ
node.name: node
node.master: true
node.data: true
network.host: 192.168.80.133
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.80.136","192.168.80.133"]
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 2
cluster.initial_master_nodes: ["master,node"]