mysql_replication_monitor 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Umamibud, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,5 +1,5 @@
1
1
  mysql_replication_monitor
2
- ========
2
+ ---
3
3
 
4
4
  Utility to check the replication status between MySQL master and slave
5
5
  dbs set up to replicate to each other
@@ -9,7 +9,7 @@ config (environment) names (e.g. 'staging_master', 'staging_slave' or
9
9
  whatever).
10
10
 
11
11
  Examples
12
- =========
12
+ ---
13
13
 
14
14
  # specify both master and slave db configs
15
15
  monitor = MysqlReplicationMonitor.new(:master => 'master', :slave => 'slave)
data/TODO ADDED
File without changes
@@ -7,17 +7,16 @@
7
7
  #
8
8
  # examples:
9
9
  #
10
- # # specify both master and slave db configs
11
- # monitor = MysqlReplicationMonitor.new(:master => 'master', :slave => 'slave)
12
- # # default slave to the current environment
13
- # monitor = MysqlReplicationMonitor.new(:master => 'master')
14
- # # override the default time to cache the statuses (in seconds)
15
- # monitor = MysqlReplicationMonitor.new(:master => 'master', :slave => 'slave,
16
- # :refresh_time => 10)
17
- # # override the default database config file (not recommended)
18
- # monitor = MysqlReplicationMonitor.new(:master => 'master', :slave => 'slave,
19
- # :db_config_file => 'foofile.txt')
20
- #
10
+ # # specify both master and slave db configs
11
+ # monitor = MysqlReplicationMonitor.new(:master => 'master', :slave => 'slave)
12
+ # # default slave to the current environment
13
+ # monitor = MysqlReplicationMonitor.new(:master => 'master')
14
+ # # override the default time to cache the statuses (in seconds)
15
+ # monitor = MysqlReplicationMonitor.new(:master => 'master', :slave => 'slave,
16
+ # :refresh_time => 10)
17
+ # # override the default database config file (not recommended)
18
+ # monitor = MysqlReplicationMonitor.new(:master => 'master', :slave => 'slave,
19
+ # :db_config_file => 'foofile.txt')
21
20
  #-------------------------------------------------------------------------------
22
21
  class MysqlReplicationMonitor
23
22
 
@@ -133,6 +132,16 @@ class MysqlReplicationMonitor
133
132
  end
134
133
 
135
134
 
135
+ # returns slave's report of seconds behind master. note: this isn't super-
136
+ # reliable, especially if the I/O thread is not running.
137
+ #-----------------------------------------------------------------------------
138
+ def seconds_behind
139
+ cache_check_or_refresh
140
+
141
+ @slave_status['Seconds_Behind_Master'].to_i
142
+ end
143
+
144
+
136
145
  # return a hashed version of the result of running SHOW SLAVE STATUS
137
146
  # options:
138
147
  # :refresh_if_stale: indicate whether to refresh the status if it's stale
@@ -0,0 +1,46 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{mysql_replication_monitor}
8
+ s.version = "0.1.6"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Brian Percival"]
12
+ s.date = %q{2010-04-09}
13
+ s.description = %q{Connects to both master and slave and compares their status, allowing you to check whether
14
+ the slave is running and whether slave is caught up to master
15
+ }
16
+ s.email = %q{percivalatumamibuddotcom}
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "TODO"
21
+ ]
22
+ s.files = [
23
+ "README.rdoc",
24
+ "lib/mysql_replication_monitor.rb",
25
+ "mysql_replication_monitor.gemspec"
26
+ ]
27
+ s.homepage = %q{http://github.com/bmpercy/mysql_replication_monitor}
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = %q{1.3.5}
31
+ s.summary = %q{a helper class for monitoring replication between two mysql dbs. Rails environment only and depends on multiple_connection_handler.}
32
+
33
+ if s.respond_to? :specification_version then
34
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
35
+ s.specification_version = 3
36
+
37
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
38
+ s.add_runtime_dependency(%q<multiple_connection_handler>, [">= 0"])
39
+ else
40
+ s.add_dependency(%q<multiple_connection_handler>, [">= 0"])
41
+ end
42
+ else
43
+ s.add_dependency(%q<multiple_connection_handler>, [">= 0"])
44
+ end
45
+ end
46
+
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_replication_monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
- - bmpercy
7
+ - Brian Percival
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-02 00:00:00 -08:00
12
+ date: 2010-04-09 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,34 +20,41 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.1.2
23
+ version: "0"
24
24
  version:
25
- description: Simple utility to check replication status between two dbs listed in Rails' database.yml. See README for more info.
26
- email:
25
+ description: |
26
+ Connects to both master and slave and compares their status, allowing you to check whether
27
+ the slave is running and whether slave is caught up to master
28
+
29
+ email: percivalatumamibuddotcom
27
30
  executables: []
28
31
 
29
32
  extensions: []
30
33
 
31
- extra_rdoc_files: []
32
-
34
+ extra_rdoc_files:
35
+ - LICENSE
36
+ - README.rdoc
37
+ - TODO
33
38
  files:
39
+ - README.rdoc
34
40
  - lib/mysql_replication_monitor.rb
35
- - README
36
- - CHANGELOG
41
+ - mysql_replication_monitor.gemspec
42
+ - LICENSE
43
+ - TODO
37
44
  has_rdoc: true
38
- homepage:
45
+ homepage: http://github.com/bmpercy/mysql_replication_monitor
39
46
  licenses: []
40
47
 
41
48
  post_install_message:
42
- rdoc_options: []
43
-
49
+ rdoc_options:
50
+ - --charset=UTF-8
44
51
  require_paths:
45
52
  - lib
46
53
  required_ruby_version: !ruby/object:Gem::Requirement
47
54
  requirements:
48
55
  - - ">="
49
56
  - !ruby/object:Gem::Version
50
- version: 1.8.1
57
+ version: "0"
51
58
  version:
52
59
  required_rubygems_version: !ruby/object:Gem::Requirement
53
60
  requirements:
@@ -61,6 +68,6 @@ rubyforge_project:
61
68
  rubygems_version: 1.3.5
62
69
  signing_key:
63
70
  specification_version: 3
64
- summary: Utility for checking replication status between two dbs in Rails' database.yml
71
+ summary: a helper class for monitoring replication between two mysql dbs. Rails environment only and depends on multiple_connection_handler.
65
72
  test_files: []
66
73
 
data/CHANGELOG DELETED
@@ -1,4 +0,0 @@
1
- 0.1.5
2
- -----
3
- * added option to raw_slave_status to prevent status refreshing since last status call if desired
4
-