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 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步