Re: [Sqlrelay-discussion] Mysql auto reconnect problem
Brought to you by:
mused
From: David M. <dav...@fi...> - 2012-12-04 16:30:35
|
In the sqlrelay source distribution, open the file src/connections/mysql/mysqlconnection.cpp and search for ::errorMessage. If an error occurs, the errorMessage method fetches the error from mysql and returns it to the client. It interprets certain messages as meaning "I've lost my db connection" and this causes SQL Relay to re-log-in to the db. SQL Relay doesn't currently recognize "Lost connection to MySQL server during query." Apparently I added it at some point, but then commented it out. I don't actually remember doing either, but if you uncomment that code, rebuild and reinstall, it should cause relay to reconnect when it sees that error. It's very odd that code to recognize that error is in there but commented out. I guess there might have been some issue with it but I don't have any specific memory if it at all. Please let me know if you run into any issues. Dave dav...@fi... On 12/03/2012 11:25 PM, lee angus wrote: > Dear all: > We are using sqlrelay for php connection pool. > There are some problem about mysql's MYSQL_OPT_RECONNECT. > When sqlrelay's conneciotn exceed Mysql's interactive_timeout,or Mysql > server daemon restarted. > We will always get Error "Lost connection to MySQL server during query" > unless we restart sqlrelay. > > Env infomantion: > OS:centos6.2 > Sqlrelay:0.47 > Mysql lib:5.1.59 > > > Test plan as below. > 1.Start sqlrelay -> Mysql connection,sqlrelay,conf as below > ========================================= > sqlrealy > <instances> > <instance id="test_mysql" > dbase="mysql" > addresses="" > port="" > socket="/opt/sqlrelay/socket/test_mysql.socket" > connections="1" > maxconnections="20" > maxqueuelength="0" > cursors="1" > maxcursors="100" > maxlisteners="20" > listenertimeout="1" > waitfordowndatabase="no" > runasuser="nobody" > runasgroup="nobody" > authtier="connection" > handoff="pass" > endofsession="rollback" > ignoreselectdatabase="yes" > timequeriessec="-1" > timequeriesusec="-1" > debug="none"> > <users><user user="user" password="password"/></users> > <connections> > <connection connectionid="test_mysql" > > string="user=test_mysql;password=test_mysql;host=172.16.30.211;port=3307;db=test_mysql;fakebinds=yes"> > </connections> > </instance> > </instances> > ========================================= > 2.Useing sqlrsh test connection,work functionally. > ========================================= > # sqlrsh -id test_mysql > SQLRShell - Version 0.22 > Connected to: localhost:0 as user > > type help; for a help. > > 0> select now(); > now() > =================== > 2012-12-03 14:21:50 > Rows Returned : 1 > Fields Returned : 1 > System time : 50000 > ========================================= > 3.Then,kill client process from mysql server.(Here we using kill process > to emulate Mysql's interactive_timeout ) > We got "Lost connection to MySQL server during query" log. > ========================================= > sqlrsh -id test_mysql > SQLRShell - Version 0.22 > Connected to: localhost:0 as user > > type help; for a help. > > 0> select now(); > 2013: > Lost connection to MySQL server during query > > Rows Returned : 0 > Fields Returned : 0 > System time : 60000 > > 0> > ========================================= > > This connection wont work unless we restart sqlrelay. > We have checked sqlrelay's ChangeLog,MYSQL_OPT_RECONNECT have been > applied after sqlrelay-0.40. > > > Any suugestion or advice will be appreciated!! > > > > ------------------------------------------------------------------------------ > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > > _______________________________________________________ > Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting > http://www.doteasy.com > > > > _______________________________________________ > Sqlrelay-discussion mailing list > Sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion > > > _______________________________________________________ > Unlimited Disk, Data Transfer, PHP/MySQL Domain Hosting > http://www.doteasy.com > |