You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "edreyer@ha" <ed...@homeaway.com> on 2009/01/22 23:27:19 UTC

Master failover - seeking comments

Hi,

We're looking forward to using Solr in a project.  We're using a typical
setup with one Master and a handful of Slaves.  We're using the Master for
writes and the Slaves for reads.  Standard stuff.

Our concern is with downtime of the Master server.  I read a few posts that
touched on this topic but didn't find anything substantive.  I've got a test
setup in place that appears to work, but I'd like to get some feedback.

Essentially, the plan is to add another Master server, so now we have M1 and
M2.  Both M1 and M2 are also configured to be slaves of each other.  The
plan is to put a load balancer in between the Slaves and the Master servers. 
This way, if M1 goes down, traffic will be routed to M2 automatically.  Once
M1 comes back online, we'll route traffic back to that server.  Because M1
and M2 are replicating each other all updates are captured.

To test this, I ran the following scenario.

1) Slave 1 (S1) is configured to use M2 as it's master.
2) We push an update to M2.
3) We restart S1, now pointing to M1.
4) We wait for M1 to sync from M2
5) We then sync S1 to M1.  
6) Success!

However...

M1 and M2 generate snapshots every time they sync to each other, even if no
new data was pushed to them from a Slave.  We're concerned about this.   

Is this even a problem?  
Are we stuck in some infinte sync loop between the 2 Master machines?  
Will this degrade performance of the Master machines over time?  
Is there anything else I should know about this setup?

Any insights, or alternative suggestions to this setup are quite welcome.

Thanks,
Erik
 
-- 
View this message in context: http://www.nabble.com/Master-failover---seeking-comments-tp21614750p21614750.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Master failover - seeking comments

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
Did you look at the new in-built replication?
http://wiki.apache.org/solr/SolrReplication#head-0e25211b6ef50373fcc2f9a6ad40380c169a5397

It can help you decide where to replicate from during runtime . Look
at the snappull command you can pass the masterUrl at the time of
replication.



On Fri, Jan 23, 2009 at 7:55 PM, edreyer@ha <ed...@homeaway.com> wrote:
>
> Thanks for the response. Let me clarify things a bit.
>
> Regarding the Slaves:
> Our project is a web application. It is our desire to embedd Solr into the
> web application.   The web applications are configured with a local embedded
> Solr instance configured as a slave, and a remote Solr instance configured
> as a master.
>
> We have a requirement for real-time updates to the Solr indexes.  Our
> strategy is to use the local embedded Solr instance as a read-only
> repository.  Any time a write is made, we will send it to the remote Master.
> Once a user pushes a write operation to the remote Master, all subsequent
> read operations for this user now are made against the Master for the
> duration of the session.  This approximates "realtime" updates and seems to
> work for our purposes.  Writes to our system are a small percentage of Read
> operations.
>
> Now, back to the original question.  We're simply looking for failover
> solution if the Master server goes down.  Oh, and we are using the
> replication scripts to sync the servers.
>
>
>
>> It seems like you are trying to write to Solr directly from your front end
>> application. This is why you are thinking of multiple masters. I'll let
>> others comment on how easy/hard/correct the solution would be.
>>
>
> Well, yes.  We have business requirements that want updates to Solr to be
> realtime, or as close to that as possible, so when a user changes something,
> our strategy was to save it to the DB and push it to the Solr Master as
> well.  Although, we will have a background application that will help ensure
> that Solr is in sync with the DB for times that Solr is down and the DB is
> not.
>
>
>
>> But, do you really need to have live writes? Can they be channeled through
>> a
>> background process? Since you anyway cannot do a commit per-write, the
>> advantage of live writes is minimal. Moreover you would need to invest a
>> lot
>> of time in handling availability concerns to avoid losing updates. If you
>> log/record the write requests to an intermediate store (or queue), you can
>> do with one master (with another host on standby acting as a slave).
>>
>
> We do need to have live writes, as I mentioned above.  The concern you
> mention about losing live writes is exactly why we are looking at a Master
> Solr server failover strategy.  We thought about having a backup Solr server
> that is a Slave to the Master and could be easily reconfigured as a new
> Master in a pinch.  Our operations team has pushed us to come up with a
> solution that would be more seamless.  This is why we came up with a
> Master/Master solution where both Masters are also slaves to each other.
>
>
>
>>>
>>> To test this, I ran the following scenario.
>>>
>>> 1) Slave 1 (S1) is configured to use M2 as it's master.
>>> 2) We push an update to M2.
>>> 3) We restart S1, now pointing to M1.
>>> 4) We wait for M1 to sync from M2
>>> 5) We then sync S1 to M1.
>>> 6) Success!
>>>
>>
>> How do you co-ordinate all this?
>>
>
> This was just a test scenario I ran manually to see if the setup I described
> above would even work.
>
> Is there a Wiki page that outlines typical web application Solr deployment
> strategies?  There are a lot of questions on the forum about this type of
> thing (including this one).  For those who have expertise in this area, I'm
> sure there are many who could benefit from this (hint hint).
>
> As before, any comments or suggestions on the above would be much
> appreciated.
>
> Thanks,
> Erik
> --
> View this message in context: http://www.nabble.com/Master-failover---seeking-comments-tp21614750p21625324.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
--Noble Paul

