Can't get Java client to join cloud-aws cluster


(Eric Jain) #1

I have an elasticsearch instance running on an EC2 machine with the
following elasticsearch.yml:

cluster.name: test

plugin.mandatory: cloud-aws

cloud:
aws:
access_key: xxxxxxxxxxxx
secret_key: xxxxxxxxxxxx
region: us-east-1

discovery:
type: ec2

The instance seems to be fine; curl localhost:9200/_cluster/health? pretty=true returns:

{
"cluster_name" : "test",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0
}

Here's how I try to connect to the cluster from my application:

ImmutableSettings.Builder settings =
ImmutableSettings.settingsBuilder()
.put("cloud.aws.access_key", "xxxxxxxxxxxx")
.put("cloud.aws.secret_key", "xxxxxxxxxxxx")
.put("cloud.aws.region", "us-east-1")
.put("discovery.type", "ec2");

return NodeBuilder.nodeBuilder()
.clusterName("test")
.client(true).local(false)
.settings(settings.build()).node();

But I get the following error after 30s--even when running on the same
machine:

[warn] o.e.discovery - [Venomm] waited for 30s and no initial state
was set by the discovery

Any ideas what I'm missing?


(David Pilato) #2

Did you open 9300 port on your EC2 instance ?

David

Le 22 mai 2012 à 04:06, Eric Jain eric.jain@gmail.com a écrit :

I have an elasticsearch instance running on an EC2 machine with the
following elasticsearch.yml:

cluster.name: test

plugin.mandatory: cloud-aws

cloud:
aws:
access_key: xxxxxxxxxxxx
secret_key: xxxxxxxxxxxx
region: us-east-1

discovery:
type: ec2

The instance seems to be fine; curl localhost:9200/_cluster/health? pretty=true returns:

{
"cluster_name" : "test",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0
}

Here's how I try to connect to the cluster from my application:

ImmutableSettings.Builder settings =
ImmutableSettings.settingsBuilder()
.put("cloud.aws.access_key", "xxxxxxxxxxxx")
.put("cloud.aws.secret_key", "xxxxxxxxxxxx")
.put("cloud.aws.region", "us-east-1")
.put("discovery.type", "ec2");

return NodeBuilder.nodeBuilder()
.clusterName("test")
.client(true).local(false)
.settings(settings.build()).node();

But I get the following error after 30s--even when running on the same
machine:

[warn] o.e.discovery - [Venomm] waited for 30s and no initial state
was set by the discovery

Any ideas what I'm missing?


(Eric Jain) #3

On Mon, May 21, 2012 at 9:59 PM, David Pilato david@pilato.fr wrote:

Did you open 9300 port on your EC2 instance ?

Thanks, that was indeed the issue. Hadn't thought I'd need to open any
ports to make this work on a single machine...

btw I had to open ports 9300-9400 within the ec2 security group to
avoid subsequent errors; couldn't find any mention of this in the docs
or in http://www.elasticsearch.org/tutorials/2011/08/22/elasticsearch-on-ec2.html


(Shay Banon) #4

Opening just 9300 is enough, unless you run more than one ES instance on
that node (in which case the additional nodes will start ot use port 9301,
9302, and so on).

On Tue, May 22, 2012 at 8:47 AM, Eric Jain eric.jain@gmail.com wrote:

On Mon, May 21, 2012 at 9:59 PM, David Pilato david@pilato.fr wrote:

Did you open 9300 port on your EC2 instance ?

Thanks, that was indeed the issue. Hadn't thought I'd need to open any
ports to make this work on a single machine...

btw I had to open ports 9300-9400 within the ec2 security group to
avoid subsequent errors; couldn't find any mention of this in the docs
or in
http://www.elasticsearch.org/tutorials/2011/08/22/elasticsearch-on-ec2.html


(Eric Jain) #5

On Wed, May 23, 2012 at 3:51 PM, Shay Banon kimchy@gmail.com wrote:

Opening just 9300 is enough, unless you run more than one ES instance on
that node (in which case the additional nodes will start ot use port 9301,
9302, and so on).

I was running a single elasticsearch standalone instance per machine +
a Java application that creates a Node with client(true).


(Shay Banon) #6

A node client also opens a transport channel...

On Thu, May 24, 2012 at 2:37 AM, Eric Jain eric.jain@gmail.com wrote:

On Wed, May 23, 2012 at 3:51 PM, Shay Banon kimchy@gmail.com wrote:

Opening just 9300 is enough, unless you run more than one ES instance on
that node (in which case the additional nodes will start ot use port
9301,
9302, and so on).

I was running a single elasticsearch standalone instance per machine +
a Java application that creates a Node with client(true).


(system) #7