2

Please Help.

I have used maxscale for a month, but today something happened. It's not working. I then saw the follow error:

this is my error log from spring boot error log:

org.springframework.dao.DataAccessResourceFailureException:
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection killed by MaxScale: Router could not recover from connection errors
### The error may exist in com/gop/exchange/mapper/MatchResultMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select max(price)   maxPrice ,min(price) minPrice ,sum(number) amount   ,max(id)   closeid,min(id) openid from match_result_udc_iep where   create_time   >=   ?   and create_time < ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection killed by MaxScale: Router could not recover from connection errors
; SQL []; Connection killed by MaxScale: Router could not recover from connection errors; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection killed by MaxScale: Router could not recover from connection errors
        at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:79) ~[spring-jdbc-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) ~[spring-jdbc-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) ~[spring-jdbc-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]

My maxscale version:2.2.12 My maxscale version maxscale configure is :

[maxscale]
threads=auto

[server1]
type=server
address=192.168.133.15
port=3306
protocol=MySQLBackend

[server2]
type=server
address=192.168.133.16
port=3306
protocol=MySQLBackend

[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=server1,server2
user=maxscale_wx
passwd=05166D59D2C9BBB7B5BB77072AA5BF48
monitor_interval=10000 #监控心态10秒
backend_connect_attempts=3


[Read-Write-Service]
type=service
router=readwritesplit
router_options=master_accept_reads=true
servers=server1,server2
user=maxscale_route
passwd=05166D59D2C9BBB7B5BB77072AA5BF43
max_connections=3000


[MaxAdmin-Service]
type=service
router=cli
connection_timeout=300
max_connections=100

[Read-Write-Listener]
type=listener
service=Read-Write-Service
protocol=MySQLClient
port=4006

[MaxAdmin-Listener]
type=listener
service=MaxAdmin-Service
protocol=maxscaled
socket=default

Thanks. please

Yan Khonski
  • 12,225
  • 15
  • 76
  • 114
tian fee
  • 21
  • 1
  • 2

2 Answers2

1

The error message Connection killed by MaxScale: Router could not recover from connection errors tells us that the readwritesplit router encountered a network connection error that it could not recover from. Most of the time this means that the connection to the master server was lost.

Look into the MaxScale log file in /var/log/maxscale/maxscale.log and see if there are any errors related to the servers configured in MaxScale at the time of the client side error. If the errors are about timeouts, increasing the backend_connect_timeout and backend_read_timeout to higher values likely solves it.

markusjm
  • 2,358
  • 1
  • 11
  • 23
  • As you said,I compared the log errors and maxscale.log.But I didn't see the errors about timeouts in maxscale.log – tian fee Sep 12 '18 at 10:19
  • Did you see errors of any other kind? Other connection related errors also cause that message to be sent. – markusjm Sep 13 '18 at 11:03
  • No.That's why I am so confused.Now I doubt when mysql is ready to execute this sql,the related table is locked .After a long time,It was killed by maxscale.But I didn't find any kind of error about this.So weird!@markusjm – tian fee Sep 18 '18 at 10:54
  • I'd recommend you open a bug report on the MariaDB Jira for this. This doesn't seem like a normal problem so it should be investigated more closely and the bug report helps track the progress of the issue. – markusjm Oct 04 '18 at 08:09
0

I had meet the same problem. But, I program with python not java, and use sqlalchemy (an ORM toolkit) to work with database.

I use the connection pool for the connection. And it seems that this is the reason of the problem.

From the document, we can see the the servers must set the persistpoolmax and persistmaxtime options for pooling connect.

So I add these two options for all servers, for example:

[server1]
type=server
address=slave1
port=3306
protocol=MariaDBBackend
persistpoolmax=100
persistmaxtime=3600

In my programme, the connection recycle time equals to the persistmaxtime.

You can get more information from https://mariadb.com/kb/en/mariadb-maxscale-14/maxscale-administration-tutorial/#persistent,

4b0
  • 21,981
  • 30
  • 95
  • 142
tommey
  • 31
  • 2