Class: Flydata::Command::Mysqlbinlog

Inherits:
Sync
  • Object
show all
Includes:
MysqlCommandBase
Defined in:
lib/flydata/source_mysql/command/mysqlbinlog.rb

Constant Summary

Constants inherited from Sync

Sync::AUTO_CREATE_STATUS_CREATED_TABLES, Sync::AUTO_CREATE_STATUS_START, Sync::INSERT_PROGRESS_INTERVAL, Sync::RUN_PROFILE, Sync::SERVER_DATA_PROCESSING_TIMEOUT, Sync::STATUS_COMPLETE, Sync::STATUS_PARSED, Sync::STATUS_PARSING, Sync::STATUS_START

Constants included from Helpers

Helpers::UNIT_PREFIX

Instance Attribute Summary

Attributes inherited from Sync

#ddl_tables, #full_initial_sync, #full_tables, #input_tables, #new_tables

Attributes inherited from Base

#opts

Instance Method Summary collapse

Methods included from MysqlCommandBase

#flush, #generate_table_ddl, #reset, #run, #skip

Methods inherited from Sync

#_reset, #check, #clear, #compat_check, #flush, #generate_table_ddl, #repair, #reset, #resync, #run, #skip, slop, slop_clear, slop_flush, slop_generate_table_ddl, slop_repair, slop_reset, slop_resync, #try_initial_sync

Methods included from Helpers

as_size, development?, env_mode, env_suffix, flydata_api_host_file, flydata_conf_file, flydata_version, format_menu_list, retry_on, to_command_class, usage_text

Methods inherited from Base

#ask_input_table_name, #ask_yes_no, #choose_one, #dashboard_url, #data_entry, #data_port, #flydata, #initialize, #newline, #redshift_cluster, #redshift_console_url, #register_crontab, #retrieve_data_entries, #separator, #show_purpose_name, #source

Methods included from ExclusiveRunnable

included

Methods included from Flydata::CommandLoggable

#before_logging, #log_error_stderr, #log_info_stdout, #log_warn_stderr

Constructor Details

This class inherits a constructor from Flydata::Command::Base

Instance Method Details

#generate_command(dbconf, args) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/flydata/source_mysql/command/mysqlbinlog.rb', line 10

def generate_command(dbconf, args)
  skip_ssl = !!args.delete('--skip-ssl')
  dbconf.delete('tables')
  dbconf[:custom_option_end] = args.join(' ')
  dbconf[:command] = 'mysqlbinlog'
  # --default-character-set=utf8 is not supported
  dbconf[:no_default_option] = true
  # ssl is not supported for mysql5.6 or older mysqlbinlog command
  if skip_ssl
    dbconf.delete('ssl_ca')
    dbconf.delete('ssl_cipher')
  end
  dbconf.delete('database')
  if args.empty?
    puts <<EOT
example:
1. Dump raw binlog
  flydata mysqlbinlog --raw --read-from-remote-server --result-file "binlog-" mysql-bin-changelog.xxxx
2. Dump decoded binlog data
  flydata mysqlbinlog  -vv --base64-output=decode-row --hexdump --read-from-remote-server --start-position=4 --stop-position=yyyyy mysql-bin-changelog.xxxxx > mysql-bin-changelog.xxxxx

NOTE: Add --skip-ssl to skip ssl options
EOT
    return
  end
  FlydataCore::Mysql::CommandGenerator::generate_mysql_cmd(dbconf)
end