Created
January 29, 2021 00:20
-
-
Save osamu/4c654852173b77f5c8a5648d40ee062d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mysql2' | |
begin | |
client = Mysql2::Client.new(:host => "db1-proxy.proxy-hogehoge.amazonaws.com", :username => "root", :password => '') | |
while true | |
query = "SHOW GLOBAL VARIABLES WHERE Variable_Name IN ('innodb_read_only', 'server_uuid', 'aurora_server_id');" | |
client.query(query).each do |row| | |
puts row | |
end | |
sleep(0.2) | |
end | |
rescue => e | |
puts e | |
retry | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
もっと速度を落としてqueryしている場合、切り替わり時にRDS Proxyとの接続が維持される。