开发者

How do I identify which MySQL slave has responded?

开发者 https://www.devze.com 2022-12-24 07:50 出处:网络
I have a MySql Master server replicating to three Slaves. A legacy website is performing load-balanced Reads from the Slaves.

I have a MySql Master server replicating to three Slaves.

A legacy website is performing load-balanced Reads from the Slaves.

Is there a method of identifying from the website which of the Slaves is serving a Read request?

I'd prefer a function that I can use to return a server name or ip address as part of the SELECT, but any reasonable met开发者_JAVA百科hod will do.

Thank you in advance.


 SHOW VARIABLES LIKE 'server_id' 

Each host has to have a own server_id. Should be enough to know which one answered the request.

0

精彩评论

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

关注公众号