binlog-server 1.0.0-java
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.
- checksums.yaml +7 -0
- data/README.md +62 -0
- data/Rakefile +2 -0
- data/binlog-server.gemspec +28 -0
- data/example/server.rb +60 -0
- data/lib/binlog/version.rb +3 -0
- data/lib/binlog-server.rb +8 -0
- data/target/binlog-server-1.0.0.jar +0 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8068ff5855601d667a1549e0290db5f1c37e32a2
|
4
|
+
data.tar.gz: 44658257e1ad786807bac2464fccbe4a82c039aa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea37aa377a1855d7285ea7b47e1ea4780eb47f9551998bb6e16532140fc0ef080547020d2de3bb0b8d24eb1b7bd12180465a40a1b3852ae9679e740f1fc9bb18
|
7
|
+
data.tar.gz: 37b411efcf9c71ee4e3946ff784c47d32685640268ba80adac6c8981157e0dc8a47022be73e082d03d1a9efa9d5f01175217ea80f0fb636f41396f09ec529d39
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Binlog
|
2
|
+
|
3
|
+
A gem that allows you to parse mysql binlog row events so you can manipulate the stream of
|
4
|
+
changes. We are using this to build a real time reporting database.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'binlog-server'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install binlog-server
|
21
|
+
|
22
|
+
## Building
|
23
|
+
|
24
|
+
$ mvn package
|
25
|
+
$ rake build
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'rubygems'
|
31
|
+
require 'bundler/setup'
|
32
|
+
|
33
|
+
class MyPositionCheckpointer
|
34
|
+
include Binlog::PositionCheckpointer
|
35
|
+
|
36
|
+
# implement the interface here
|
37
|
+
end
|
38
|
+
|
39
|
+
class MyRowEventListener
|
40
|
+
include Binlog::RowEventListener
|
41
|
+
|
42
|
+
# implement the interface here
|
43
|
+
end
|
44
|
+
|
45
|
+
server = Binlog::RowServer.new
|
46
|
+
server.user = 'replicate'
|
47
|
+
server.password = 'test1234'
|
48
|
+
server.host = 'localhost'
|
49
|
+
server.port = 3306
|
50
|
+
server.serverId = 10
|
51
|
+
server.checkpointer = MyPositionCheckpointer.new('mysql-bin.000007', 6957)
|
52
|
+
server.listener = MyRowEventListener.new
|
53
|
+
server.start
|
54
|
+
```
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
1. Fork it ( https://github.com/greenbits/binlog-server/fork )
|
59
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
60
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
61
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
62
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'binlog/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "binlog-server"
|
8
|
+
spec.version = Binlog::VERSION
|
9
|
+
spec.authors = ["Ben Curren"]
|
10
|
+
spec.email = ["ben@greenbits.com"]
|
11
|
+
spec.summary = %q{MySQL row based replication binlog server based on open replication.}
|
12
|
+
spec.description = %q{MySQL row based replication binlog server based on open replication.}
|
13
|
+
spec.homepage = "http://github.com/greenbits/binlog-server"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.platform = 'java'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z *.rb`.split("\x0") +
|
18
|
+
Dir['target/binlog-server*.jar'] +
|
19
|
+
`git ls-files -z *.gemspec`.split("\x0") +
|
20
|
+
`git ls-files -z Rakefile`.split("\x0") +
|
21
|
+
`git ls-files -z *.md`.split("\x0")
|
22
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
|
+
spec.require_paths = ["target", "lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
end
|
data/example/server.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'binlog-server'
|
3
|
+
|
4
|
+
class MyPositionCheckpointer
|
5
|
+
attr_reader :file_name, :position
|
6
|
+
include Binlog::PositionCheckpointer
|
7
|
+
|
8
|
+
def initialize(file_name, position)
|
9
|
+
rotate(file_name, position)
|
10
|
+
end
|
11
|
+
|
12
|
+
def rotate(file_name, position)
|
13
|
+
@file_name = file_name
|
14
|
+
@position = position
|
15
|
+
puts "rotate: #{@file_name}, #{@position}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def checkpoint(position)
|
19
|
+
@position = position
|
20
|
+
puts "checkpoint: #{@position}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class MyRowEventListener
|
25
|
+
include Binlog::RowEventListener
|
26
|
+
|
27
|
+
def startup(version)
|
28
|
+
puts "Startup"
|
29
|
+
end
|
30
|
+
|
31
|
+
def begin_transaction
|
32
|
+
puts "Begin transaction"
|
33
|
+
end
|
34
|
+
|
35
|
+
def update(event)
|
36
|
+
puts "Update"
|
37
|
+
end
|
38
|
+
|
39
|
+
def write(event)
|
40
|
+
puts "Write"
|
41
|
+
end
|
42
|
+
|
43
|
+
def delete(event)
|
44
|
+
puts "Delete"
|
45
|
+
end
|
46
|
+
|
47
|
+
def commit_transaction
|
48
|
+
puts "Commit Transaction"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
server = Binlog::RowServer.new
|
53
|
+
server.user = 'replicate'
|
54
|
+
server.password = 'test1234'
|
55
|
+
server.host = 'localhost'
|
56
|
+
server.port = 3306
|
57
|
+
server.serverId = 10
|
58
|
+
server.checkpointer = MyPositionCheckpointer.new('mysql-bin.000007', 6957)
|
59
|
+
server.listener = MyRowEventListener.new
|
60
|
+
server.start
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: binlog-server
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: java
|
6
|
+
authors:
|
7
|
+
- Ben Curren
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ~>
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.6'
|
19
|
+
name: bundler
|
20
|
+
prerelease: false
|
21
|
+
type: :development
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '10.0'
|
33
|
+
name: rake
|
34
|
+
prerelease: false
|
35
|
+
type: :development
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: MySQL row based replication binlog server based on open replication.
|
42
|
+
email:
|
43
|
+
- ben@greenbits.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- example/server.rb
|
49
|
+
- lib/binlog-server.rb
|
50
|
+
- lib/binlog/version.rb
|
51
|
+
- target/binlog-server-1.0.0.jar
|
52
|
+
- binlog-server.gemspec
|
53
|
+
- Rakefile
|
54
|
+
- README.md
|
55
|
+
homepage: http://github.com/greenbits/binlog-server
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- target
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.1.9
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: MySQL row based replication binlog server based on open replication.
|
80
|
+
test_files: []
|