elastic / elasticsearch-cloud-aws

AWS Cloud Plugin for Elasticsearch
https://github.com/elastic/elasticsearch/tree/master/plugins/discovery-ec2
577 stars 181 forks source link

Issue Connecting to Cluster w/ Client API (Java) #207

Closed threejeez closed 9 years ago

threejeez commented 9 years ago

I have a cluster running on AWS using this plugin... from the cluster standpoint, everything seems fine. However, when I try to use the client api to connect to the cluster to do bulk indexing, my app can't connect. When looking at the logs, it seems that the client API is using the private ip instead of a public one.

Here's the log output from my client app:

2015-05-07 15:47:53 DEBUG transport:168 - [Hazard] adding address [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 DEBUG transport:168 - [Hazard] adding address [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 DEBUG transport:168 - [Hazard] adding address [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 TRACE transport:412 - [Hazard] connecting to listed node (light) [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 TRACE transport:412 - [Hazard] connecting to listed node (light) [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 TRACE transport:412 - [Hazard] connecting to listed node (light) [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 DEBUG netty:741 - [Hazard] connected to node [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 DEBUG netty:741 - [Hazard] connected to node [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 TRACE breaker:182 - [Hazard] [REQUEST] Adjusted breaker by [16440] bytes, now [16440]
2015-05-07 15:47:53 TRACE breaker:182 - [Hazard] [REQUEST] Adjusted breaker by [16440] bytes, now [16440]
2015-05-07 15:47:53 TRACE tracer:501 - [Hazard] [0][cluster:monitor/state] sent to [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]] (timeout: [5s])
2015-05-07 15:47:53 TRACE tracer:501 - [Hazard] [0][cluster:monitor/state] sent to [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]] (timeout: [5s])
2015-05-07 15:47:53 TRACE breaker:182 - [Hazard] [REQUEST] Adjusted breaker by [-16440] bytes, now [0]
2015-05-07 15:47:53 TRACE breaker:182 - [Hazard] [REQUEST] Adjusted breaker by [-16440] bytes, now [0]
2015-05-07 15:47:53 TRACE tracer:493 - [Hazard] [0][cluster:monitor/state] received response from [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 TRACE tracer:493 - [Hazard] [0][cluster:monitor/state] received response from [[#transport#-1][Greggs-MacBook-Pro.local][inet[/52.6.207.58:9300]]]
2015-05-07 15:47:53 TRACE transport:304 - [Hazard] connecting to node [[Molly Hayes][siCuUqrrQGeh1REN23HJyw][ip-172-31-13-223][inet[/172.31.13.223:9300]]]
2015-05-07 15:47:53 TRACE transport:304 - [Hazard] connecting to node [[Molly Hayes][siCuUqrrQGeh1REN23HJyw][ip-172-31-13-223][inet[/172.31.13.223:9300]]]
2015-05-07 15:47:53 TRACE transport:304 - [Hazard] connecting to node [[Molly Hayes][siCuUqrrQGeh1REN23HJyw][ip-172-31-13-223][inet[/172.31.13.223:9300]]]
2015-05-07 15:48:24 TRACE netty:599 - [Hazard] connect exception caught on transport layer [[id: 0xcd5454c8]]
org.elasticsearch.common.netty.channel.ConnectTimeoutException: connection timed out: /172.31.13.223:9300

52.6.207.58 is the public IP, but it's trying to connect to 172.31.13.223, which is the private IP.

elasticsearch.yml

discovery.type: "ec2"
discovery.ec2.groups: "ElasticSearch-Security-Group"
discovery.ec2.host_type: "private_ip"
discovery.ec2.ping_timeout: "30s"
discovery.ec2.availability_zones: "us-east-1a,us-east-1b,us-east-1c,us-east-1d,us-east-1e"
cloud.aws.region: "us-east-1"
discovery.zen.ping.multicast.enabled: false

I've tried changing the host_type parameter to "public_ip", but no luck. Any pointers on how to get my client to connect to the ec2 instance's public ip??