Private
Private

Reputation: 1771

How can i connect to my elasticsearch cluster from another machine?

I want to connect my elasticsearch cluster from another machine i went through some documentation where they had mentioned that i had change the network.bind_host : 0 .But i didn't find the network.bind_host in my elasticsearch.yml . I got only network.host in my elasticsearch.yml file.Even i tried it by giving as network.host :0 but i cant able to connect from another machine. And i also tried removing ## before network.host :0 which throws an error when starting elasticsearch cluster.

When i am connecting from another machine i have to give http://clustermachingip:9200 right? Can anyone please help on this problem?

Thanks..

Upvotes: 2

Views: 1431

Answers (2)

NutcaseDeveloper
NutcaseDeveloper

Reputation: 191

Set your network.host in elasticsearch.yml to 0.0.0.0 i.e. it will listen on all available bound addresses.

network.host: 0.0.0.0

Check your connectivity to the host machine on the port (in case you haven't changed the port it will be 9200).

In case you are not able to connect to the host machine still, I will suggest checking your iptables and allow connections to port 9200.

Upvotes: 2

Rajind Ruparathna
Rajind Ruparathna

Reputation: 2255

When you want to connect to an elasticsearch instance of an another machine, yes the address is http://clustermachingip:9200. Can you try setting network.bind_host: clustermachingip

If this doesn't work then you might want to check the connectivity to the machine you are trying to connect to using something like a ping command.

ping clustermachingip

EDIT:

You can just start elasticsearch in one machine and try one of the following curl commands from the other machine.

curl 'clustermachingip:9200/_cat/nodes?v'
curl 'clustermachingip:9200/_cat/health?v'

EDIT2: Clearing out confusion between network.host, network.bind_host

https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-network.html#advanced-network-settings

The network.host setting explained in Commonly used network settings is a shortcut which sets the bind host and the publish host at the same time. In advanced used cases, such as when running behind a proxy server, you may need to set these settings to different values:

network.bind_host This specifies which network interface(s) a node should bind to in order to listen for incoming requests. A node can bind to multiple interfaces, e.g. two network cards, or a site-local address and a local address. Defaults to network.host. network.publish_host The publish host is the single interface that the node advertises to other nodes in the cluster, so that those nodes can connect to it. Currently an elasticsearch node may be bound to multiple addresses, but only publishes one. If not specified, this defaults to the “best” address from network.host, sorted by IPv4/IPv6 stack preference, then by reachability.

Upvotes: 1

Related Questions