fluent-plugin-mysql-replicator 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
## Overview
|
4
4
|
|
5
5
|
Fluentd input plugin to track insert/update/delete event from MySQL database server.
|
6
|
-
Not only that, it could multiple table replication into Elasticsearch/Solr.
|
6
|
+
Not only that, it could multiple table replication into single or multi Elasticsearch/Solr.
|
7
7
|
It's comming support replicate to another RDB/noSQL.
|
8
8
|
|
9
9
|
## Installation
|
@@ -14,8 +14,15 @@ gem install fluent-plugin-mysql-replicator
|
|
14
14
|
|
15
15
|
### td-agent gem
|
16
16
|
/usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-mysql-replicator
|
17
|
+
|
18
|
+
### RPM
|
19
|
+
### package availables at https://github.com/y-ken/yamabiko/releases
|
17
20
|
`````
|
18
21
|
|
22
|
+
**Note:** RPM package available which does not conflict system installed Ruby or td-agent.
|
23
|
+
https://github.com/y-ken/yamabiko/releases
|
24
|
+
|
25
|
+
|
19
26
|
## Included plugins
|
20
27
|
|
21
28
|
* Input Plugin: mysql_replicator
|
@@ -112,8 +119,10 @@ On syncing 300 million rows table, it will consume around 800MB of memory with r
|
|
112
119
|
# Set frequency of sending bulk request to Elasticsearch node.
|
113
120
|
flush_interval 5s
|
114
121
|
|
115
|
-
# Queued chunks are flushed at shutdown process.
|
122
|
+
# Queued chunks are flushed at shutdown process. (recommend for more stability)
|
116
123
|
flush_at_shutdown yes
|
124
|
+
buffer_type file
|
125
|
+
buffer_path /var/log/td-agent/buffer/mysql_replicator_elasticsearch
|
117
126
|
</store>
|
118
127
|
</match>
|
119
128
|
`````
|
@@ -186,9 +195,9 @@ VALUES
|
|
186
195
|
|
187
196
|
it is a sample which you have inserted row.
|
188
197
|
|
189
|
-
| id | is_active | name | host | port | username | password | database | query | interval | primary_key | enable_delete |enable_loose_insert |enable_loose_delete |
|
190
|
-
|
191
|
-
| 1 | 1 | mydb.mytable | 192.168.100.221 | 3306 | mysqluser | mysqlpassword | mydb | SELECT id, text from mytable; | 5 | id | 1 |
|
198
|
+
| id | is_active | name | host | port | username | password | database | query | interval | primary_key | enable_delete | enable_loose_insert | enable_loose_delete |
|
199
|
+
|----|-----------|--------------|-----------------|------|-----------|---------------|----------|------------------------------|----------|-------------|---------------|----|----|
|
200
|
+
| 1 | 1 | mydb.mytable | 192.168.100.221 | 3306 | mysqluser | mysqlpassword | mydb | SELECT id, text from mytable; | 5 | id | 1 | 0 | 0 |
|
192
201
|
|
193
202
|
### configuration
|
194
203
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "fluent-plugin-mysql-replicator"
|
4
|
-
s.version = "0.3.
|
4
|
+
s.version = "0.3.1"
|
5
5
|
s.authors = ["Kentaro Yoshida"]
|
6
6
|
s.email = ["y.ken.studio@gmail.com"]
|
7
7
|
s.homepage = "https://github.com/y-ken/fluent-plugin-mysql-replicator"
|
@@ -20,7 +20,6 @@ module Fluent
|
|
20
20
|
|
21
21
|
def configure(conf)
|
22
22
|
super
|
23
|
-
@reconnect_interval = Config.time_value('10sec')
|
24
23
|
if @tag.nil?
|
25
24
|
raise Fluent::ConfigError, "mysql_replicator_multi: missing 'tag' parameter. Please add following line into config like 'tag replicator.${name}.${event}.${primary_key}'"
|
26
25
|
end
|
@@ -243,10 +242,8 @@ module Fluent
|
|
243
242
|
:stream => false,
|
244
243
|
:cache_rows => false
|
245
244
|
)
|
246
|
-
rescue
|
247
|
-
|
248
|
-
sleep @reconnect_interval
|
249
|
-
retry
|
245
|
+
rescue Mysql2::Error => e
|
246
|
+
raise "mysql_replicator_multi: #{e}"
|
250
247
|
end
|
251
248
|
end
|
252
249
|
|
@@ -263,10 +260,8 @@ module Fluent
|
|
263
260
|
:stream => true,
|
264
261
|
:cache_rows => false
|
265
262
|
)
|
266
|
-
rescue
|
267
|
-
|
268
|
-
sleep @reconnect_interval
|
269
|
-
retry
|
263
|
+
rescue Mysql2::Error => e
|
264
|
+
raise "mysql_replicator_multi: #{e}"
|
270
265
|
end
|
271
266
|
end
|
272
267
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rsolr'
|
2
|
+
require 'uri'
|
2
3
|
|
3
4
|
class Fluent::MysqlReplicatorSolrOutput < Fluent::BufferedOutput
|
4
5
|
Fluent::Plugin.register_output('mysql_replicator_solr', self)
|
@@ -42,7 +43,7 @@ class Fluent::MysqlReplicatorSolrOutput < Fluent::BufferedOutput
|
|
42
43
|
tag_parts = tag.match(@tag_format)
|
43
44
|
id_key = tag_parts['primary_key']
|
44
45
|
core_name = tag_parts['core_name'].nil? ? '' : tag_parts['core_name']
|
45
|
-
url = "http://#{@host}:#{@port}/solr/#{core_name}"
|
46
|
+
url = "http://#{@host}:#{@port}/solr/#{URI.escape(core_name)}"
|
46
47
|
solr_connection[url] = RSolr.connect(:url => url) if solr_connection[url].nil?
|
47
48
|
if tag_parts['event'] == 'delete'
|
48
49
|
solr_connection[url].delete_by_id record[id_key]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mysql-replicator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|