repctl 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/{mysql.thor → repctl} +14 -33
- data/lib/repctl/version.rb +1 -1
- metadata +9 -9
data/bin/{mysql.thor → repctl}
RENAMED
@@ -1,5 +1,8 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require 'socket'
|
2
4
|
require 'repctl'
|
5
|
+
require 'thor'
|
3
6
|
|
4
7
|
# Thor has the 'helpful' property that any Thor task gets executed only
|
5
8
|
# once. The 'Helpers' module makes many Thor tasks available as ordinary
|
@@ -99,7 +102,7 @@ module Helpers
|
|
99
102
|
end # Module helpers
|
100
103
|
|
101
104
|
class Mysql < Thor
|
102
|
-
|
105
|
+
|
103
106
|
include Thor::Actions
|
104
107
|
include Repctl::Config
|
105
108
|
include Repctl::Commands
|
@@ -248,16 +251,6 @@ class Mysql < Thor
|
|
248
251
|
do_restore(slave, dumpfile)
|
249
252
|
end
|
250
253
|
|
251
|
-
end
|
252
|
-
|
253
|
-
class Utils < Thor
|
254
|
-
|
255
|
-
include Thor::Actions
|
256
|
-
include Repctl::Config
|
257
|
-
include Repctl::Commands
|
258
|
-
include Repctl::Servers
|
259
|
-
include Helpers
|
260
|
-
|
261
254
|
DEFAULT_MASTER = 1
|
262
255
|
|
263
256
|
desc "bench [INSTANCE] [PROPS]", "Run the Tungsten Bristlecone benchmarker.
|
@@ -270,10 +263,8 @@ class Utils < Thor
|
|
270
263
|
run("#{BENCHMARK} -props #{props}", :verbose => true, :capture => false)
|
271
264
|
end
|
272
265
|
|
273
|
-
desc "create_db [INSTANCE] [DBNAME]",
|
274
|
-
|
275
|
-
and DBNAME defaults to "widgets".
|
276
|
-
EOS
|
266
|
+
desc "create_db [INSTANCE] [DBNAME]", "Create a database on a MySQL instance.
|
267
|
+
INSTANCE defaults to DEFAULT_MASTER, and DBNAME defaults to \"widgets\"."
|
277
268
|
method_option :replace, :type => :boolean, :aliases => "-r",
|
278
269
|
:desc => "drop and recreate the database"
|
279
270
|
def create_db(instance = DEFAULT_MASTER, dbname = "widgets")
|
@@ -281,10 +272,9 @@ class Utils < Thor
|
|
281
272
|
run_mysql_query(instance, "CREATE DATABASE IF NOT EXISTS #{dbname}")
|
282
273
|
end
|
283
274
|
|
284
|
-
desc "create_tbl [INSTANCE] [DBNAME] [TBLNAME]",
|
285
|
-
|
286
|
-
to "widgets" and TBLNAME defaults to "users". The table schema is fixed.
|
287
|
-
EOS
|
275
|
+
desc "create_tbl [INSTANCE] [DBNAME] [TBLNAME]", "Create a database table."
|
276
|
+
"INSTANCE defaults to DEFAULT_MASTER, DBNAME defaults
|
277
|
+
to \"widgets\" and TBLNAME defaults to \"users\". The table schema is fixed."
|
288
278
|
method_option :replace, :type => :boolean, :aliases => "-r",
|
289
279
|
:desc => "drop and recreate the table"
|
290
280
|
def create_tbl(instance = DEFAULT_MASTER, dbname = "widgets", tblname = "users")
|
@@ -304,10 +294,10 @@ class Utils < Thor
|
|
304
294
|
run_mysql_query(instance, cmd)
|
305
295
|
end
|
306
296
|
|
307
|
-
desc "gen_rows [INSTANCE], [DBNAME], [TBLNAME]",
|
308
|
-
|
309
|
-
to DEFAULT_MASTER, DBNAME defaults to "widgets", and TBLNAME defaults
|
310
|
-
|
297
|
+
desc "gen_rows [INSTANCE], [DBNAME], [TBLNAME]", "Add rows to a table that
|
298
|
+
was created by \"utils:create_tbl\". INSTANCE defaults
|
299
|
+
to DEFAULT_MASTER, DBNAME defaults to \"widgets\", and TBLNAME defaults
|
300
|
+
to \"users\"."
|
311
301
|
method_option :delay, :type => :numeric, :aliases => "-d", :default => 0,
|
312
302
|
:desc => "sleep for the specified number of milliseconds between row inserts."
|
313
303
|
method_option :count, :type => :numeric, :aliases => "-c", :default => 1000,
|
@@ -347,16 +337,6 @@ class Utils < Thor
|
|
347
337
|
|
348
338
|
end
|
349
339
|
|
350
|
-
end
|
351
|
-
|
352
|
-
class Setup < Thor
|
353
|
-
|
354
|
-
include ::Thor::Actions
|
355
|
-
include Repctl::Config
|
356
|
-
include Repctl::Commands
|
357
|
-
include Repctl::Servers
|
358
|
-
include Helpers
|
359
|
-
|
360
340
|
#
|
361
341
|
# Setting Up Replication with New Master and Slaves.
|
362
342
|
# Here, we stop all MySQL servers, remove the data directories, reinitialize
|
@@ -429,3 +409,4 @@ class Setup < Thor
|
|
429
409
|
|
430
410
|
end
|
431
411
|
|
412
|
+
Mysql.start
|
data/lib/repctl/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repctl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-26 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &205152340 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *205152340
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &205150660 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *205150660
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mysql2
|
38
|
-
requirement: &
|
38
|
+
requirement: &205149240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,12 +43,12 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *205149240
|
47
47
|
description: Ruby gem with Thor script to manage MySQL and PostgreSQL replication
|
48
48
|
email:
|
49
49
|
- lydianblues@gmail.com
|
50
50
|
executables:
|
51
|
-
-
|
51
|
+
- repctl
|
52
52
|
extensions: []
|
53
53
|
extra_rdoc_files: []
|
54
54
|
files:
|
@@ -56,7 +56,7 @@ files:
|
|
56
56
|
- Gemfile
|
57
57
|
- README.md
|
58
58
|
- Rakefile
|
59
|
-
- bin/
|
59
|
+
- bin/repctl
|
60
60
|
- config/bristlecone.properties
|
61
61
|
- config/config.rb
|
62
62
|
- config/mysql.cnf
|