[Users] Mysql reconnect problem

Christian Schlatter cs at unc.edu
Mon Dec 18 15:41:30 CET 2006


Dimo wrote:
> Hi,
> It works great, thanks!
> 
> Now that there is hot reconnect is there a possiblity to make ser
> start without a database running? I am thinking about a scenario where
> there is a network loss and my redundant opensers are restarting and
> the database is restarting too but with some lag. In this scenario at
> the moment of openser starting, the db is unavailable but it comes up
> in 1-2 seconds after that. I guess hot reconnect will make things work
> so there will not be the need to have the database online at the
> moment of starting openser.
> At present i cannot make ser start if there is a module requiring a db
> and the db server is down.

I had the same issue and solved it by using one of those process 
monitoring tools. In particular I'm using the monit tool that tries to 
start the openser process(es) several times at a given interval. So if 
for some reason the DB, in my case mysql-cluster, is not ready, monit 
will wait a minute and try to start openser again. After a complete 
cluster shutdown it normally takes quite a while for the cluster to come 
up again.

This is how my monitrc looks like:

set logfile syslog facility log_daemon

set httpd port 888
         ssl enable
         pemfile /etc/monit/monit.pem
         allow rtc:"xxx"

check process openser with pidfile /var/run/openser/openser.pid
         start program = "/etc/init.d/openser start"
         stop program = "/etc/init.d/openser stop"
         if 3 restarts within 4 cycles then timeout
         group sipserver

check process mediaproxy with pidfile /var/run/mediaproxy.pid
         start program = "/etc/init.d/mediaproxy start"
         stop program = "/etc/init.d/mediaproxy stop"
         if 3 restarts within 4 cycles then timeout
         group sipserver

check process ami_proxy with pidfile /var/run/ami_proxy.pl.pid
         start program = "/etc/init.d/ami_proxy start"
         stop program = "/etc/init.d/ami_proxy stop"
         if 3 restarts within 4 cycles then timeout
         group sipserver

check process mysqld with pidfile /var/run/mysqld/mysqld.pid
         group database


- Christian


> 
> Best,
> Dimo
> 
> 
> 
> On 12/12/06, Bogdan-Andrei Iancu <bogdan at voice-system.ro> wrote:
>> Hi Dimo,
>>
>> yes, there is a mechanism for hot reconnect to the mysql server. By
>> default it is turned on.
>> see:
>>     http://www.openser.org/docs/modules/1.2.x/mysql.html#AEN68
>>
>> regards,
>> bogdan
>>
>> Dimo wrote:
>>
>> > Hi All,
>> > I have a problem with openser reconnecting to my redundant mysql
>> > servers which hold the openser database.
>> >
>> > The database servers are in a cluster and if one fails the other takes
>> > over its IP address.
>> > In openser however the connection to the database is established only
>> > (i think) at the beginning.
>> > So when openser is running and one of my sql servers drops, and the
>> > other takes over the IP, i  get an error in openser saying that the
>> > mysql connection does not exist.
>> >
>> > Is there a way to make openser reconnect to mysql automatically
>> > without restarting it or some other way I can make this work?
>> >
>> > Best,
>> > Dimo
>> >
>> > _______________________________________________
>> > Users mailing list
>> > Users at openser.org
>> > http://openser.org/cgi-bin/mailman/listinfo/users
>> >
>>
>>
> 
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 1951 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.kamailio.org/pipermail/users/attachments/20061218/8bb24009/attachment.bin 


More information about the Users mailing list