简体   繁体   中英

Maxscale: combine readwritesplit and schemarouter

I'm trying to setup maxscale to use schemarouter and readwritesplit. I have many shards for my mysql database. Each shard has a slave So the idea is to use one schemarouter on masters and one on slaves to proxy all shards. Then use These 2 services in readwritesplit.

This cause the following issue:
2017-02-10 14:57:48   error  : Failure loading users data from backend [10.161.66.145:4009] for service [Splitter Service]. MySQL error 2013, Lost connection to MySQL server at 'handshake: waiting for inital communication packet', system error: 110
2017-02-10 14:57:52   error  : Failure loading users data from backend [10.161.66.145:4008] for service [Splitter Service]. MySQL error 2013, Lost connection to MySQL server at 'reading authorization packet', system error: 110
2017-02-10 14:57:52   error  : Unable to get user data from backend database for service [Splitter Service]. Failed to connect to any of the backend databases.

Any help would be nice.

My schemarouter are both working fine. Here is the readwritesplit config:

[max_ro]
type=server
address=10.10.10.10
port=4009
protocol=MySQLBackend

[max_rw]
type=server
address=10.10.10.10
port=4008
protocol=MySQLBackend

[Splitter Service]
type=service
router=readwritesplit
servers=max_ro,max_rw
user=maxscale
passwd=maxscale

[Splitter Listener]
type=listener
service=Splitter Service
protocol=MySQLClient
port=4010

Thanks

The errors are most likely caused by the fact that the readwritesplit services have not yet started. There is a bug report about this behavior on the MariaDB Jira .

If the sharding service works and no more errors are logged once MaxScale has started then everything is working as expected and the errors can be ignored as is described in this bug report .

Another way to solve this problem would be to separate the configuration into two parts and use separate MaxScale instances; one for the sharding service and another one for the read-write splitting service. This does add an extra layer of complexity as two services need to be started instead of one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM