fluent-plugin-aerospike-cluster 0.0.1
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/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE +13 -0
- data/README.md +30 -0
- data/Rakefile +6 -0
- data/fluent-plugin-aerospike-cluster.gemspec +26 -0
- data/lib/fluent/plugin/out_aerospike_cluster.rb +115 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f7d9aa2ba159d94825b57d80a1b54f2be9ec854c
|
4
|
+
data.tar.gz: b11901411ce2c033061cc9163aa4f94efdaa47a3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b08a73fe71b49c5595e3c89c54fe94e9bd47bb1c01979c5082a55811f7c84ec19c69b1ab153e9839f80e15459a1b863a584c8709e5adc36200a4904aa01f5836
|
7
|
+
data.tar.gz: d4c59b40489e76f9e84f1400740a15de7ae61987d0bdb7d39df846d128d78be3a23b6191a6efbf3d6c265149a3c1d4ecd58eef57cc944ab63c5d34756d590d32
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (C) 2016 fluent-plugin-aerospike-cluster authors
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# fluent-plugin-aerospike-cluster
|
2
|
+
|
3
|
+
fluent output plugin for aerospike.
|
4
|
+
|
5
|
+
|
6
|
+
## Parameters
|
7
|
+
|
8
|
+
param | type | value | default
|
9
|
+
---------------------|----------|--------------------------------------------------------------------|---------------
|
10
|
+
hosts | string | Aerospike host:port list. (comma separated) | 127.0.0.1:3000
|
11
|
+
username | string | Aerospike username. (not implemented yet) |
|
12
|
+
password | string | Aerospike password. (not implemented yet) |
|
13
|
+
timeout | float | Connection timeout second. | 1.0
|
14
|
+
connection_queue_size| integer | Size of the connection queue cache. | 64
|
15
|
+
tend_interval | float | Tend interval in milliseconds; determines the interval at which the client checks for cluster state changes. Minimum interval is 10ms. | 1000
|
16
|
+
namespace | string | Aerospike namespace. |
|
17
|
+
set | string | Aerospike set. |
|
18
|
+
keys | string | Keys for key of record. |
|
19
|
+
record_keys | string | Keys for Record values. (comma separated) |
|
20
|
+
send_key | bool | Send user defined key in addition to hash digest on a record put. | true
|
21
|
+
ttl | integer | Record ttl seconds. (-1: never expire, 0: default namespace's ttl) | 0
|
22
|
+
record_exists_action | string | Qualify how to handle writes where the record already exists. update update_only replace replace_only |
|
23
|
+
|
24
|
+
## Another Parameters
|
25
|
+
|
26
|
+
- include_tag_key
|
27
|
+
- tag_key
|
28
|
+
- include_time_key
|
29
|
+
- time_key
|
30
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "fluent-plugin-aerospike-cluster"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["kadzuya"]
|
9
|
+
spec.email = ["kadzuya@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{fluent plugin to insert Aerospike.}
|
12
|
+
spec.description = %q{fluent plugin to insert Aerospike.}
|
13
|
+
spec.homepage = "http://github.com/kadzuya/fluent-plugin-aerospike-cluster"
|
14
|
+
spec.license = "Apache-2.0"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "bin"
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "fluentd"
|
22
|
+
spec.add_runtime_dependency "aerospike", '>= 1.0.0'
|
23
|
+
spec.add_development_dependency "bundler"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Fluent
|
2
|
+
class AerospikeClusterOutput < BufferedOutput
|
3
|
+
Fluent::Plugin.register_output('aerospike_cluster', self)
|
4
|
+
include Fluent::SetTagKeyMixin
|
5
|
+
config_set_default :include_tag_key, false
|
6
|
+
|
7
|
+
include Fluent::SetTimeKeyMixin
|
8
|
+
config_set_default :include_time_key, true
|
9
|
+
|
10
|
+
config_param :hosts, :string, :default => '127.0.0.1:3000',
|
11
|
+
:desc => "Aerospike host:port list. (comma separated)"
|
12
|
+
config_param :username, :string, :default => nil,
|
13
|
+
:desc => "Aerospike username. (not implemented yet)"
|
14
|
+
config_param :password, :string, :default => nil,
|
15
|
+
:desc => "Aerospike password. (not implemented yet)"
|
16
|
+
config_param :timeout, :float, :default => 1.0,
|
17
|
+
:desc => "Connection timeout second."
|
18
|
+
config_param :connection_queue_size, :integer, :default => 64,
|
19
|
+
:desc => "Size of the connection queue cache."
|
20
|
+
config_param :tend_interval, :float, :default => 1000,
|
21
|
+
:desc => "Tend interval in milliseconds; determines the interval at which the client checks for cluster state changes. Minimum interval is 10ms."
|
22
|
+
config_param :namespace, :string,
|
23
|
+
:desc => "Aerospike namespace."
|
24
|
+
config_param :set, :string,
|
25
|
+
:desc => "Aerospike set."
|
26
|
+
config_param :keys, :string,
|
27
|
+
:desc => "Keys for key of record."
|
28
|
+
config_param :record_keys, :string,
|
29
|
+
:desc => "Keys for record values. (comma separated)"
|
30
|
+
config_param :send_key, :bool, :default => true,
|
31
|
+
:desc => "Send user defined key in addition to hash digest on a record put."
|
32
|
+
config_param :ttl, :integer, :default => 0,
|
33
|
+
:desc => "Record ttl seconds. (-1: never expire, 0: default namespace's ttl)"
|
34
|
+
config_param :record_exists_action, :string, :default => nil,
|
35
|
+
:desc => <<DESC
|
36
|
+
Qualify how to handle writes where the record already exists.
|
37
|
+
update update_only replace replace_only
|
38
|
+
DESC
|
39
|
+
attr_accessor :client_policy, :write_policy
|
40
|
+
|
41
|
+
def configure(conf)
|
42
|
+
super
|
43
|
+
@hosts = @hosts.split(/\s*,\s*/).map {|host|
|
44
|
+
host = host.split(":")
|
45
|
+
Aerospike::Host.new(host[0], host[1].nil? ? 3000 : host[1].to_i)
|
46
|
+
}
|
47
|
+
@client_policy = Aerospike::ClientPolicy.new({
|
48
|
+
:user => @username,
|
49
|
+
:password => @password,
|
50
|
+
:timeout => @timeout,
|
51
|
+
:connection_queue_size => @connection_queue_size,
|
52
|
+
:tend_interval => @tend_interval
|
53
|
+
})
|
54
|
+
@write_policy = Aerospike::WritePolicy.new({
|
55
|
+
:record_exists_action => @record_exists_action.nil? ? nil : Aerospike::RecordExistsAction.const_get(@record_exists_action.upcase.to_sym),
|
56
|
+
:generation_policy => nil,
|
57
|
+
:generation => nil,
|
58
|
+
:ttl => @ttl,
|
59
|
+
:send_key => @send_key,
|
60
|
+
:commit_level => nil
|
61
|
+
})
|
62
|
+
@keys = @keys.split(/\s*,\s*/)
|
63
|
+
@record_keys = @record_keys.split(/\s*,\s*/)
|
64
|
+
end
|
65
|
+
|
66
|
+
def initialize
|
67
|
+
super
|
68
|
+
require 'aerospike'
|
69
|
+
end
|
70
|
+
|
71
|
+
# Define `log` method for v0.10.42 or earlier
|
72
|
+
unless method_defined?(:log)
|
73
|
+
define_method("log") { $log }
|
74
|
+
end
|
75
|
+
|
76
|
+
def client
|
77
|
+
@handler ||= Aerospike::Client.new_many(@hosts, @client_policy)
|
78
|
+
end
|
79
|
+
|
80
|
+
def start
|
81
|
+
super
|
82
|
+
client
|
83
|
+
end
|
84
|
+
|
85
|
+
def shutdown
|
86
|
+
@handler.close
|
87
|
+
super
|
88
|
+
end
|
89
|
+
|
90
|
+
def format(tag, time, record)
|
91
|
+
[tag, time, record].to_msgpack
|
92
|
+
end
|
93
|
+
|
94
|
+
def write(chunk)
|
95
|
+
log.debug "<<<<<<<<<<<<<<{Aerospike write chunk}<<<<<<<<<<<<<"
|
96
|
+
chunk.msgpack_each do |tag, time, record|
|
97
|
+
# Key
|
98
|
+
if @keys.length == 1
|
99
|
+
key = Aerospike::Key.new(@namespace, @set, record[@keys[0]])
|
100
|
+
else
|
101
|
+
key = Aerospike::Key.new(@namespace, @set, @keys.map {|col| record[col]})
|
102
|
+
end
|
103
|
+
# Value
|
104
|
+
if @record_keys.length > 0
|
105
|
+
record = record.select {|key, _| @record_keys.include? key }
|
106
|
+
end
|
107
|
+
|
108
|
+
log.debug "key: #{key.to_s}"
|
109
|
+
log.debug "value: #{record.to_s}"
|
110
|
+
@handler.put(key, record, @write_policy)
|
111
|
+
end
|
112
|
+
log.debug ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-aerospike-cluster
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kadzuya
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fluentd
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aerospike
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: fluent plugin to insert Aerospike.
|
84
|
+
email:
|
85
|
+
- kadzuya@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- fluent-plugin-aerospike-cluster.gemspec
|
98
|
+
- lib/fluent/plugin/out_aerospike_cluster.rb
|
99
|
+
homepage: http://github.com/kadzuya/fluent-plugin-aerospike-cluster
|
100
|
+
licenses:
|
101
|
+
- Apache-2.0
|
102
|
+
metadata: {}
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubyforge_project:
|
119
|
+
rubygems_version: 2.0.14.1
|
120
|
+
signing_key:
|
121
|
+
specification_version: 4
|
122
|
+
summary: fluent plugin to insert Aerospike.
|
123
|
+
test_files: []
|