一切事情的结局都是美好的,如果不好,那它就不是结局。|

夜色微光

园龄:5年5个月粉丝:27关注:11

Elasticsearch master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster

Photo by Sindre Strøm from Pexels

之前学习ElasticSearch集群操作的时候都是启动多个虚拟机,不过那样内存消耗高,也比较麻烦,所以现在在Windows上直接启动多节点。当希望在单机器上启动多个ElasticSearch节点组成集群时,例如有如下配置:

node1: 192.168.31.162:9200
node2: 192.168.31.162:9201
node3: 192.168.31.162:9202

默认配置会出现这种问题:node1作为指定的master节点可以正常启动,

但是node2、3等更多从节点无法发现master节点,一直在警告 master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster。。

这是因为上面的9200 - 9202端口只是设置的ElasticSearch的Http端口,默认的集群选举端口是9300 - 9305,也需要手动设置,所以解决这个问题在节点各自的配置文件里加上类似下面配置就可以了:

#node1 elasticsearch.yml
transport.profiles.default.port: 9300

#node2 elasticsearch.yml
transport.profiles.default.port: 9301

#node3 elasticsearch.yml
transport.profiles.default.port: 9302

详细解释见ElasticSearch文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery-hosts-providers.html#built-in-hosts-providers

基础参考配置:


cluster.name: elastic-cluster1
node.name: node-1
network.host: 192.168.31.162
http.port: 9200
transport.profiles.default.port: 9300
discovery.seed_hosts: ["192.168.31.162:9300", "192.168.31.162:9301", "192.168.31.162:9302"]
cluster.initial_master_nodes: ["node-1"]

现在,我们可以通过http请求来查看ElasticSearch集群已经成功启动

华丽的分割线

本文作者:夜色微光

本文链接:https://www.cnblogs.com/novwind/p/15231323.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   夜色微光  阅读(6845)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起