Elasticserch Master不发现异常 - 版本2.3.0 [英] Elasticserch Master not discoverd exception - Version 2.3.0

查看:375
本文介绍了Elasticserch Master不发现异常 - 版本2.3.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次使用弹性搜索。
以下是我的环境/配置。


  1. 我有3个EC2 Ubuntu 14.04实例。

  2. 我已经下载并提取了elasticsearch-2.3.0.tar.gz。

  3. 我已经在弹性搜索/配置的每个实例中更改了elasticsearch.yml文件。
    我已经在elasticsearch.yml文件中进行了以下更改。

3.1。 EC2实例号1(我的客户端节点)

  cluster.name:MyCluster 
node.name:客户端
node.master:false
node.data:false
path.data:/ home / ubuntu / elasticsearch / data / elasticsearch / nodes / 0

发现.zen.ping.multicast.enabled:false
discovery.zen.ping.unicast.hosts:[aa.aa.aa.aa,aa.aa.aaa.aa,aaa.a. aa.aa]

在上面的括号中,我提供了我所有3个实例的IP。 p>

3.2。 EC2实例2(我的主节点)

  cluster.name:MyCluster 
node.name: Master
node.master:true
node.data:true
path.data:/ home / ubuntu / elasticsearch / data / elasticsearch / nodes / 0

discovery .zen.ping.multicast.enabled:false
discovery.zen.ping.unicast.hosts:[aa.aa.aa.aa,aa.aa.aaa.aa,aaa.a. aa.aa]

