elasticsearch启动后调用接口报master_not_discovered_exception

介绍


elasticsearch 7 启动正常
配置

cluster.name: skywallking-es
path.data: /pan_nfs/moniter2/data
network.host: 0.0.0.0
discovery.seed_hosts: ["10.64.35.14"]

调用接口


使用curl调用接口报错master_not_discovered_exception

curl -X GET http://10.64.35.14:9200/_cat/nodes?pretty
{
    "error": {
        "root_cause": [
            {
                "type": "master_not_discovered_exception",
                "reason": null
            }
        ],
        "type": "master_not_discovered_exception",
        "reason": null
    },
    "status": 503
}

解决方案


在elasticsearch每个配置文件指定初始节点
单实例的也要加上这个配置,否则就会报错

cluster.initial_master_nodes: node-1

调整配置elasticsearch.yml


vim config/elasticsearch.yml

cluster.name: skywallking-es
network.host: 10.64.35.14
http.port: 9200
discovery.seed_hosts: ["10.64.35.14:9200"]
cluster.initial_master_nodes: ["10.64.35.14"]

重启elasticsearch


#查看elasticsearch进程 
ps -ef | grep elastic
#杀死进程 
kill -9 PID
#启动elasticsearch
bin/elasticsearch -d

测试


curl -X GET http://10.64.35.14:9200/_cat/nodes?pretty

10.64.35.14 12 23 0 0.07 0.08 0.08 dilmrt * code404.icu

版权声明:本文为作者原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原创文章,作者:老C,如若转载,请注明出处:https://www.code404.icu/1502.html

发表评论

登录后才能评论