maxscale master slave Valid connection check in connection pool

360 views Asked by At

Currently, master-slave replication is finished, and select and insert are branched using the readwritesplit function of maxscale.

I was using common dbcp and checking the connection using the options of testOnBorrow and validationQuery through datasource configuration, but because the query is transmitted through maxscale, select 1 of validationQuery is only transmitted to the slave, and the connection validity of the master cannot be checked.

The master does not check the validity of the connection, so if you connect after not using WAS for a long time, a db connection related error occurs.

to solve this problem I used master_accept_reads = true, but I don't want to use it as it will generate more traffic to the master. As another option persistpoolmax,persistmaxtime I used, but I got the same error message.

I am wondering if there is a way to send a connection validation query such as ValidationQuery in maxscale or mariadb without distinction between master and slave.

Thank you for reading the long text.

1

There are 1 answers

1
tcoker On

You can use the hint filter to route queries to the master.

https://mariadb.com/kb/en/mariadb-maxscale-24-hintfilter/