Re: Master failover - seeking comments

Posted by "edreyer@ha" <ed...@homeaway.com>.
Thanks for the response. Let me clarify things a bit.

Regarding the Slaves:
Our project is a web application. It is our desire to embedd Solr into the
web application.   The web applications are configured with a local embedded
Solr instance configured as a slave, and a remote Solr instance configured
as a master.

We have a requirement for real-time updates to the Solr indexes.  Our
strategy is to use the local embedded Solr instance as a read-only
repository.  Any time a write is made, we will send it to the remote Master. 
Once a user pushes a write operation to the remote Master, all subsequent
read operations for this user now are made against the Master for the
duration of the session.  This approximates "realtime" updates and seems to
work for our purposes.  Writes to our system are a small percentage of Read
operations.

Now, back to the original question.  We're simply looking for failover
solution if the Master server goes down.  Oh, and we are using the
replication scripts to sync the servers.



> It seems like you are trying to write to Solr directly from your front end
> application. This is why you are thinking of multiple masters. I'll let
> others comment on how easy/hard/correct the solution would be. 
> 

Well, yes.  We have business requirements that want updates to Solr to be
realtime, or as close to that as possible, so when a user changes something,
our strategy was to save it to the DB and push it to the Solr Master as
well.  Although, we will have a background application that will help ensure
that Solr is in sync with the DB for times that Solr is down and the DB is
not.



> But, do you really need to have live writes? Can they be channeled through
> a
> background process? Since you anyway cannot do a commit per-write, the
> advantage of live writes is minimal. Moreover you would need to invest a
> lot
> of time in handling availability concerns to avoid losing updates. If you
> log/record the write requests to an intermediate store (or queue), you can
> do with one master (with another host on standby acting as a slave).
> 

We do need to have live writes, as I mentioned above.  The concern you
mention about losing live writes is exactly why we are looking at a Master
Solr server failover strategy.  We thought about having a backup Solr server
that is a Slave to the Master and could be easily reconfigured as a new
Master in a pinch.  Our operations team has pushed us to come up with a
solution that would be more seamless.  This is why we came up with a
Master/Master solution where both Masters are also slaves to each other.



>>
>> To test this, I ran the following scenario.
>>
>> 1) Slave 1 (S1) is configured to use M2 as it's master.
>> 2) We push an update to M2.
>> 3) We restart S1, now pointing to M1.
>> 4) We wait for M1 to sync from M2
>> 5) We then sync S1 to M1.
>> 6) Success!
>>
> 
> How do you co-ordinate all this?
> 

This was just a test scenario I ran manually to see if the setup I described
above would even work.  

Is there a Wiki page that outlines typical web application Solr deployment
strategies?  There are a lot of questions on the forum about this type of
thing (including this one).  For those who have expertise in this area, I'm
sure there are many who could benefit from this (hint hint).

As before, any comments or suggestions on the above would be much
appreciated.

Thanks,
Erik
-- 
View this message in context: http://www.nabble.com/Master-failover---seeking-comments-tp21614750p21625324.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Master failover - seeking comments

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Fri, Jan 23, 2009 at 3:57 AM, edreyer@ha <ed...@homeaway.com> wrote:

>
> Essentially, the plan is to add another Master server, so now we have M1
> and
> M2.  Both M1 and M2 are also configured to be slaves of each other.  The
> plan is to put a load balancer in between the Slaves and the Master
> servers.


What exactly do you mean by that? The slaves never write to the master, do
they?


>
> This way, if M1 goes down, traffic will be routed to M2 automatically.
>  Once
> M1 comes back online, we'll route traffic back to that server.  Because M1
> and M2 are replicating each other all updates are captured.


>
> To test this, I ran the following scenario.
>
> 1) Slave 1 (S1) is configured to use M2 as it's master.
> 2) We push an update to M2.
> 3) We restart S1, now pointing to M1.
> 4) We wait for M1 to sync from M2
> 5) We then sync S1 to M1.
> 6) Success!
>

How do you co-ordinate all this?


>
> However...
>
> M1 and M2 generate snapshots every time they sync to each other, even if no
> new data was pushed to them from a Slave.  We're concerned about this.
>

Are you using rsync based replication? The Java based replication does not
create snapshots, however it is in 1.4 trunk only.


>
> Is this even a problem?
> Are we stuck in some infinte sync loop between the 2 Master machines?
> Will this degrade performance of the Master machines over time?
> Is there anything else I should know about this setup?
>
> Any insights, or alternative suggestions to this setup are quite welcome.
>

It seems like you are trying to write to Solr directly from your front end
application. This is why you are thinking of multiple masters. I'll let
others comment on how easy/hard/correct the solution would be.

But, do you really need to have live writes? Can they be channeled through a
background process? Since you anyway cannot do a commit per-write, the
advantage of live writes is minimal. Moreover you would need to invest a lot
of time in handling availability concerns to avoid losing updates. If you
log/record the write requests to an intermediate store (or queue), you can
do with one master (with another host on standby acting as a slave). The
switching between the boxes for writes can be done manually. I know it is
more manual work but a simpler design and we know it works :)

-- 
Regards,
Shalin Shekhar Mangar.