librelist archives

« back to archive

Two redis servers behind a haproxy

Two redis servers behind a haproxy

From:
Maurício Linhares
Date:
2010-09-21 @ 14:13
Hello guys,

I'm trying to come out with a nice and reliable resque setup and I've
been thinking about having two Redis servers running behind a haproxy
and doing a roundrobin switch between both, this would work by making
all redis calls disconnect after placing or popping the items from
redis, but before monkeypatching resque and redis to accept this
behaviour I'd like to hear from people in the trenches if this is
really a nice idea or if there are better options for my case.

What I really want is to be able to easily handle the case of a dead
Redis server without having to manually reboot anything and with the
least possible hassle for the application.

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

Re: [resque] Two redis servers behind a haproxy

From:
Rinaldi Fonseca
Date:
2010-09-21 @ 15:55
HI Maurício,


Is really necessary to do some monkeypatching for this?




Att

Rinaldi Fonseca
BS  - Computer Science
Pontifical Catholic University of Minas Gerais

Brazil


2010/9/21 Maurício Linhares <mauricio.linhares@gmail.com>

> Hello guys,
>
> I'm trying to come out with a nice and reliable resque setup and I've
> been thinking about having two Redis servers running behind a haproxy
> and doing a roundrobin switch between both, this would work by making
> all redis calls disconnect after placing or popping the items from
> redis, but before monkeypatching resque and redis to accept this
> behaviour I'd like to hear from people in the trenches if this is
> really a nice idea or if there are better options for my case.
>
> What I really want is to be able to easily handle the case of a dead
> Redis server without having to manually reboot anything and with the
> least possible hassle for the application.
>
> -
> Maurício Linhares
> http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
>

Re: [resque] Two redis servers behind a haproxy

From:
David Balatero
Date:
2010-09-21 @ 17:11
I've wanted to do this for a while as well. From my research, it seemed
worth waiting for redis-cluster...

You'd need to sync your two Redis servers with each other.

On Tue, Sep 21, 2010 at 8:55 AM, Rinaldi Fonseca
<rinaldifonseca@gmail.com>wrote:

> HI Maurício,
>
>
> Is really necessary to do some monkeypatching for this?
>
>
>
>
> Att
>
> Rinaldi Fonseca
> BS  - Computer Science
> Pontifical Catholic University of Minas Gerais
>
> Brazil
>
>
> 2010/9/21 Maurício Linhares <mauricio.linhares@gmail.com>
>
>  Hello guys,
>>
>> I'm trying to come out with a nice and reliable resque setup and I've
>> been thinking about having two Redis servers running behind a haproxy
>> and doing a roundrobin switch between both, this would work by making
>> all redis calls disconnect after placing or popping the items from
>> redis, but before monkeypatching resque and redis to accept this
>> behaviour I'd like to hear from people in the trenches if this is
>> really a nice idea or if there are better options for my case.
>>
>> What I really want is to be able to easily handle the case of a dead
>> Redis server without having to manually reboot anything and with the
>> least possible hassle for the application.
>>
>> -
>> Maurício Linhares
>> http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
>>
>
>

Re: [resque] Two redis servers behind a haproxy

From:
Maurício Linhares
Date:
2010-09-21 @ 17:24
It would be possible for me to wait a bit too but I'd rather have a
solution now for my issue (that's being sure there is at least one
redis available all the time) than wait for it right now, I'll go on
trying to get it to work.

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr



On Tue, Sep 21, 2010 at 2:11 PM, David Balatero <dbalatero@gmail.com> wrote:
> I've wanted to do this for a while as well. From my research, it seemed
> worth waiting for redis-cluster...
> You'd need to sync your two Redis servers with each other.
>
> On Tue, Sep 21, 2010 at 8:55 AM, Rinaldi Fonseca <rinaldifonseca@gmail.com>
> wrote:
>>
>> HI Maurício,
>>
>>
>> Is really necessary to do some monkeypatching for this?
>>
>>
>>
>>
>> Att
>>
>> Rinaldi Fonseca
>> BS  - Computer Science
>> Pontifical Catholic University of Minas Gerais
>>
>> Brazil
>>
>>
>> 2010/9/21 Maurício Linhares <mauricio.linhares@gmail.com>
>>>
>>> Hello guys,
>>>
>>> I'm trying to come out with a nice and reliable resque setup and I've
>>> been thinking about having two Redis servers running behind a haproxy
>>> and doing a roundrobin switch between both, this would work by making
>>> all redis calls disconnect after placing or popping the items from
>>> redis, but before monkeypatching resque and redis to accept this
>>> behaviour I'd like to hear from people in the trenches if this is
>>> really a nice idea or if there are better options for my case.
>>>
>>> What I really want is to be able to easily handle the case of a dead
>>> Redis server without having to manually reboot anything and with the
>>> least possible hassle for the application.
>>>
>>> -
>>> Maurício Linhares
>>> http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
>>
>
>

Re: [resque] Two redis servers behind a haproxy

From:
Dusty Doris
Date:
2010-09-21 @ 17:41
What if you were to set the servers up as a failover scenario instead
of round-robin?  Eg: by using the backup keyword on the failover
server.

Something like:

 server redis1 192.168.1.1:6379 check
 server redis2 192.168.1.2:6379 check backup

2010/9/21 Maurício Linhares <mauricio.linhares@gmail.com>:
> It would be possible for me to wait a bit too but I'd rather have a
> solution now for my issue (that's being sure there is at least one
> redis available all the time) than wait for it right now, I'll go on
> trying to get it to work.
>
> -
> Maurício Linhares
> http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
>
>
>
> On Tue, Sep 21, 2010 at 2:11 PM, David Balatero <dbalatero@gmail.com> wrote:
>> I've wanted to do this for a while as well. From my research, it seemed
>> worth waiting for redis-cluster...
>> You'd need to sync your two Redis servers with each other.
>>
>> On Tue, Sep 21, 2010 at 8:55 AM, Rinaldi Fonseca <rinaldifonseca@gmail.com>
>> wrote:
>>>
>>> HI Maurício,
>>>
>>>
>>> Is really necessary to do some monkeypatching for this?
>>>
>>>
>>>
>>>
>>> Att
>>>
>>> Rinaldi Fonseca
>>> BS  - Computer Science
>>> Pontifical Catholic University of Minas Gerais
>>>
>>> Brazil
>>>
>>>
>>> 2010/9/21 Maurício Linhares <mauricio.linhares@gmail.com>
>>>>
>>>> Hello guys,
>>>>
>>>> I'm trying to come out with a nice and reliable resque setup and I've
>>>> been thinking about having two Redis servers running behind a haproxy
>>>> and doing a roundrobin switch between both, this would work by making
>>>> all redis calls disconnect after placing or popping the items from
>>>> redis, but before monkeypatching resque and redis to accept this
>>>> behaviour I'd like to hear from people in the trenches if this is
>>>> really a nice idea or if there are better options for my case.
>>>>
>>>> What I really want is to be able to easily handle the case of a dead
>>>> Redis server without having to manually reboot anything and with the
>>>> least possible hassle for the application.
>>>>
>>>> -
>>>> Maurício Linhares
>>>> http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
>>>
>>
>>
>

Re: [resque] Two redis servers behind a haproxy

From:
Maurício Linhares
Date:
2010-09-21 @ 17:52
It would be just waiting doing nothing, i was thinking about putting
both to use :)

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr



On Tue, Sep 21, 2010 at 2:41 PM, Dusty Doris <dusty.doris@gmail.com> wrote:
> What if you were to set the servers up as a failover scenario instead
> of round-robin?  Eg: by using the backup keyword on the failover
> server.
>
> Something like:
>
>  server redis1 192.168.1.1:6379 check
>  server redis2 192.168.1.2:6379 check backup
>
> 2010/9/21 Maurício Linhares <mauricio.linhares@gmail.com>:
>> It would be possible for me to wait a bit too but I'd rather have a
>> solution now for my issue (that's being sure there is at least one
>> redis available all the time) than wait for it right now, I'll go on
>> trying to get it to work.
>>
>> -
>> Maurício Linhares
>> http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
>>
>>
>>
>> On Tue, Sep 21, 2010 at 2:11 PM, David Balatero <dbalatero@gmail.com> wrote:
>>> I've wanted to do this for a while as well. From my research, it seemed
>>> worth waiting for redis-cluster...
>>> You'd need to sync your two Redis servers with each other.
>>>
>>> On Tue, Sep 21, 2010 at 8:55 AM, Rinaldi Fonseca <rinaldifonseca@gmail.com>
>>> wrote:
>>>>
>>>> HI Maurício,
>>>>
>>>>
>>>> Is really necessary to do some monkeypatching for this?
>>>>
>>>>
>>>>
>>>>
>>>> Att
>>>>
>>>> Rinaldi Fonseca
>>>> BS  - Computer Science
>>>> Pontifical Catholic University of Minas Gerais
>>>>
>>>> Brazil
>>>>
>>>>
>>>> 2010/9/21 Maurício Linhares <mauricio.linhares@gmail.com>
>>>>>
>>>>> Hello guys,
>>>>>
>>>>> I'm trying to come out with a nice and reliable resque setup and I've
>>>>> been thinking about having two Redis servers running behind a haproxy
>>>>> and doing a roundrobin switch between both, this would work by making
>>>>> all redis calls disconnect after placing or popping the items from
>>>>> redis, but before monkeypatching resque and redis to accept this
>>>>> behaviour I'd like to hear from people in the trenches if this is
>>>>> really a nice idea or if there are better options for my case.
>>>>>
>>>>> What I really want is to be able to easily handle the case of a dead
>>>>> Redis server without having to manually reboot anything and with the
>>>>> least possible hassle for the application.
>>>>>
>>>>> -
>>>>> Maurício Linhares
>>>>> http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr
>>>>
>>>
>>>
>>
>

Re: [resque] Two redis servers behind a haproxy

From:
Maurício Linhares
Date:
2010-09-21 @ 17:23
Yes, in some cases resque sends two commands (one to create the queue
and the next one to add something to it), so if I close connections
between both commands one command is sent to server1 and the other to
server2, not really what I want to happen.

-
Maurício Linhares
http://codeshooter.wordpress.com/ | http://twitter.com/mauriciojr

On Tue, Sep 21, 2010 at 12:55 PM, Rinaldi Fonseca
<rinaldifonseca@gmail.com> wrote:
> HI Maurício,
>
>
> Is really necessary to do some monkeypatching for this?
>
> Att
>
> Rinaldi Fonseca
> BS  - Computer Science
> Pontifical Catholic University of Minas Gerais
>
> Brazil