Deploying on EC2: cannot connect remotely to port 9300


(Alexey Danilov) #1

Hi. Not sure if this is the right forum to ask, but I'll give it a try.

I have installed ES on Amazon's EC2 instance. Set security group to allow all protocols and all ports - both inbound and outbound (for now, just to make sure this is not causing any problems) and disabled iptables on ec2 instance. I have also assigned an elastic IP (sort of static public IP address) to my instance and installed "cloud-aws" plugin.

/etc/elasticsearch/elasticsearch.yml has the following:

name: "my-node-1"
cluster.name: "my-cluster"
cloud.aws.access_key: "{aws_key}"
cloud.aws.secret_key: "{aws_secret}"
cloud.aws.region: "eu-west-1"
discovery.type: "ec2"
discovery.ec2.host_type: "public_ip"
discovery.ec2.ping_timeout: "30s"
http.cors.enabled: true
http.cors.allow-origin: "*"
http.host: "0"
network.publish_host: "{elastic_ip}"
transport.tcp.port: 9300
http.port: 9200

I can connect to my ES via HTTP to verify it is working:

both on instance:

curl -XGET localhost:9200
curl -XGET {elastic_ip}:9200

and remotely:

curl -XGET {elastic_ip}:9200

Then I tried to connect to it via Java transport client and stumbled upon "NoNodeAvailableException[None of the configured nodes are available: []]". AFAIK this client connects via 9300 port over TCP, so first I tried to verify that connection can be established.

Well, telnet to port 9300 on ec2 instance also failed:

telnet {elastic_ip} 9300
Trying {elastic_ip}...
telnet: connect to address {elastic_ip}: Connection refused
telnet: Unable to connect to remote host

At the same time, telnet to port 9200 worked fine.

After that I have logged in to instance itself and used telnet there:

telnet localhost 9200 - works fine
telnet {elastic_ip} 9200 - works fine
telnet localhost 9300 - works fine (!!!)
telnet {elastic_ip} 9300 - does not work (but it should)

output of netstat -tulpn:

tcp 0 0 :::9200 :::* LISTEN 27049/java
tcp 0 0 ::1:9300 :::* LISTEN 27049/java
tcp 0 0 ::ffff:127.0.0.1:9300 :::* LISTEN 27049/java

Any advice how to make ES accessible over 9300 port will be very welcome.


(David Pilato) #2

Can you try network.host: "{elastic_ip}" instead of network.publish_host: "{elastic_ip}"?

Note that you can also use _ec2_ or _ec2:XXX_ if you are using cloud aws plugin. See https://www.elastic.co/guide/en/elasticsearch/plugins/current/cloud-aws-discovery.html#cloud-aws-discovery-network-host


(Alexey Danilov) #3

Thanks for the suggestion - this was really the problem.


(system) #4