maxscale can not make queries forward to slave
This is a config file for maxscale blow:
[maxscale] threads=8 [server1] type=server address=192.168.8.61 port=3306 protocol=MySQLBackend [server2] type=server address=192.168.8.74 port=3306 protocol=MySQLBackend [MySQL Monitor] type=monitor module=mysqlmon servers=server1,server2 user=test passwd=test monitor_interval=10000 [Read-Write Service] type=service router=readwritesplit servers=server1,server2 user=test passwd=test max_slave_connections=100% max_slave_replication_lag=30 [MaxAdmin Service] type=service router=cli [Read-Write Listener] type=listener service=Read-Write Service protocol=MySQLClient port=4006 [MaxAdmin Listener] type=listener service=MaxAdmin Service protocol=maxscaled port=6603
There is the result that I execute "select * from test" 30 times via a mysql client and execute command "maxadmin -pmariadb show services"
Service: Read-Write Service Router: readwritesplit (0x7fd9ab9e02c0) State: Started Number of router sessions: 30 Current no. of router sessions: 0 Number of queries forwarded: 30 Number of queries forwarded to master: 30 Number of queries forwarded to slave: 0 Number of queries forwarded to all: 30 Master/Slave percentage: 100.00% Started: Thu Aug 4 11:27:30 2016 Root user access: Disabled Backend databases 192.168.8.74:3306 Protocol: MySQLBackend 192.168.8.61:3306 Protocol: MySQLBackend Users data: 0x1b28a40 Total connections: 31 Currently connected: 1
As we can see above, no query forward to slave server. how to resolve? please
Answer Answered by Markus Mäkelä in this comment.
Were the selects done inside a transaction or through a prepared statement? Was autocommit off?
You can also enable the info log level by adding log_info=1 under the [maxscale] section. This will tell you what routing decisions the readwritsplit is making.
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.