在上面的括号中,我提供了我所有3个实例的IP。
请注意,我已经创建了node.data:true(


  1. 但是当我使用curl -XGET'



    我希望我清楚我的问题,我正在朝着正确的方向。



    谢谢

    解决方案

    Elasticsearch 2.0+默认将所有套接字绑定到 localhost 。这意味着,默认情况下,该机器之外的任何内容都不能与之对话。



    这是为了安全目的和简单的开发设置而明确的。在本地,它工作得很好,但是当它变得更加严重时,您需要为您的环境配置它。这也是为什么你可以通过 localhost 与节点通话。 基本上,当您希望使用网络设置。这适用于ES 2.3 +:

      network:
    bind_host:[_local_,_global_]
    publish_host: _global_

    然后其他节点可以与公共IP通话,但您仍然有localhost来简化与节点本地(例如,你 - 人类 - 从来没有必要知道IP,当SSHed到一个框)。



    正如你在EC2与Elasticsearch 2.0+,我建议您安装云 - 插件(未来读者请注意:此插件在ES 5.x中被分解成3个独立插件!)。

      $ bin / plugin install cloud-aws 

    您可以从EC2实例中获得更多的意识。有了这个伟大的力量,您可以向您的ES配置添加更多细节:

     #保证插件已安装
    plugin.mandatory:cloud-aws

    #发现/ AWS EC2设置
    发现
    类型:ec2
    ec2:
    availability_zones:[us-east -1a,us-east-1b]
    组:[my_security_group1,my_security_group2]

    #这里的键需要用你的键
    云:
    aws
    access_key:AKVAIQBF2RECL7FJWGJQ
    secret_key:vExyMThREXeRMm / b / LRzEB8jWwvzQeXgjqMX + 6br
    区域:us-east-1
    node.auto_attributes:true

    #绑定网络上的任何IP,你想允许连接。
    #你_should_只想允许网络内的连接
    #,所以你只需要绑定到私有IP
    node.host:_ec2:privateIp_

    #您可以绑定到可以与
    #节点进行通信的所有主机,但通过私有IP将其通告给其他节点(由于所使用的发现类型不同,所以更少
    #相关理念)。
    #node:
    #bind_host:[_local_,_ec2:privateIp_,_ec2:publicIp_,_ec2:publicDns_]
    #publish_host:_ec2:privateIp_

    这将允许他们通过将IP地址绑定到预期来进行通话。 如果您希望能够SSH到这些机器并通过本地主机与ES进行通信(您可能需要进行调试),那么您将需要使用 _local _ 作为 bind_host


    This is the first time I am working with elasticsearch. The following is my environment/configuration.

    1. I have 3 EC2 Ubuntu 14.04 instances.
    2. I have download and extracted elasticsearch-2.3.0.tar.gz.
    3. I have changed elasticsearch.yml file under elasticsearch/config in each of the instance. I have made the following changes in each of the elasticsearch.yml file.

    3.1. EC2 Instance number 1 ( my client node)

    cluster.name: MyCluster
    node.name: Client
    node.master: false
    node.data: false
    path.data: /home/ubuntu/elasticsearch/data/elasticsearch/nodes/0
    
    discovery.zen.ping.multicast.enabled: false
    discovery.zen.ping.unicast.hosts: ["aa.aa.aa.aa" , "aa.aa.aaa.aa" , "aaa.a.aa.aa"]
    

    In the above bracket I have provide IP of all my 3 instances.

    3.2. EC2 Instance number 2 ( my Master node)

    cluster.name: MyCluster
    node.name: Master
    node.master: true
    node.data: true
    path.data: /home/ubuntu/elasticsearch/data/elasticsearch/nodes/0
    
    discovery.zen.ping.multicast.enabled: false
    discovery.zen.ping.unicast.hosts: ["aa.aa.aa.aa" , "aa.aa.aaa.aa" , "aaa.a.aa.aa"]
    

    In the above bracket I have provide IP of all my 3 instances. Note that I have made node.data: true (according to this link)

    3.3. EC2 Instance number 3 ( my data node)

    cluster.name: MyCluster
    node.name: slave_1
    node.master: false
    node.data: true
    path.data: /home/ubuntu/elasticsearch/data/elasticsearch/nodes/0
    
    discovery.zen.ping.multicast.enabled: false
    discovery.zen.ping.unicast.hosts: ["aa.aa.aa.aa" , "aa.aa.aaa.aa" , "aaa.a.aa.aa"]
    

    In the above bracket I have provide IP of all my 3 instances.

    1. After this configuration I run elasticsearch service on each instance starting from data node then master node and client node in the end.
    2. If I check the node status using curl http://localhost:9200, I am getting json which states that the node is running.

    1. But when I check the cluster health using curl -XGET 'http://localhost:9200/_cluster/health?pretty=true' I am getting the following error on my client instance.

    I hope I am clear with my question and I am going in the right direction.

    Thankyou

    解决方案

    Elasticsearch 2.0+ defaults to binding all sockets to localhost. This means, by default, nothing outside of that machine can talk to it.

    This is explicitly for security purposes and simple development setups. Locally, it works great, but you need to configure it for your environment when it gets more serious. This is also why you can talk to the node via localhost. Basically, you want this when you want more than one node across other machines using the network settings. This works with ES 2.3+:

    network:
      bind_host: [ _local_, _global_ ]
      publish_host: _global_
    

    Then other nodes can talk to the public IP, but you still have localhost to simplify working with the node locally (e.g., you--the human--never have to know the IP when SSHed into a box).

    As you are in EC2 with Elasticsearch 2.0+, I recommend that you install the cloud-aws plugin (future readers beware: this plugin is being broken into 3 separate plugins in ES 5.x!).

    $ bin/plugin install cloud-aws
    

    With that installed, you get a bit more awareness out of your EC2 instances. With this great power, you can add more detail to your ES configurations:

    # Guarantee that the plugin is installed
    plugin.mandatory: cloud-aws
    
    # Discovery / AWS EC2 Settings
    discovery
      type: ec2
      ec2:
        availability_zones: [ "us-east-1a", "us-east-1b" ]
        groups: [ "my_security_group1", "my_security_group2" ]
    
    # The keys here need to be replaced with your keys
    cloud:
      aws
        access_key: AKVAIQBF2RECL7FJWGJQ
        secret_key: vExyMThREXeRMm/b/LRzEB8jWwvzQeXgjqMX+6br
        region: us-east-1
      node.auto_attributes: true
    
    # Bind to the network on whatever IP you want to allow connections on.
    # You _should_ only want to allow connections from within the network
    # so you only need to bind to the private IP
    node.host: _ec2:privateIp_
    
    # You can bind to all hosts that are possible to communicate with the
    # node but advertise it to other nodes via the private IP (less
    # relevant because of the type of discovery used, but not a bad idea).
    #node:
    #  bind_host: [ _local_, _ec2:privateIp_, _ec2:publicIp_, _ec2:publicDns_ ]
    #  publish_host: _ec2:privateIp_
    

    This will allow them to talk by binding the IP address to what is expected. If you want to be able to SSH into those machines and communicate with ES over localhost (you probably do for debugging), then you will want the version commented out with _local_ as a bind_host in that list.

    这篇关于Elasticserch Master不发现异常 - 版本2.3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