Class: Fluent::RdsMysqlSlowLog::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/in_rds_mysql_slow_log.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port, username, password) ⇒ Server

Returns a new instance of Server.



186
187
188
189
190
191
# File 'lib/fluent/plugin/in_rds_mysql_slow_log.rb', line 186

def initialize(host, port, username, password)
  @host = host
  @port = port
  @username = username
  @password = password
end

Instance Method Details

#connectObject



193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/fluent/plugin/in_rds_mysql_slow_log.rb', line 193

def connect
  client = Mysql2::Client.new(
    host: @host,
    port: @port,
    username: @username,
    password: @password,
    database: 'mysql',
    cache_rows: false,
    cast: false
  )
  yield client
ensure
  client.close if client
end