neo4j 2.2.1-java → 2.2.3-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +10 -0
- data/config/neo4j/config.yml +72 -76
- data/lib/neo4j/rails/ha_console/railtie.rb +11 -6
- data/lib/neo4j/rails/rack_middleware.rb +1 -0
- data/lib/neo4j/rails/relationship_persistence.rb +6 -5
- data/lib/neo4j/version.rb +1 -1
- data/neo4j.gemspec +1 -1
- metadata +4 -11
- data/lib/neo4j/rails/ha_console.rb +0 -0
- data/lib/neo4j/rails/ha_console/ha_console.rb +0 -68
- data/lib/neo4j/rails/ha_console/zookeeper/clean.sh +0 -4
- data/lib/neo4j/rails/ha_console/zookeeper/conf/server1.cfg +0 -11
- data/lib/neo4j/rails/ha_console/zookeeper/data/zookeeper1/myid +0 -1
- data/lib/neo4j/rails/ha_console/zookeeper/start_zookeeper.sh +0 -17
- data/lib/neo4j/rails/ha_console/zookeeper/zookeeper.rb +0 -62
data/CHANGELOG
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
== 2.2.3 / 2012-12-28
|
2
|
+
* Support for HA cluster with neo4j 1.9.X, #228, #99, #223
|
3
|
+
* Make sure the Identity map is cleared after an exception, #214
|
4
|
+
* Relationship other_node should return wrapped node, #226
|
5
|
+
* Automatically convert DateTimes to UTC, (neo4j-wrapper #7)
|
6
|
+
* get_or_create should return a wrapped node (neo4j-wrapper #8)
|
7
|
+
* Make it work with Neo4j 1.7.1 (neo4j-core, #19)
|
8
|
+
|
9
|
+
== 2.2.2 - skipped
|
10
|
+
|
1
11
|
== 2.2.1 / 2012-12-18
|
2
12
|
* Fix for JRuby 1.7.1 and Equal #225
|
3
13
|
* Fix for create nodes and relationship using Cypher (neo4j-core #17)
|
data/config/neo4j/config.yml
CHANGED
@@ -24,79 +24,75 @@ lucene: { fulltext: { provider: lucene,
|
|
24
24
|
type: exact}
|
25
25
|
}
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
ha.
|
37
|
-
|
38
|
-
#
|
39
|
-
#
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
#
|
51
|
-
|
52
|
-
|
53
|
-
#
|
54
|
-
|
55
|
-
#
|
56
|
-
#
|
57
|
-
|
58
|
-
neostore.
|
59
|
-
neostore.
|
60
|
-
neostore.propertystore.db.mapped_memory:
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
#
|
73
|
-
#
|
74
|
-
|
75
|
-
#
|
76
|
-
|
77
|
-
|
78
|
-
#
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
#maximum size (number of relationship) of node cache. If adaptive cache is
|
101
|
-
#not in use the relationship cache will not be increased above this value
|
102
|
-
max_relationship_cache_size: 3500
|
27
|
+
## If online backup should be available, if it is the Online JAR file will be loaded,
|
28
|
+
## Notice it must be either 'true' or 'false' as string
|
29
|
+
#enable_online_backup: 'false'
|
30
|
+
#
|
31
|
+
##use the clustered Neo4j GraphDatabase (org.neo4j.kernel.HighlyAvailableGraphDatabase)
|
32
|
+
#ha.db: false
|
33
|
+
#
|
34
|
+
## Example of HA Configuration, see http://wiki.neo4j.org/content/High_Availability_Cluster
|
35
|
+
## This is only used when ha.db is set to true
|
36
|
+
#ha.server_id: 2
|
37
|
+
#ha.server: 'localhost:6002'
|
38
|
+
#ha.coordinators: 'localhost:2181,localhost:2182,localhost:2183'
|
39
|
+
#
|
40
|
+
## if enabled you can use the bin/neo4j-shell command to access the database
|
41
|
+
#enable_remote_shell: "port=9332"
|
42
|
+
#
|
43
|
+
##===Memory mapped I/O settings===
|
44
|
+
#
|
45
|
+
##Each file in the Neo store can use memory mapped I/O for reading/writing.
|
46
|
+
##Best performance is achived if the full file can be memory mapped but if
|
47
|
+
##there isn't enough memory for that Neo will try and make the best use of
|
48
|
+
##the memory it gets (regions of the file that get accessed often will more
|
49
|
+
##likley be memory mapped).
|
50
|
+
#
|
51
|
+
##For high traversal speed it is important to have the nodestore.db and
|
52
|
+
##relationshipstore.db files.
|
53
|
+
#
|
54
|
+
#neostore.nodestore.db.mapped_memory: 25M
|
55
|
+
#neostore.relationshipstore.db.mapped_memory: 50M
|
56
|
+
#neostore.propertystore.db.mapped_memory: 90M
|
57
|
+
#neostore.propertystore.db.index.mapped_memory: 1M
|
58
|
+
#neostore.propertystore.db.index.keys.mapped_memory: 1M
|
59
|
+
#neostore.propertystore.db.strings.mapped_memory: 130M
|
60
|
+
#neostore.propertystore.db.arrays.mapped_memory: 130M
|
61
|
+
#
|
62
|
+
#
|
63
|
+
##: ": ": "Cache settings: ": ": "
|
64
|
+
#
|
65
|
+
##use adaptive caches YES|NO. Let Neo try make best use of available heap.
|
66
|
+
#use_adaptive_cache: YES
|
67
|
+
#
|
68
|
+
##heap usage/max heap size ratio. Neo will increase caches while ratio
|
69
|
+
##is less and decrease if greater. Default 0.77 seems to be a good over
|
70
|
+
##all ratio of heap usage to avoid GC trashing. Larger heaps may allow for
|
71
|
+
##a higher ratio while tiny heaps may need even less.
|
72
|
+
#adaptive_cache_heap_ratio: 0.77
|
73
|
+
#
|
74
|
+
##how aggressive Neo will decrease caches once heap ratio reached
|
75
|
+
#adaptive_cache_manager_decrease_ratio: 1.15
|
76
|
+
#
|
77
|
+
##how aggresive Neo will increase caches if ratio isn't yet reached
|
78
|
+
#adaptive_cache_manager_increase_ratio: 1.1
|
79
|
+
#
|
80
|
+
##if no requests are made to Neo this is the amount of time in ms Neo will wait
|
81
|
+
##before it checks the heap usage and adapts the caches if needed
|
82
|
+
#adaptive_cache_worker_sleep_time: 3000
|
83
|
+
#
|
84
|
+
##minimum size (number of nodes) of node cache. If adaptive cache is in use
|
85
|
+
##node cache will not be decreased under this value
|
86
|
+
#min_node_cache_size: 0
|
87
|
+
#
|
88
|
+
##minimum size (number of relationships) of relationship cache. If adaptive
|
89
|
+
##cache is in use relationship cache will not be decreased under this value
|
90
|
+
#min_relationship_cache_size: 0
|
91
|
+
#
|
92
|
+
##maximum size (number of nodes) of node cache. If adaptive cache is not in
|
93
|
+
##use the node cache will not be increased above this value
|
94
|
+
#max_node_cache_size: 1500
|
95
|
+
#
|
96
|
+
##maximum size (number of relationship) of node cache. If adaptive cache is
|
97
|
+
##not in use the relationship cache will not be increased above this value
|
98
|
+
#max_relationship_cache_size: 3500
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require File.expand_path('../ha_console', __FILE__)
|
2
|
-
|
3
1
|
module Neo4j
|
4
2
|
|
5
3
|
module Rails
|
@@ -9,11 +7,18 @@ module Neo4j
|
|
9
7
|
# Include this in your config/application.rb in order to run a rails console
|
10
8
|
# It avoids the Neo4j limitation of only having one process accessing the database by using HA clustering/neo4j-enterprise
|
11
9
|
class Railtie < Object::Rails::Railtie
|
10
|
+
|
12
11
|
config.before_configuration do
|
13
|
-
|
14
|
-
|
15
|
-
config.neo4j.
|
16
|
-
|
12
|
+
server_id = ((defined? IRB) || (defined? Pry)) ? 2 : 1
|
13
|
+
config.neo4j['enable_ha'] = true
|
14
|
+
config.neo4j['ha.server_id'] = server_id
|
15
|
+
config.neo4j['ha.server'] = "localhost:600#{server_id}"
|
16
|
+
config.neo4j['ha.pull_interval'] = '500ms'
|
17
|
+
config.neo4j['ha.discovery.enabled'] = false
|
18
|
+
config.neo4j['ha.initial_hosts'] = [1,2,3].map{|id| "localhost:500#{id}"}.join(',')
|
19
|
+
config.neo4j['ha.cluster_server'] = "localhost:500#{server_id}"
|
20
|
+
config.neo4j.storage_path = File.expand_path("db/ha_neo_#{server_id}", Object::Rails.root)
|
21
|
+
puts "Config HA cluster, ha.server_id: #{config.neo4j['ha.server_id']}, db: #{config.neo4j.storage_path}"
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
@@ -41,11 +41,12 @@ module Neo4j
|
|
41
41
|
|
42
42
|
# @see http://rdoc.info/github/andreasronge/neo4j-core/Neo4j/Core/Relationship#other_node-instance_method
|
43
43
|
def other_node(node)
|
44
|
-
if persisted?
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
n = if persisted?
|
45
|
+
_java_rel._other_node(node._java_entity)
|
46
|
+
else
|
47
|
+
@_start_node == node ? @_end_node : @_start_node
|
48
|
+
end
|
49
|
+
n && n.wrapper
|
49
50
|
end
|
50
51
|
|
51
52
|
# Returns the start node which can be unpersisted
|
data/lib/neo4j/version.rb
CHANGED
data/neo4j.gemspec
CHANGED
@@ -32,5 +32,5 @@ It comes included with the Apache Lucene document database.
|
|
32
32
|
s.add_dependency('orm_adapter', ">= 0.0.3")
|
33
33
|
s.add_dependency("activemodel", ">= 3.0.0", "< 3.3")
|
34
34
|
s.add_dependency("railties", ">= 3.0.0", "< 3.3")
|
35
|
-
s.add_dependency("neo4j-wrapper", '2.2.
|
35
|
+
s.add_dependency("neo4j-wrapper", '2.2.3')
|
36
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: java
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: orm_adapter
|
@@ -81,13 +81,13 @@ dependencies:
|
|
81
81
|
requirements:
|
82
82
|
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 2.2.
|
84
|
+
version: 2.2.3
|
85
85
|
none: false
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 2.2.
|
90
|
+
version: 2.2.3
|
91
91
|
none: false
|
92
92
|
prerelease: false
|
93
93
|
type: :runtime
|
@@ -149,7 +149,6 @@ files:
|
|
149
149
|
- lib/neo4j/rails/column.rb
|
150
150
|
- lib/neo4j/rails/compositions.rb
|
151
151
|
- lib/neo4j/rails/finders.rb
|
152
|
-
- lib/neo4j/rails/ha_console.rb
|
153
152
|
- lib/neo4j/rails/has_n.rb
|
154
153
|
- lib/neo4j/rails/identity.rb
|
155
154
|
- lib/neo4j/rails/model.rb
|
@@ -167,13 +166,7 @@ files:
|
|
167
166
|
- lib/neo4j/rails/transaction.rb
|
168
167
|
- lib/neo4j/rails/tx_methods.rb
|
169
168
|
- lib/neo4j/rails/validations.rb
|
170
|
-
- lib/neo4j/rails/ha_console/ha_console.rb
|
171
169
|
- lib/neo4j/rails/ha_console/railtie.rb
|
172
|
-
- lib/neo4j/rails/ha_console/zookeeper/clean.sh
|
173
|
-
- lib/neo4j/rails/ha_console/zookeeper/start_zookeeper.sh
|
174
|
-
- lib/neo4j/rails/ha_console/zookeeper/zookeeper.rb
|
175
|
-
- lib/neo4j/rails/ha_console/zookeeper/conf/server1.cfg
|
176
|
-
- lib/neo4j/rails/ha_console/zookeeper/data/zookeeper1/myid
|
177
170
|
- lib/neo4j/rails/relationships/node_dsl.rb
|
178
171
|
- lib/neo4j/rails/relationships/relationships.rb
|
179
172
|
- lib/neo4j/rails/relationships/rels_dsl.rb
|
File without changes
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'neo4j-enterprise'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'tmpdir'
|
4
|
-
|
5
|
-
module Neo4j
|
6
|
-
|
7
|
-
module Rails
|
8
|
-
|
9
|
-
# Configures Neo4j HA and Zookeeper in order to be used from a rails console
|
10
|
-
# @see Railtie
|
11
|
-
module HaConsole
|
12
|
-
class << self
|
13
|
-
def machine_id
|
14
|
-
(defined? IRB) ? 2 : 1
|
15
|
-
end
|
16
|
-
|
17
|
-
def proj_root
|
18
|
-
Object::Rails.root
|
19
|
-
end
|
20
|
-
|
21
|
-
def storage_path(id = machine_id)
|
22
|
-
File.expand_path("db/ha_neo_#{id}", proj_root)
|
23
|
-
end
|
24
|
-
|
25
|
-
def config_machine(id = machine_id)
|
26
|
-
puts "config_machine #{id}"
|
27
|
-
# override this default config with this machine configuration
|
28
|
-
Neo4j.config['ha.db'] = true
|
29
|
-
Neo4j.config['ha.server_id'] = id
|
30
|
-
Neo4j.config['ha.server'] = "localhost:600#{machine_id}"
|
31
|
-
Neo4j.config['ha.pull_interval'] = "2"
|
32
|
-
Neo4j.config[:storage_path] = storage_path(id)
|
33
|
-
|
34
|
-
copy_config unless File.exist?(config_dir)
|
35
|
-
require "#{config_dir}/zookeeper"
|
36
|
-
end
|
37
|
-
|
38
|
-
def config_dir
|
39
|
-
File.expand_path("neo4j_ha_console/zookeeper", Dir.tmpdir)
|
40
|
-
end
|
41
|
-
|
42
|
-
def copy_config
|
43
|
-
source_dir = File.expand_path("zookeeper", File.dirname(__FILE__))
|
44
|
-
system("mkdir -p #{File.expand_path("..", config_dir)}")
|
45
|
-
system("cp -r #{source_dir} #{config_dir}")
|
46
|
-
end
|
47
|
-
|
48
|
-
def zookeeper_running?
|
49
|
-
Zookeeper.pid_file?
|
50
|
-
end
|
51
|
-
|
52
|
-
def start_zookeeper
|
53
|
-
Zookeeper.start unless zookeeper_running?
|
54
|
-
end
|
55
|
-
|
56
|
-
def shutdown_zookeeper
|
57
|
-
if zookeeper_running?
|
58
|
-
Zookeeper.shutdown
|
59
|
-
else
|
60
|
-
puts "Can't shutdown zookeeper - no PID file found for zookeeper process at #{Zookeeper.pid_file}"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
1
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
# Only follow symlinks if readlink supports it
|
4
|
-
if readlink -f "$0" > /dev/null 2>&1
|
5
|
-
then
|
6
|
-
ZOOBIN=`readlink -f "$0"`
|
7
|
-
else
|
8
|
-
ZOOBIN="$0"
|
9
|
-
fi
|
10
|
-
|
11
|
-
ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
|
12
|
-
|
13
|
-
ZOOBINDIR=`dirname "$ZOOBIN"`
|
14
|
-
JARDIR=`cd "${ZOOBINDIR}/lib"; pwd`
|
15
|
-
|
16
|
-
CLASSPATH=$JARDIR/log4j-1.2.16.jar:$JARDIR/zookeeper-3.3.2.jar
|
17
|
-
java -cp "$CLASSPATH" $ZOOMAIN conf/server1.cfg
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module Neo4j
|
2
|
-
module Rails
|
3
|
-
module HaConsole
|
4
|
-
module Zookeeper
|
5
|
-
class << self
|
6
|
-
def shutdown
|
7
|
-
return unless pid_file?
|
8
|
-
file = File.open(pid_file, "rb")
|
9
|
-
pid = file.read.to_s.chomp
|
10
|
-
IO.popen("pkill -TERM -P #{pid}")
|
11
|
-
puts "Zookeeper: shutdown #{pid}"
|
12
|
-
system("rm -f #{pid_file}")
|
13
|
-
end
|
14
|
-
|
15
|
-
def clean
|
16
|
-
dir = File.expand_path("data/zookeeper1/version-2", File.dirname(__FILE__))
|
17
|
-
puts "Zookeeper: clean #{dir}"
|
18
|
-
system("rm -rf #{dir}")
|
19
|
-
end
|
20
|
-
|
21
|
-
def pid_file
|
22
|
-
File.expand_path("zookeeper.pid", File.dirname(__FILE__)).to_s
|
23
|
-
end
|
24
|
-
|
25
|
-
def pid_file?
|
26
|
-
x = File.exist?(pid_file)
|
27
|
-
puts "Zookeeper: pid file #{x} at #{pid_file}"
|
28
|
-
x
|
29
|
-
end
|
30
|
-
|
31
|
-
def lib_dir
|
32
|
-
File.expand_path("lib", File.dirname(__FILE__))
|
33
|
-
end
|
34
|
-
|
35
|
-
def copy_jars
|
36
|
-
puts "Zookeeper: Copy JARs"
|
37
|
-
files = $CLASSPATH.find_all{|x| x =~ /\.jar$/}.collect{|y| y.sub('file:', '')}
|
38
|
-
zookeeper = files.find{|f| f =~ /\/zookeeper/}
|
39
|
-
raise "zookeper JAR not found in a GEM, did you forget to include neo4j-enterprise in your Gemfile (development)" unless zookeeper
|
40
|
-
|
41
|
-
log4j = files.find{|f| f =~ /\/log4j/}
|
42
|
-
raise "log4j not found in a GEM, did you forget to include neo4j-enterprise in your Gemfile (development)" unless log4j
|
43
|
-
|
44
|
-
|
45
|
-
system("mkdir -p #{lib_dir}")
|
46
|
-
FileUtils.cp(zookeeper, lib_dir)
|
47
|
-
FileUtils.cp(log4j, lib_dir)
|
48
|
-
end
|
49
|
-
|
50
|
-
def start
|
51
|
-
puts "Zookeeper: start, check jars?"
|
52
|
-
copy_jars unless File.exist?(lib_dir)
|
53
|
-
zookeeper_exec = File.expand_path("start_zookeeper.sh", File.dirname(__FILE__)).to_s
|
54
|
-
Dir.chdir(File.dirname(__FILE__))
|
55
|
-
pipe = IO.popen(zookeeper_exec)
|
56
|
-
File.open(pid_file, 'w') { |f| f.write(pipe.pid) }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|