How to stop a new slave from serving request until it has replicated index the first time.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to stop a new slave from serving request until it has replicated index the first time.

Pushkar Raste
Hi,
In the master/slave setup, as soon as I start a new slave it starts to
serve request. Often the searches result in no documents being found as
index has not been replicated yet. Is there a way to stop replica from
serving request (marking node unhealthy) until the index is replicated for
the first time.
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a new slave from serving request until it has replicated index the first time.

Shawn Heisey-2
On 2/6/2019 9:13 AM, Pushkar Raste wrote:
> In the master/slave setup, as soon as I start a new slave it starts to
> serve request. Often the searches result in no documents being found as
> index has not been replicated yet. Is there a way to stop replica from
> serving request (marking node unhealthy) until the index is replicated for
> the first time.

There's probably not a way that's built into Solr.  Perhaps there should
be, but it would have to be implemented, and that might take a release
or two.

But there is a ping request handler, and if your load balancer is using
that to determine server health, you can have the core start up with the
ping health check disabled, and then manually enable it when once it's
really ready.

Thanks,
Shawn
Reply | Threaded
Open this post in threaded view
|

Re: How to stop a new slave from serving request until it has replicated index the first time.

Erick Erickson
Unless you have a specific reason to use master/slave, SolrCloud
(in this case only one shard probably) will make this kind of
thing easier. This is the equivalent of ADDREPLICA. Also,
the TLOG and PULL replica types (as of Solr 7) are something of
a hybrid of master/slave and SolrCloud.

FWIW,
Erick

On Wed, Feb 6, 2019 at 10:28 AM Shawn Heisey <[hidden email]> wrote:

>
> On 2/6/2019 9:13 AM, Pushkar Raste wrote:
> > In the master/slave setup, as soon as I start a new slave it starts to
> > serve request. Often the searches result in no documents being found as
> > index has not been replicated yet. Is there a way to stop replica from
> > serving request (marking node unhealthy) until the index is replicated for
> > the first time.
>
> There's probably not a way that's built into Solr.  Perhaps there should
> be, but it would have to be implemented, and that might take a release
> or two.
>
> But there is a ping request handler, and if your load balancer is using
> that to determine server health, you can have the core start up with the
> ping health check disabled, and then manually enable it when once it's
> really ready.
>
> Thanks,
> Shawn