Search code examples
elasticsearchcluster-computingelastic-stackelkelasticsearch-7

Add nodes to make local cluster Elasticsearch [7.8]


I'm learning about Elastic Search (v7.8) so I made a local cluster to test it. I made 3 virtual machines with Ubuntu 18, same amount of resources, in the same network with the IPs:

  • 192.168.1.77
  • 192.168.1.76
  • 192.168.1.75

All correct individual installation, each respond to her API:

curl -XGET localhost:9200/?pretty

But when I tried to make a cluster editing /etc/elasticsearch/elasticsearch.yml each forms its own cluster of the same name with a single node. Here my file: https://gist.github.com/RedxLus/f8eb561157c7f2b61fb4dfaa74fe8868

Here is the output of each node. Exactly the same.:

curl -XGET 192.168.1.77:9200/_cluster/health?pretty

{
  "cluster_name" : "luisiblog",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

I don't know if it is a configuration error or if I have skipped any steps to add the nodes. I hope they help me. Thank you very much to all.


Solution

  • First thing is that you are missing the network.host proper value which should be 0.0.0.0 to make sure this is visible on non-loopback address.

    Can you try with below configs:

    #this is for node-1

     cluster.name: elasticsearch
        node.name: node-1
        network.host: 0.0.0.0
        discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
        cluster.initial_master_nodes: ["192.168.1.77"]
        discovery.zen.minimum_master_nodes : 1
        node.master: true
    

    #this is for node-2

    cluster.name: elasticsearch
    node.name: node-2
    network.host: 0.0.0.0
    discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
    cluster.initial_master_nodes: ["192.168.1.77"]
    discovery.zen.minimum_master_nodes : 1
    node.master: false
    

    # this is for node-3

    cluster.name: elasticsearch
    node.name: node-3
    network.host: 0.0.0.0
    discovery.seed_hosts: ["192.168.1.77","192.168.1.76","192.168.1.75"]
    cluster.initial_master_nodes: ["192.168.1.77"]
    discovery.zen.minimum_master_nodes : 1
    node.master: false
    

    Please not that I am making one dedicated master node, node-1 in this case