Java client retrying to connect to cluster fails and breaks cluster

I have a Java client that tries to connect to a cluster on startup. I would
like to set it up
so that if the cluster is not running, the client retries the connection
(after a suitable delay), until
the cluster is started.
If I have multicast enabled, the program works. If unicast is used,
however, the client fails to connect
even after the cluster is restarted. I get:
org.elasticsearch.cluster.block.ClusterBlockException: blocked by:
[SERVICE_UNAVAILABLE/1/state not recovered /
initialized];[SERVICE_UNAVAILABLE/2/no master]

I have to restart the cluster and the client in order for the connection to
succeed.

Is there a way to make this work without enabling multicast?

_jonas

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

How are you initializing the client? Via the TransportClient or the
NodeClient. Make sure you are in client mode if using the NodeClient.

Cheers,

Ivan

On Fri, Oct 25, 2013 at 2:29 PM, Jonas K thejonas@gmail.com wrote:

I have a Java client that tries to connect to a cluster on startup. I
would like to set it up
so that if the cluster is not running, the client retries the connection
(after a suitable delay), until
the cluster is started.
If I have multicast enabled, the program works. If unicast is used,
however, the client fails to connect
even after the cluster is restarted. I get:
org.elasticsearch.cluster.block.ClusterBlockException: blocked by:
[SERVICE_UNAVAILABLE/1/state not recovered /
initialized];[SERVICE_UNAVAILABLE/2/no master]

I have to restart the cluster and the client in order for the connection
to succeed.

Is there a way to make this work without enabling multicast?

_jonas

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

On Friday, October 25, 2013 6:45:38 PM UTC-4, Ivan Brusic wrote:

How are you initializing the client? Via the TransportClient or the
NodeClient. Make sure you are in client mode if using the NodeClient.

I'm using the NodeClient with

node.master: false
node.data: false
node.client: true

and
discovery:
zen:
ping:
multicast:
enabled: false
unicast:
hosts: 127.0.0.1[9300-9400]

_jonas

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Does unicast on 127.0.0.1 really make any sense?

Jörg

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

On Saturday, October 26, 2013 3:54:28 PM UTC-4, Jörg Prante wrote:

Does unicast on 127.0.0.1 really make any sense?

I don't know - it's what we're using for development and testing on our
development machines.
What would be a better approach?

thanks,
_jonas

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You have to ensure that UDP for unicast ping is open on 127.0.0.1

I'd prefer a TransportClient connecting to 127.0.0.1:9300, that is, no UDP
for unicast ping, just TCP.

Jörg

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

On Saturday, October 26, 2013 5:56:27 PM UTC-4, Jörg Prante wrote:

I'd prefer a TransportClient connecting to 127.0.0.1:9300, that is, no
UDP for unicast ping, just TCP.

Converting to a TransportClient seems to have worked - thanks!
_jonas

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.