Sha256: 7ea91f3bb556a2408431c805dad3a14d7de1a87f502da24046610fd5d8e0ca10
Contents?: true
Size: 735 Bytes
Versions: 11
Compression:
Stored size: 735 Bytes
Contents
class ProxySQLHelper class << self # Flips the destination hostgroup for /maintenance:lhm/ from 0 (i.e. writer) to 1 (i.e. reader) def with_lhm_hostgroup_flip conn = Mysql2::Client.new( host: '127.0.0.1', username: "remote-admin", password: "password", port: "6032", ) begin conn.query("UPDATE mysql_query_rules SET destination_hostgroup=1 WHERE match_pattern=\"maintenance:lhm\"") conn.query("LOAD MYSQL QUERY RULES TO RUNTIME;") yield ensure conn.query("UPDATE mysql_query_rules SET destination_hostgroup=0 WHERE match_pattern=\"maintenance:lhm\"") conn.query("LOAD MYSQL QUERY RULES TO RUNTIME;") end end end end
Version data entries
11 entries across 11 versions & 2 rubygems