Running a elasticsearch 7.9 cluster of two (or several) nodes on same (windows) machine

Hi !
i'm trying to run a cluster of two (or several) nodes on same (windows) machine.

Each node is pointing to the other node in the "discovery.seed_hosts"

node 1 configuration is (the only rows that changed from default) (Note that each):

network.host: 127.0.0.1
cluster.name: my-application
node.name: node-1
http.port: 9202
discovery.seed_hosts: ["127.0.0.1:9200"]
cluster.initial_master_nodes: ["node-1"]

node 2 configuration is (the only rows that changed from default):

cluster.name: my-application
node.name: node-2
network.host: 127.0.0.1
http.port: 9200
discovery.seed_hosts: ["127.0.0.1:9202"]
cluster.initial_master_nodes: ["node-1"]

After i start the two nodes (on the same server) and do:

GET http://localhost:9200/_cluster/health

i'm seeing only one node instead of two:


{

    "cluster_name": "my-application",

    "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

}

what am i doing wrong here ?

thanks

Welcome!

discovery.seed_hosts: ["127.0.0.1:9202"]

Should be

discovery.seed_hosts: ["127.0.0.1:9302"]

Same for the other node 9200 should be 9300

Then in the second node, you need to change transport.port to 9302.

Are you doing that just for a test? Or do you want to run that kind of configuration in production?

1 Like

thanks a lot David.

  • i needed this for development machine only.
  • i tried setting the discovery as suggested
discovery.seed_hosts: ["127.0.0.1:9302"]

however i saw from the log the node defaulted to 9301 (strangely, i didnt see anything in the documentation to explain how this value can be overridden through configuration).

instead of changing the configuration to

discovery.seed_hosts: ["127.0.0.1:9301"] 

i changed both configuration files to :

discovery.seed_hosts: ["127.0.0.1"] 

now i'm finally seeing:

{
    "cluster_name": "my-application",
    "status": "green",
    "timed_out": false,
    "number_of_nodes": 2,
    "number_of_data_nodes": 2,
    "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
}

Thanks a lot for putting me on the right path !

I think that transport.port helps for that.

1 Like

Thank you David
Much appreciated

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.