Sha256: 09c3b1be2ec0116cd1927292330bcbe1abdaa01cdbe6e2d39ea382458a47a1de
Contents?: true
Size: 736 Bytes
Versions: 11
Compression:
Stored size: 736 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 = DATABASE.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 & 1 rubygems