开发者

How ReplicationDriver works

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