After changing port I cannot start another Node on the same Machine?

Hi Experts,

My requirement is to change the default ES port 9200 to 1000. I changed it in elasticsearch.yml under "http.port: 1000". Now when I start another node on the same machine I got an error

  • BindHttpException[Failed to bind to [1000]]
    ChannelException[Failed to bind to: 0.0.0.0/0.0.0.0:
    BindException[Address already in use: bind]

Right now I am just doing the things for testing so I am doing it on single machine . Please suggest how I can achieve this as my cluster is in yellow and to turn it to green i have to run another node on this machine .

Thanks
VG

You should be able to start the second node with the following:

$ bin/elasticsearch -Des.http.port=<ANOTHER_PORT>

Where <ANOTHER_PORT> is the port you want the second node to use

HTH

1 Like

Thanks Colings86,

This works , but Please help me to understand . If I do not change http port in ES.yml file then how I can start multiple nodes without any problem ?

The default settings for http.port uses the range 9200 to 9299. On start up the node will try to bind to port 9200 but if it is use it will try 9201, then 9202 and so in until it either successfully bind to a port or it reaches 9299 and fails. If you specify an explicit port in elasticsearch.yml like http.port: 1000 then you are asking elasticsearch to bind to only that port and if the port is in use it will fail and will not try other ports. You can emulate the same range behaviour for your ports by setting:

http.port: 1000-1050

This will try port 1000 first and then 1001, 1002, etc up to but not including port 1050.

HTH

1 Like

Wow!! to the point

Thank you So much , i understood the concept now.