mysqlknife 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -6
- data/bin/mysqlknife +2 -127
- data/lib/mysqlknife.rb +12 -9
- data/lib/mysqlknife/checksum.rb +7 -7
- data/lib/mysqlknife/cli.rb +144 -0
- data/lib/mysqlknife/config.rb +5 -5
- data/lib/mysqlknife/connection.rb +3 -5
- data/lib/mysqlknife/kill.rb +50 -19
- data/lib/mysqlknife/replica.rb +6 -3
- data/lib/mysqlknife/version.rb +1 -1
- metadata +35 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bf6062612d1868ec0ace249f6411307680db9b5
|
4
|
+
data.tar.gz: 82cd3ccbc43e2dd9faebb746a4c05afd466187e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cffcc0fa53b48aa686b8cf0f73a59e2eedd16dff643aba68f23c48a2c15a4c1ba3d20d56156e38d1c6d5f2d79e32ef0f64956e2f5e1f9d66d416481500c89843
|
7
|
+
data.tar.gz: aaf2eda2aca81c62e18795b312c7e4b73d7e9d3ae64f2bffad99804da79b322061b6616ab4180e01cdaf10374b8c7eba700b51e6f7ea623b7e760ede4e18dca9
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Mysqlknife
|
2
2
|
|
3
|
-
|
3
|
+
MySQL Knife is a Ruby Gem and command line tools, written for UNIX-like
|
4
|
+
operating systems. That allows many tasks in MySQL Administration is easily for
|
5
|
+
normal installation or in Amazon RDS. You can:
|
6
|
+
|
4
7
|
- Checksum tables.
|
5
8
|
- Skip error is slave.
|
6
9
|
- Swap Databases
|
@@ -21,13 +24,18 @@ $ gem install mysqlknife
|
|
21
24
|
Compare two tables with checksum:
|
22
25
|
|
23
26
|
```Shell
|
24
|
-
$ mysqlknife checksum --from h=127.0.0.1,P=3306,u=root,p=admin,d=demo_from
|
27
|
+
$ mysqlknife checksum --from h=127.0.0.1,P=3306,u=root,p=admin,d=demo_from \
|
28
|
+
--to h=127.0.0.1,P=3306,u=root,p=admin,d=demo_to \
|
29
|
+
--table foo
|
25
30
|
```
|
26
31
|
|
27
32
|
### Skip error in slave.
|
28
33
|
|
29
34
|
```Shell
|
30
|
-
$ mysqlknife skip --host 127.0.0.1
|
35
|
+
$ mysqlknife skip --host 127.0.0.1 \
|
36
|
+
--user root \
|
37
|
+
--password admin \
|
38
|
+
--behind -120
|
31
39
|
```
|
32
40
|
|
33
41
|
### Swap Databases
|
@@ -39,7 +47,10 @@ following command and save the STDOUT output to a file and then execute DML
|
|
39
47
|
statements.
|
40
48
|
|
41
49
|
```Shell
|
42
|
-
$ mysqlknife swap --host 127.0.0.1
|
50
|
+
$ mysqlknife swap --host 127.0.0.1 \
|
51
|
+
--user root \
|
52
|
+
--password admin \
|
53
|
+
--databases from,to > swap.sql
|
43
54
|
$ mysql -h 127.0.0.1 -u root -padmin < swap.sql
|
44
55
|
```
|
45
56
|
|
@@ -51,11 +62,20 @@ output who kill.
|
|
51
62
|
Please, follow next instructions to kill process:
|
52
63
|
|
53
64
|
```Shell
|
54
|
-
$ mysqlknife kill --host 127.0.0.1
|
65
|
+
$ mysqlknife kill --host 127.0.0.1 \
|
66
|
+
--user root \
|
67
|
+
--pass admin \
|
68
|
+
--where "time >= 200"
|
55
69
|
```
|
56
70
|
|
71
|
+
And kill the listed process:
|
72
|
+
|
57
73
|
```Shell
|
58
|
-
$ mysqlknife kill --host 127.0.0.1
|
74
|
+
$ mysqlknife kill --host 127.0.0.1 \
|
75
|
+
--user root \
|
76
|
+
--pass admin \
|
77
|
+
--where "time >= 200" \
|
78
|
+
--kill
|
59
79
|
```
|
60
80
|
|
61
81
|
## Warning
|
data/bin/mysqlknife
CHANGED
@@ -1,131 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
-
|
4
|
+
require File.expand_path("../../lib/mysqlknife", __FILE__)
|
5
5
|
|
6
|
-
|
7
|
-
require 'commander/import'
|
8
|
-
require 'terminal-table'
|
9
|
-
require 'mysqlknife'
|
10
|
-
|
11
|
-
program :name, 'MySQL knife tools'
|
12
|
-
program :version, Mysqlknife::VERSION
|
13
|
-
program :description, 'MySQL knife tools'
|
14
|
-
program :help, 'Author', 'Nicola Strappazzon <nicola51980@gmail.com>'
|
15
|
-
|
16
|
-
global_option('-H', '--host STRING')
|
17
|
-
global_option('-u', '--user STRING')
|
18
|
-
global_option('-p', '--password [STRING]')
|
19
|
-
global_option('-P', '--port [STRING]')
|
20
|
-
|
21
|
-
command :checksum do |c|
|
22
|
-
c.description = 'Checksum table.'
|
23
|
-
c.syntax = %w(mysqlknife checksum
|
24
|
-
--from h=127.0.0.1,P=3306,u=root,p=admin,d=demo_from
|
25
|
-
--to h=127.0.0.1,P=3306,u=root,p=admin,d=demo_to
|
26
|
-
--table foo).join(' ')
|
27
|
-
c.option '--from STRING', String, 'DNS to connect to source database.'
|
28
|
-
c.option '--to STRING', String, 'DNS to connect to destination database.'
|
29
|
-
c.option '--table STRING', String, 'Table name to compare.'
|
30
|
-
|
31
|
-
c.action do |args, options|
|
32
|
-
if options.from.nil? ||
|
33
|
-
options.to.nil? ||
|
34
|
-
options.table.nil?
|
35
|
-
puts c.syntax
|
36
|
-
else
|
37
|
-
unless Mysqlknife::Checksum.new(options.__hash__).equal?
|
38
|
-
puts "-- Table '#{options.table}' is not equal data."
|
39
|
-
exit 1
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
command :swap do |c|
|
46
|
-
c.description = 'Swap two databases.'
|
47
|
-
c.syntax = %w(mysqlknife swap
|
48
|
-
--host 127.0.0.1
|
49
|
-
--user root
|
50
|
-
--password admin
|
51
|
-
--databases from,to).join(' ')
|
52
|
-
c.option '--databases STRING', String, 'Databases to swap.'
|
53
|
-
|
54
|
-
c.action do |args, options|
|
55
|
-
if options.host.nil? ||
|
56
|
-
options.user.nil? ||
|
57
|
-
options.databases.nil? ||
|
58
|
-
options.databases.split(',').count != 2
|
59
|
-
puts c.syntax
|
60
|
-
else
|
61
|
-
swap = Mysqlknife::Swap.new(options.__hash__).all
|
62
|
-
|
63
|
-
if swap
|
64
|
-
swap.each do |sql|
|
65
|
-
puts sql
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
command :kill do |c|
|
73
|
-
c.description = 'Kill all process.'
|
74
|
-
c.syntax = %w(mysqlknife kill
|
75
|
-
--host 127.0.0.1
|
76
|
-
--user root
|
77
|
-
--password admin
|
78
|
-
--where "time >= 28800").join(' ')
|
79
|
-
c.option '--where STRING', String, 'Conditions to filter.'
|
80
|
-
c.option '--list', 'List match process to kill.'
|
81
|
-
|
82
|
-
c.action do |args, options|
|
83
|
-
if options.host.nil? ||
|
84
|
-
options.user.nil? ||
|
85
|
-
options.where.nil?
|
86
|
-
puts c.syntax
|
87
|
-
else
|
88
|
-
kill = Mysqlknife::Kill.new(options.__hash__)
|
89
|
-
|
90
|
-
if kill.check_privileges
|
91
|
-
if options.list.nil?
|
92
|
-
kill.clear unless kill.list.first.nil?
|
93
|
-
else
|
94
|
-
unless kill.list.first.nil?
|
95
|
-
table = Terminal::Table.new do |t|
|
96
|
-
t.add_row(kill.list.first.keys)
|
97
|
-
t.add_separator
|
98
|
-
|
99
|
-
kill.list.each do |row|
|
100
|
-
t.add_row(row.values)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
puts table
|
104
|
-
end
|
105
|
-
end
|
106
|
-
else
|
107
|
-
puts 'User does not have process privileges.'
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
command :skip do |c|
|
114
|
-
c.description = 'Skipping the current replication error in Amazon RDS.'
|
115
|
-
c.syntax = %w(mysqlknife skip
|
116
|
-
--host 127.0.0.1
|
117
|
-
--user root
|
118
|
-
--password admin
|
119
|
-
--behind -120).join(' ')
|
120
|
-
c.option '--behind Integer', Integer, 'Set Seconds Behind Master, default is 120.'
|
121
|
-
c.action do |args, options|
|
122
|
-
if options.host.nil? ||
|
123
|
-
options.user.nil? ||
|
124
|
-
options.behind.nil?
|
125
|
-
puts c.syntax
|
126
|
-
else
|
127
|
-
rep = Mysqlknife::Replica.new(options.__hash__)
|
128
|
-
rep.skip
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
6
|
+
Mysqlknife::CLI.start(ARGV)
|
data/lib/mysqlknife.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require 'mysqlknife/kill'
|
8
|
-
require 'mysqlknife/sql'
|
9
|
-
require 'mysqlknife/swap'
|
10
|
-
require 'mysqlknife/version'
|
3
|
+
require 'mysql2'
|
4
|
+
require 'terminal-table'
|
5
|
+
require 'thor'
|
6
|
+
require 'yaml'
|
11
7
|
|
12
8
|
module Mysqlknife
|
13
|
-
|
9
|
+
LIBRARY_PATH = File.join(File.dirname(__FILE__), 'mysqlknife')
|
10
|
+
|
11
|
+
# Autoload libraries:
|
12
|
+
Dir["#{LIBRARY_PATH}/*.rb"].select do |file|
|
13
|
+
if File.file? file
|
14
|
+
require File.join(LIBRARY_PATH, File.basename(file, '.rb'))
|
15
|
+
end
|
16
|
+
end
|
14
17
|
end
|
data/lib/mysqlknife/checksum.rb
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
module Mysqlknife
|
4
4
|
class Checksum
|
5
5
|
def initialize(options = {})
|
6
|
-
|
7
|
-
|
6
|
+
dsn_from = Config.new.dsn(options[:from])
|
7
|
+
dsn_to = Config.new.dsn(options[:to])
|
8
8
|
|
9
|
-
@sum_from = sum(
|
10
|
-
@sum_to = sum(
|
9
|
+
@sum_from = sum(dsn_from, options[:table])
|
10
|
+
@sum_to = sum(dsn_to, options[:table])
|
11
11
|
end
|
12
12
|
|
13
|
-
def sum(
|
14
|
-
conn = Connection.new(
|
15
|
-
sql = Sql.new(
|
13
|
+
def sum(dsn, table)
|
14
|
+
conn = Connection.new(dsn)
|
15
|
+
sql = Sql.new(dsn[:database], table)
|
16
16
|
columns = conn.execute(sql.columns)
|
17
17
|
sql = sql.checksum(columns)
|
18
18
|
columns = conn.execute(sql)
|
@@ -0,0 +1,144 @@
|
|
1
|
+
module Mysqlknife
|
2
|
+
class CLI < Thor
|
3
|
+
def initialize(*args)
|
4
|
+
super
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'checksum', 'Checksum table.'
|
8
|
+
long_desc <<-LONGDESC
|
9
|
+
DSN:
|
10
|
+
|
11
|
+
These DSN (Data Source Name) options are used to create a DSN. Each option
|
12
|
+
is given like option=value. The options are case-sensitive, so P and p are
|
13
|
+
not the same option. There cannot be whitespace before or after the = and
|
14
|
+
if the value contains whitespace it must be quoted. DSN options are
|
15
|
+
comma-separated. This idea is get from percona-toolkit.
|
16
|
+
|
17
|
+
h=<host>,P=<port>,u=<user>,p=<password>,d=<database>
|
18
|
+
|
19
|
+
Example: h=127.0.0.1,P=3306,u=root,p=admin,d=demo_from
|
20
|
+
|
21
|
+
Syntax:
|
22
|
+
|
23
|
+
mysqlknife checksum
|
24
|
+
--from h=127.0.0.1,P=3306,u=root,p=admin,d=demo_from
|
25
|
+
--to h=127.0.0.1,P=3306,u=root,p=admin,d=demo_to
|
26
|
+
--table foo
|
27
|
+
LONGDESC
|
28
|
+
option :from,
|
29
|
+
desc: 'DSN to connect to source database.',
|
30
|
+
required: true,
|
31
|
+
type: :string
|
32
|
+
option :to,
|
33
|
+
desc: 'DSN to connect to destination database.',
|
34
|
+
required: true,
|
35
|
+
type: :string
|
36
|
+
option :table,
|
37
|
+
desc: 'Name of table to compare.',
|
38
|
+
required: true,
|
39
|
+
type: :string
|
40
|
+
def checksum
|
41
|
+
unless Mysqlknife::Checksum.new(options).equal?
|
42
|
+
puts "-- Table '#{options[:table]}' is not equal data."
|
43
|
+
exit 1
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'kill', 'Kill process in MySQL or RDS'
|
48
|
+
long_desc <<-LONGDESC
|
49
|
+
Syntax:
|
50
|
+
|
51
|
+
mysqlknife kill --host 127.0.0.1 --user root --password admin
|
52
|
+
--where "time >= 28800"
|
53
|
+
LONGDESC
|
54
|
+
option :host,
|
55
|
+
type: :string
|
56
|
+
option :user,
|
57
|
+
type: :string
|
58
|
+
option :password,
|
59
|
+
type: :string
|
60
|
+
option :port,
|
61
|
+
type: :numeric
|
62
|
+
option :where,
|
63
|
+
default: 'time >= 28800',
|
64
|
+
desc: 'Conditions to filter.',
|
65
|
+
required: true,
|
66
|
+
type: :string
|
67
|
+
option :kill,
|
68
|
+
desc: 'Execute kill statements.',
|
69
|
+
type: :boolean
|
70
|
+
def kill
|
71
|
+
kill = Mysqlknife::Kill.new(options)
|
72
|
+
|
73
|
+
if kill.check_privileges
|
74
|
+
if options[:kill]
|
75
|
+
kill.clear
|
76
|
+
else
|
77
|
+
puts kill.show
|
78
|
+
end
|
79
|
+
else
|
80
|
+
puts 'User does not have process privileges.'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
desc 'skip', 'Skipping the current replication error in Amazon RDS.'
|
85
|
+
long_desc <<-LONGDESC
|
86
|
+
Syntax:
|
87
|
+
|
88
|
+
mysqlknife skip --host 127.0.0.1 --user root --password admin --behind
|
89
|
+
-120
|
90
|
+
LONGDESC
|
91
|
+
option :host,
|
92
|
+
type: :string
|
93
|
+
option :user,
|
94
|
+
type: :string
|
95
|
+
option :password,
|
96
|
+
type: :string
|
97
|
+
option :port,
|
98
|
+
type: :numeric
|
99
|
+
option :behind,
|
100
|
+
default: 120,
|
101
|
+
desc: 'Set Seconds Behind Master',
|
102
|
+
required: true,
|
103
|
+
type: :numeric
|
104
|
+
def skip
|
105
|
+
rep = Mysqlknife::Replica.new(options)
|
106
|
+
rep.skip
|
107
|
+
end
|
108
|
+
|
109
|
+
desc 'swap', 'Invert two databases.'
|
110
|
+
long_desc <<-LONGDESC
|
111
|
+
Move all tables and views from DB(A) to DB(B), and DB(B) to DB(A).
|
112
|
+
Use rename of SQL Statements for this action.
|
113
|
+
|
114
|
+
Syntax:
|
115
|
+
|
116
|
+
mysqlknife swap --host 127.0.0.1 --user root --password admin
|
117
|
+
--databases from,to
|
118
|
+
LONGDESC
|
119
|
+
option :host,
|
120
|
+
type: :string
|
121
|
+
option :user,
|
122
|
+
type: :string
|
123
|
+
option :password,
|
124
|
+
type: :string
|
125
|
+
option :port,
|
126
|
+
type: :numeric
|
127
|
+
option :databases,
|
128
|
+
desc: 'Name of databases to swap.',
|
129
|
+
required: true,
|
130
|
+
type: :string
|
131
|
+
def swap
|
132
|
+
if options[:databases].split(',').count == 2
|
133
|
+
swap = Mysqlknife::Swap.new(options).all
|
134
|
+
|
135
|
+
if swap
|
136
|
+
swap.each do |sql|
|
137
|
+
puts sql
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
end
|
data/lib/mysqlknife/config.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'yaml'
|
4
|
-
|
5
3
|
module Mysqlknife
|
6
4
|
class Config
|
7
5
|
@configs = nil
|
@@ -26,9 +24,11 @@ module Mysqlknife
|
|
26
24
|
end
|
27
25
|
end
|
28
26
|
|
29
|
-
def
|
30
|
-
options.
|
27
|
+
def symbolize_keys(options)
|
28
|
+
options.inject({}){|hash,(k,v)| hash[k.to_sym] = v; hash}
|
29
|
+
end
|
31
30
|
|
31
|
+
def defaults(options)
|
32
32
|
{ host: 'localhost',
|
33
33
|
port: '3306',
|
34
34
|
user: 'root',
|
@@ -36,7 +36,7 @@ module Mysqlknife
|
|
36
36
|
.merge(options)
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def dsn(options)
|
40
40
|
options.split(',')
|
41
41
|
.map { |c| c.split('=', 2) }
|
42
42
|
.reduce({}) do |m, (key, value)|
|
@@ -1,13 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
|
-
require 'mysqlknife/config'
|
5
|
-
require 'mysql2'
|
6
|
-
|
7
3
|
module Mysqlknife
|
8
4
|
class Connection
|
9
5
|
def initialize(options = {}, database = nil)
|
10
|
-
|
6
|
+
config = Config.new
|
7
|
+
options = config.symbolize_keys(options)
|
8
|
+
options = config.defaults(options)
|
11
9
|
|
12
10
|
@host = options[:host]
|
13
11
|
@port = options[:port]
|
data/lib/mysqlknife/kill.rb
CHANGED
@@ -8,33 +8,64 @@ module Mysqlknife
|
|
8
8
|
@where = options[:where]
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
return true
|
16
|
-
else
|
17
|
-
return true if @conn.execute(sql_grants).first.values.to_s =~ /PROCESS/
|
11
|
+
def clear
|
12
|
+
list.each do |process|
|
13
|
+
log(process)
|
14
|
+
kill(process['id'])
|
18
15
|
end
|
19
16
|
end
|
20
17
|
|
18
|
+
def check_user
|
19
|
+
sql = @sql.current_user
|
20
|
+
result = @conn.execute(sql).first['CURRENT_USER'] =~ /^root\@/
|
21
|
+
|
22
|
+
return true if result
|
23
|
+
end
|
24
|
+
|
25
|
+
def check_grants
|
26
|
+
sql = @sql.current_user_grants
|
27
|
+
result = @conn.execute(sql).first.values.to_s =~ /PROCESS/
|
28
|
+
|
29
|
+
return true if result
|
30
|
+
end
|
31
|
+
|
32
|
+
def check_privileges
|
33
|
+
check_user || check_grants
|
34
|
+
end
|
35
|
+
|
21
36
|
def list
|
22
37
|
@conn.execute(@sql.processlist(@where))
|
23
38
|
end
|
24
39
|
|
25
|
-
def
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
if exist_procedure.first.nil?
|
34
|
-
@conn.execute(@sql.mysql_kill(process['id']))
|
35
|
-
else
|
36
|
-
@conn.execute(@sql.rds_kill(process['id']))
|
40
|
+
def show
|
41
|
+
unless list.first.nil?
|
42
|
+
table = Terminal::Table.new do |t|
|
43
|
+
t.add_row(list.first.keys)
|
44
|
+
t.add_separator
|
45
|
+
list.each do |row|
|
46
|
+
t.add_row(row.values)
|
47
|
+
end
|
37
48
|
end
|
49
|
+
table
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def log(process)
|
54
|
+
puts %W(#{Time.now.getutc}
|
55
|
+
: MySQL Kill Process -
|
56
|
+
#{process.map { |k, v| "#{k}: #{v}" }.join(', ')}
|
57
|
+
).join(' ')
|
58
|
+
end
|
59
|
+
|
60
|
+
def rds?
|
61
|
+
! @conn.execute(@sql.show_procedure('rds_kill')).first
|
62
|
+
end
|
63
|
+
|
64
|
+
def kill(id)
|
65
|
+
if rds?
|
66
|
+
@conn.execute(@sql.mysql_kill(id))
|
67
|
+
else
|
68
|
+
@conn.execute(@sql.rds_kill(id))
|
38
69
|
end
|
39
70
|
end
|
40
71
|
end
|
data/lib/mysqlknife/replica.rb
CHANGED
@@ -18,20 +18,23 @@ module Mysqlknife
|
|
18
18
|
|
19
19
|
def skip
|
20
20
|
procedure_name = @sql.show_procedure('rds_skip_repl_error')
|
21
|
-
exist_procedure = @conn.execute(procedure_name)
|
21
|
+
exist_procedure = @conn.execute(procedure_name).first
|
22
22
|
slave_status = @conn.execute(@sql.slave_status).first
|
23
23
|
|
24
|
-
|
24
|
+
return nil if slave_status.nil?
|
25
|
+
return nil unless slave_status.include? 'Seconds_Behind_Master'
|
26
|
+
|
25
27
|
if check_status_negative(slave_status['Seconds_Behind_Master'])
|
26
28
|
puts %W(#{Time.now.getutc} : MySQL Skip error replica -
|
27
29
|
#{slave_status.map { |k, v| "#{k}: #{v}" }.join(', ')}
|
28
30
|
).join(' ')
|
29
|
-
if exist_procedure.
|
31
|
+
if exist_procedure.nil?
|
30
32
|
@conn.execute(@sql.mysql_skip_repl_error)
|
31
33
|
while @conn.next_result
|
32
34
|
message = @conn.store_result
|
33
35
|
puts %W(#{Time.now.getutc} : MySQL Skip error replica -
|
34
36
|
Message: #{message}).join(' ')
|
37
|
+
sleep(1)
|
35
38
|
end
|
36
39
|
else
|
37
40
|
message = @conn.execute(@sql.rds_skip_repl_error).first['Message']
|
data/lib/mysqlknife/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysqlknife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicola Strappazzon C.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: mysql2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.3.18
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.3.18
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.19.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.19.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: terminal-table
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,25 +56,33 @@ dependencies:
|
|
42
56
|
name: test-unit
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: 2.5.5
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: 2.5.5
|
55
|
-
description: MySQL Knife tools
|
69
|
+
description: MySQL Knife is a Ruby Gem and command line tools, written for UNIX-like
|
70
|
+
operating systems. That allows many tasks in MySQL Administration is easily for
|
71
|
+
normal installation or in Amazon RDS. You can check two tables by checksum in two
|
72
|
+
servers (Master/Slave for example), Kill process with query, skipping the current
|
73
|
+
replication error, and invert (swap) two databases.
|
56
74
|
email: nicola51980@gmail.com
|
57
75
|
executables:
|
58
76
|
- mysqlknife
|
59
77
|
extensions: []
|
60
78
|
extra_rdoc_files: []
|
61
79
|
files:
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
62
82
|
- bin/mysqlknife
|
83
|
+
- lib/mysqlknife.rb
|
63
84
|
- lib/mysqlknife/checksum.rb
|
85
|
+
- lib/mysqlknife/cli.rb
|
64
86
|
- lib/mysqlknife/config.rb
|
65
87
|
- lib/mysqlknife/connection.rb
|
66
88
|
- lib/mysqlknife/kill.rb
|
@@ -68,9 +90,6 @@ files:
|
|
68
90
|
- lib/mysqlknife/sql.rb
|
69
91
|
- lib/mysqlknife/swap.rb
|
70
92
|
- lib/mysqlknife/version.rb
|
71
|
-
- lib/mysqlknife.rb
|
72
|
-
- LICENSE.txt
|
73
|
-
- README.md
|
74
93
|
homepage: https://github.com/nicola51980/mysqlknife
|
75
94
|
licenses:
|
76
95
|
- MIT
|
@@ -81,18 +100,19 @@ require_paths:
|
|
81
100
|
- lib
|
82
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
102
|
requirements:
|
84
|
-
- -
|
103
|
+
- - ">="
|
85
104
|
- !ruby/object:Gem::Version
|
86
105
|
version: '0'
|
87
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
107
|
requirements:
|
89
|
-
- -
|
108
|
+
- - ">="
|
90
109
|
- !ruby/object:Gem::Version
|
91
110
|
version: '0'
|
92
111
|
requirements: []
|
93
112
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.4.5
|
95
114
|
signing_key:
|
96
115
|
specification_version: 4
|
97
|
-
summary:
|
116
|
+
summary: MySQL and RDS tools for checksum, kill process, swap and resume replication
|
117
|
+
error.
|
98
118
|
test_files: []
|