Connect to EC2 cluster from other security groups

I've created a cluster with 2 EC2 instances on amazon and set the security group as search-cluster and they are works fine. Then I start another instance which is in security group web-server. Both security groups have port 9200 and 9300 opened.

In this web server i have a web app which contains such code:

Builder settings = ImmutableSettings.settingsBuilder();
settings.put("discovery.type", "ec2");
settings.put("cloud.aws.access_key", "my access key");
settings.put("cloud.aws.secret_key", "my security key");
settings.put("discovery.ec2.groups", "search-cluster");
Node node = nodeBuilder().settings(settings).clusterName("my cluster name").client(true).node();
client = node.client();

Then I got such error when I index a record into the elasticsearch:
org.elasticsearch.discovery.MasterNotDiscoveredException:
org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:162)
org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:332)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:636)

Can anyone tell me what can I do to deal with the problem? Thanks
The elasticsearch is version 0.18.7 and java 1.6

Bruce Zhou

Can you set the discovery (or if you are running embedded, org.elasticsearch.discovery) logging to the highest possible (TRACE) and see what nodes the ec2 discovery uses, and which it can connect to...

On Thursday, February 9, 2012 at 10:37 AM, Ye Zhou wrote:

I've created a cluster with 2 EC2 instances on amazon and set the security group as search-cluster and they are works fine. Then I start another instance which is in security group web-server. Both security groups have port 9200 and 9300 opened.

In this web server i have a web app which contains such code:

Builder settings = ImmutableSettings.settingsBuilder();
settings.put("discovery.type", "ec2");
settings.put("cloud.aws.access_key", "my access key");
settings.put("cloud.aws.secret_key", "my security key");
settings.put("discovery.ec2.groups", "search-cluster");
Node node = nodeBuilder().settings(settings).clusterName("my cluster name").client(true).node();
client = node.client();

Then I got such error when I index a record into the elasticsearch:
org.elasticsearch.discovery.MasterNotDiscoveredException:
org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:162)
org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:332)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:636)

Can anyone tell me what can I do to deal with the problem? Thanks
The elasticsearch is version 0.18.7 and java 1.6

Bruce Zhou

Thanks, I've got it solved. The region should be set because my instance is running in us-west.

On 2012/02/12, at 18:59 , Shay Banon wrote:

Can you set the discovery (or if you are running embedded, org.elasticsearch.discovery) logging to the highest possible (TRACE) and see what nodes the ec2 discovery uses, and which it can connect to...
On Thursday, February 9, 2012 at 10:37 AM, Ye Zhou wrote:

I've created a cluster with 2 EC2 instances on amazon and set the security group as search-cluster and they are works fine. Then I start another instance which is in security group web-server. Both security groups have port 9200 and 9300 opened.

In this web server i have a web app which contains such code:

Builder settings = ImmutableSettings.settingsBuilder();
settings.put("discovery.type", "ec2");
settings.put("cloud.aws.access_key", "my access key");
settings.put("cloud.aws.secret_key", "my security key");
settings.put("discovery.ec2.groups", "search-cluster");
Node node = nodeBuilder().settings(settings).clusterName("my cluster name").client(true).node();
client = node.client();

Then I got such error when I index a record into the elasticsearch:
org.elasticsearch.discovery.MasterNotDiscoveredException:
org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:162)
org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:332)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:636)

Can anyone tell me what can I do to deal with the problem? Thanks
The elasticsearch is version 0.18.7 and java 1.6

Bruce Zhou