Elasticsearch:群集上的503错误-未找到主节点

时间:2018-12-11 14:32:35

标签: amazon-web-services elasticsearch

我暂时在AWS上建立了具有3个主服务器的集群。

这是三个/etc/elasticsearch/elasticsearch.yml文件

1。master1

cluster.name: es-staging

path.data: /var/lib/elasticsearch

path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true

network.host: _ec2:privateIp_
discovery.ec2.endpoint: ec2.eu-west-1.amazonaws.com
discovery.ec2.host_type: private_ip
discovery.zen.hosts_provider: ec2
http.port: 9200
discovery.zen.minimum_master_nodes: 2 
node.master: true
s3.client.default.endpoint: s3-eu-west-1.amazonaws.com
transport.tcp.port: 9300
node.name: elastic-master1-stg
action.auto_create_index: true

2。master2

cluster.name: es-staging

path.data: /var/lib/elasticsearch

path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true

network.host: _ec2:privateIp_
discovery.ec2.endpoint: ec2.eu-west-1.amazonaws.com
discovery.ec2.host_type: private_ip
discovery.zen.hosts_provider: ec2
http.port: 9200
discovery.zen.minimum_master_nodes: 2
node.master: true
s3.client.default.endpoint: s3-eu-west-1.amazonaws.com
transport.tcp.port: 9300
node.name: elastic-master2-stg
action.auto_create_index: true

3。master3

cluster.name: es-staging

path.data: /var/lib/elasticsearch

path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true

network.host: _ec2:privateIp_
discovery.ec2.endpoint: ec2.eu-west-1.amazonaws.com
discovery.ec2.host_type: private_ip
discovery.zen.hosts_provider: ec2
http.port: 9200
discovery.zen.minimum_master_nodes: 2
node.master: true
s3.client.default.endpoint: s3-eu-west-1.amazonaws.com
transport.tcp.port: 9300
node.name: elastic-master3-stg
action.auto_create_index: true

但是,在说master1时:

curl -XGET http://10.11.11.118:9200/_cluster/health

{"error":{"root_cause":[{"type":"master_not_discovered_exception","reason":null}],"type":"master_not_discovered_exception","reason":null},"status":503}

我已经安装了discovery-ec2插件

1 个答案:

答案 0 :(得分:0)

事实证明,需要使用以下策略将角色附加到实例上

{
    "Statement": [
        {
            "Action": [
                "ec2:DescribeInstances"
            ],
            "Effect": "Allow",
            "Resource": [
                "*"
            ]
        }
    ],
    "Version": "2012-10-17"
}