Thx David for the clarification, it makes sense. I (wrongfully) assumed 
that the second client would connect to 9301; similarly to my logstash 
instance that also connects to port 3901, when running on the same server 
as the elasticsearch instance.

Since I don't need Node functionality anyway, I'll stick to using 
TransportClients.

grtz, Koen

On Tuesday, June 24, 2014 2:35:25 PM UTC+2, David Pilato wrote:
>
> I see. Indeed. As soon as we are able to ping a cluster on a port, I think 
> we don't try to increase port number and try all ports within the same IP 
> address.
> If you need to set a specific address/port, you should disable multicast 
> on your client Node and provide a unicast list of nodes (with the right 
> port to use).
>
> Does it make sense?
>
> -- 
> *David Pilato* | *Technical Advocate* | *Elasticsearch.com*
> @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr 
> <https://twitter.com/elasticsearchfr>
>
>
> Le 24 juin 2014 à 13:32:17, Koen Smets ([email protected] <javascript:>) 
> a écrit:
>
> It's not the clustername. The unit test works if I force the node to use 
> another port...
>
>             Settings settings = ImmutableSettings.settingsBuilder().put("
> cluster.name", "elasticsearch")
>                     .put("network.publish_host", 
> "192.168.2.15").put("network.bind_host", "192.168.2.15")
>                     .put("transport.tcp.port", 
> 9301).put("transport.publish_port", 9301).build();
>
> But by default transport.tcp.port is range 9300-9400, but it always picks 
> both for the first and the second client always 9300.
>
> Shouldn't the port clash be discovered automatically?
>
> grtz, Koen
>
> On Tuesday, June 24, 2014 12:50:41 PM UTC+2, David Pilato wrote: 
>>
>>  But it sounds like your client is using another cluster name [1].
>>  Do you have any elasticsearch.yml in your project classpath?
>>  
>>
>>      -- 
>> *David Pilato* | *Technical Advocate* | *Elasticsearch.com* 
>>  @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr 
>> <https://twitter.com/elasticsearchfr>
>>  
>>        
>> Le 24 juin 2014 à 12:48:48, Koen Smets ([email protected]) a écrit:
>>
>>  Hi David,
>>
>> Setting the (default) clustername, elasticsearch, doesn't help.
>>
>> grtz, Koen
>>
>> On Tuesday, June 24, 2014 12:24:51 PM UTC+2, David Pilato wrote: 
>>>
>>>  You need to set the cluster name I think.
>>>  
>>>  My 2 cents
>>>  
>>>
>>>      -- 
>>> *David Pilato* | *Technical Advocate* | *Elasticsearch.com* 
>>>  @dadoonet <https://twitter.com/dadoonet> | @elasticsearchfr 
>>> <https://twitter.com/elasticsearchfr>
>>>  
>>>        
>>> Le 24 juin 2014 à 10:29:11, Koen Smets ([email protected]) a écrit:
>>>
>>>  Hi,
>>>
>>> I've troubles to connect a second client-only Node via the Java API to a 
>>> remote cluster.
>>>
>>> The first client (configured as client-only hence no master and no data) 
>>> runs fine on localhost:9300. However, when the second client-only node 
>>> tries to connect to the cluster an exception gets thrown:
>>>
>>> org.elasticsearch.cluster.block.ClusterBlockException: blocked by: 
>>> [SERVICE_UNAVAILABLE/1/state not recovered / 
>>> initialized];[SERVICE_UNAVAILABLE/2/no master];
>>>
>>> I use the following code to connect both clients:
>>>
>>>             Node node = NodeBuilder.nodeBuilder().client(true).node();
>>>             Client client = node.client();
>>>
>>>             GetResponse response = client.prepareGet("twitter", "tweet", 
>>> "1").execute().actionGet();
>>>             LOGGER.info(response.getSourceAsString());
>>>
>>>             // on shutdown
>>>             node.close();
>>>
>>> While the second client tries to join the cluster, the logs of the first 
>>> client show the following warnings:
>>>
>>> o.e.d.z.p.multicast [WARN] [Odin] received ping response 
>>> ping_response{target 
>>> [[Firebolt][DqdgEEe8RwSyVDUuqmQw4w][p2][inet[/192.168.2.21:9300]]], master 
>>> [[Firebolt][DqdgEEe8RwSyVDUuqmQw4w][p2][inet[/192.168.2.21:9300]]], 
>>> cluster_name[elasticsearch]} with no matching id [1]
>>>
>>> I assumed that the first client would be running on localhost:9300 and 
>>> the second one would bind to localhost:9301, but doesn't do that 
>>> automatically. Do I need to specify an additional setting to allow this 
>>> scenario?
>>>
>>> (I also tested by adding a TransportClient instead of a Node and this 
>>> works fine)
>>>
>>> JUnit test code and log output can be found at: 
>>> https://gist.github.com/ksmets/bed93778562dd2260e09
>>>
>>> Thx, Koen
>>> --
>>> You received this message because you are subscribed to the Google 
>>> Groups "elasticsearch" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/elasticsearch/868dc883-dd39-44ac-ab56-1ac609f1f63f%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/elasticsearch/868dc883-dd39-44ac-ab56-1ac609f1f63f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>  
>>>  --
>> You received this message because you are subscribed to the Google Groups 
>> "elasticsearch" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/43ed69ab-83e8-4128-8450-bcb94fc93852%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/43ed69ab-83e8-4128-8450-bcb94fc93852%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>  
>>   --
> You received this message because you are subscribed to the Google Groups 
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/ac506781-daf9-4255-ac4c-09ac1b833d4a%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/elasticsearch/ac506781-daf9-4255-ac4c-09ac1b833d4a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a3a05428-c8a5-4d69-9f3b-49f3808c1768%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to