When a master node goes down, how the client query works?

This is a newbie question about how the cluster works. I try to find the
answer from the group, but seems not exact the same question I have.
By reading the guide from elasticsearch.com, I understand when a master
node goes down, a new master node will be elected automatically. However, a
client does not know that and he still tries to query the old master node.
I was wondering what the result will be.

Assume I already have data indexed into 5 nodes, n1 to n5, where n1 is the
original master node. so when the client queries, the client do something
like: curl -XPOST "http://n1:9200/movies/movie/_search?q=*:Godfather",
life is good so far.

When n1 node goes down, assume n2 becomes the new master node. Since the
client does no know n1 is down, he still submits the same query to n1, what
result will be returned?

Should a client query the cluster instead of querying a master node? How to
submit a query to the cluster?

Thanks a lot in advance!

Aaron

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7b963b8c-625d-48eb-a75e-05a8ee4b53b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Two options

  1. Have a client instance of elasticsearch on a different server or on the
    same server that does the query. That node must be set to master=false and
    data=false. Being a member of the cluster means you know where the data is.
  2. Use a http reverse proxy that connects to all the nodes in the cluster,
    if http 9200 is unavailable on one node then traffic is sent to the other
    nodes.

Best option is to combine the two. Have two elasticsearch nodes as client
members of the cluster, install a reverse proxy on those two and
loadbalance between them on the IP level with a solution of choice.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7e0c1382-399f-4a0b-ba77-59fa64c9ac2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

With Java client, you have not to worry about that. You have either
multiple node connections or explicitly chosen the nodes to connect to
(transport client).

With HTTP client, the official Elasticsearch clients provide methods to
connect to multiple hosts. If one host goes down, the next one is chosen.

Jörg

On Wed, Dec 3, 2014 at 5:50 PM, Aaron apptry.aaron@gmail.com wrote:

This is a newbie question about how the cluster works. I try to find the
answer from the group, but seems not exact the same question I have.
By reading the guide from elasticsearch.com, I understand when a master
node goes down, a new master node will be elected automatically. However, a
client does not know that and he still tries to query the old master node.
I was wondering what the result will be.

Assume I already have data indexed into 5 nodes, n1 to n5, where n1 is the
original master node. so when the client queries, the client do something
like: curl -XPOST "http://n1:9200/movies/movie/_search?q=*:Godfather",
life is good so far.

When n1 node goes down, assume n2 becomes the new master node. Since the
client does no know n1 is down, he still submits the same query to n1, what
result will be returned?

Should a client query the cluster instead of querying a master node? How
to submit a query to the cluster?

Thanks a lot in advance!

Aaron

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/7b963b8c-625d-48eb-a75e-05a8ee4b53b3%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7b963b8c-625d-48eb-a75e-05a8ee4b53b3%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoG3%2BJTkk7CaHKRqV%2BtSpUzshRC0Fv5y3dLPn%3DLr1Lq8hA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Thank you both Elvar and Jorg for your replies.

Aaron

On Thursday, December 4, 2014 7:58:07 AM UTC-5, Elvar Böðvarsson wrote:

Two options

  1. Have a client instance of elasticsearch on a different server or on the
    same server that does the query. That node must be set to master=false and
    data=false. Being a member of the cluster means you know where the data is.
  2. Use a http reverse proxy that connects to all the nodes in the cluster,
    if http 9200 is unavailable on one node then traffic is sent to the other
    nodes.

Best option is to combine the two. Have two elasticsearch nodes as client
members of the cluster, install a reverse proxy on those two and
loadbalance between them on the IP level with a solution of choice.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a50ae28e-34c4-4369-a043-6cda5bf30fd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.