开发者

How ReplicationDriver works

开发者 https://www.devze.com 2023-03-13 15:04 出处:网络
I am curious how com.mysql.jdbc.ReplicationDriver works. I have configuration with 1master & 1slave.

I am curious how com.mysql.jdbc.ReplicationDriver works. I have configuration with 1master & 1slave.

I want to force some queries to JUST on开发者_开发问答 slave. But it selects DB randomly and sometimes run it on master.

Is it a way to force readonly connection to use just slave DB and never master?


For the ReplicationDriver to know that queries can go to read-only slaves, two conditions need to be met:

Auto commit needs to be turned off. (*)
Connection needs to be set to read-only.
0

精彩评论

暂无评论...
验证码 换一张
取 消