This did not work either. I've removed the haproxy setup and simply put a
floating vip between the rabbitmq servers. However if I fail the vip to another
rabbit server the connection is dropped. I've tried placing an
unsubscribe/resubscribe in a timer route and have activated the keep alive
modparam, but that is not working. It would be great if there were some sort of
multi entrance or auto-resubscribe function. As it stands right now after
testing with haproxy and with a vip the only thing that works is to restart
opensips if a rabbit node goes down.
loadmodule "event_rabbitmq.so"
modparam("event_rabbitmq", "heartbeat", 3)
startup_route{
if (!subscribe_event("E_KEEPALIVE",
"rabbitmq:user:[email protected]/keepalive")) {
xlog("L_INFO", "Can't connect to RabbitMQ E_KEEPALIVE\n");
}
}
timer_route[event_keepalive, 5] {
subscribe_event("E_KEEPALIVE",
"rabbitmq:user:[email protected]/keepalive",0); # I was told this would
unsubscribe
# This does not work
if (!subscribe_event("E_KEEPALIVE",
"rabbitmq:user:[email protected]/keepalive")) {
xlog("L_INFO", "Can't connect to RabbitMQ E_KEEPALIVE\n");
}
$json(rabbit_keepalive) := "{}";
$json(rabbit_keepalive/time) = $time(%Y-%m-%d %T %Z);
$json(rabbit_keepalive/type) = "KEEPALIVE";
$avp(rabbit_keepalive) := $json(rabbit_keepalive);
if (!raise_event("E_KEEPALIVE", $avp(rabbit_keepalive))) {
xlog("L_INFO", "Can't raise E_KEEPALIVE event\n");
}
}
On Wednesday, June 11, 2014 1:08 PM, Kneeoh <[email protected]> wrote:
Is there an unsubscribe option? I'm going to try removing haproxy and just let
the vip be shared among the rabbit cluster nodes and see if that tricks it.
On Tuesday, June 10, 2014 9:01 AM, Răzvan Crainea <[email protected]> wrote:
Hi, Kneeoh!
I think that the only solution that would work properly was your first
approach. However, since this is not yet implemented, all I can think of
is an external process that periodically test if the node is up. If it
is not, unsubscribe it and re-subscribe the second node.
PS: I haven't really used haproxy so I have no idea how it works.
Best regards,
Razvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com
On 06/06/2014 06:15 PM, Kneeoh wrote:
> Hi Razvan, thank you for the reply. I don't necessarily need expiration of
> subscriptions to rabbit or the timer route per se. I'm just trying to figure
> out (with the existing capabilities) how to make opensips fail to another
> member in the rabbit cluster in the event that the current node dies. My
> first thought was that you could simply stack entry points like:
>
> subscribe_event("E_ACC_CDR",
> "rabbitmq:rabbitmq:[email protected];rabbitmq:[email protected];rabbitmq:[email protected]/cdr1")
>
> However, it sounds like that's not in the present implementation of the
> rabbit module.
>
> So my second thought was to trick opensips and put HAProxy between it and
> Rabbit, which works, but if I fail an HAProxy via corosync to the other
> HAproxy something with the subscription breaks. Since it looked like the two
> options were either put the subscribes in the startup route (only happens
> once so probably won't failover) OR use the timer route to subscribe (which
> is what i'm doing) I figured that in the event of an HAProxy failure, I might
> miss a few messages but on the next timer fire opensips would resubscribe to
> haproxy which would relay that to the appropriate rabbit server (I haven't
> failed over any rabbit servers in this scenario so haproxy2 is talking to the
> same rabbit server as haproxy1. All i'm doing is killing haproxy1 right now
> and letting the VIP go to haproxy2). However it doesn't look like this is
> working and I can't tell if its because the subscription isn't happening, OR
> it is happening but opensips sees it already exists in the
> subscribers list and does nothing (I think this is the case). If this IS
>the case perhaps a solution would be to kill the subscriber entry on new
>subscribe. If I'm way off, let me know, I'd really like to figure this out. Am
>I going about this all wrong? How would you handle a rabbit node failure?
>
> Regards
>
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users