0

I have setup a SSH tunnel on port 9300 to my remote elasticsearch server.

When running this basic example to get the example data from the elasticsearch instance I get a "org.elasticsearch.client.transport.NoNodeAvailableException: No node available"

Settings settings = ImmutableSettings.settingsBuilder()
            .build();

    Client client = new TransportClient(settings).addTransportAddress(
            new InetSocketTransportAddress(InetAddress.getLocalHost().getHostName(), 9300));


    GetResponse getResponse = client.prepareGet("bank", "account", "25").execute().actionGet();
elhombre
  • 2,839
  • 7
  • 28
  • 28
  • What is the local port of your SSH tunnel? Also 9300? What version of ES are you running? How have you configured `network.host` in your `elasticsearch.yml` config file? – Val Jul 18 '16 at 09:52
  • @Val local port of SSH tunnel is `9300`, ES version is `elasticsearch-2.3.3-1.noarch` default installation, which makes the `network.host localhost` – elhombre Jul 18 '16 at 09:55
  • Then try `"localhost"` instead of `InetAddress.getLocalHost().getHostName()` – Val Jul 18 '16 at 09:56
  • I already tried this and get the error `failed to get node info for [#transport#-1][inet[localhost/127.0.0.1:9300]], disconnecting...` – elhombre Jul 18 '16 at 09:58
  • 1
    did you check server log? – Vladislav Kysliy Jul 18 '16 at 10:53
  • @VladislavKysliy Good suggestion, it seems nothing is showing up in the logs, maybe there is something wrong with how I am connecting? – elhombre Jul 18 '16 at 11:24
  • it could be, probably you should check it via 9200 and curl – Vladislav Kysliy Jul 18 '16 at 11:27

1 Answers1

0

my setup is that i connect from my localhost to a remote machine where elasticsearch is running in a docker-container and i got the same problem on port 9300 using transportclient with netty4. connecting to the tunneled port 9200 was no problem

transport.publish_host: localhost

has fixed it

so my es.yml has now:

http.host: 0.0.0.0
transport.host: 172.18.0.33
transport.publish_host: localhost

and i do the tunnel via:

ssh -N -L 9300:172.18.0.33:9300 user@server.com
davey
  • 1,666
  • 17
  • 24