嵌入式neo4j与tinkerpop - 相同的实例,多重访问

时间:2014-09-15 18:41:40

标签: neo4j tinkerpop

我看到'blueprints-neo4j-graph-2.5.0'是使用tinkerpop blueprints api和neo4j图形版本1.9.6的最新发布版本。

关于这个问题:

  1. 据我所知,这个neo4j实例将是一个带有社区版本的嵌入式数据库。是对的吗?如果是这样,我该如何切换到企业版?

    我尝试将其包含为gradle依赖项:compile group:'org.neo4j',name:'neo4j-enterprise',version:'2.0.1'

    但是,我认为'blueprints-neo4j-graph-2.5.0'将获得自己的版本(neo4j 1.9.6)作为依赖。

  2. 是否可以将neo4j webadmin控制台与嵌入式版本一起使用?

    我尝试将neo4j.server.properties中的数据库位置更改为嵌入式实例配置中给出的相同位置,但我无法同时访问它们。

  3. 我在build.gradle中进行了此更改。

    编译组:'com.tinkerpop.blueprints',名称:'blueprints-neo4j2-graph',版本:'2.5.0'

    这会选择neo4j 2.0.1。

    另外,我更改了tinkerpopConfig(我正在使用GraphFactory打开和关闭图形),如tinkerpop示例中所述:

    "blueprints.neo4jha.directory" : "C:/data/my-test-model-graph",
    "blueprints.graph" : "com.tinkerpop.blueprints.impls.neo4j2.Neo4j2HaGraph",
    "blueprints.neo4jha.conf.server_id" : "1",
    "blueprints.neo4jha.conf.server" : "localhost:6364",
    "blueprints.neo4jha.conf.cluster_server" : "localhost:5002",
    "blueprints.neo4jha.conf.initial_hosts" : "localhost:5001,localhost:5002"
    

    现在,当我尝试部署时,我得到一个空图。

    当您说,HA实施需要企业版:

    我也尝试过这样做,

    compile(group: 'com.tinkerpop.blueprints', name: 'blueprints-neo4j2-graph', version:'2.5.0'){
    exclude(module: 'neo4j')
    exclude(module: 'neo4j-ha')
    exclude(module: 'neo4j-management')
        }
    compile group: 'org.neo4j', name: 'neo4j-enterprise', version:'2.0.1'
    

    将获得neo4j-enterprise-2.0.1。

    但这似乎也不起作用,无法打开图形实例。

    你觉得这里有什么奇怪的吗?

    java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [com.tinkerpop.blueprints.impls.neo4j2.Neo4j2HaGraph]. at com.tinkerpop.blueprints.GraphFactory.open(GraphFactory.java:50) ~[blueprints-core-2.5.0.jar:na] at com.repo.GraphManager.getGraphDatabase(GraphManager.java:314) [com.repo~repo_module~1.0.0-SNAPSHOT/:na] at com.repo.GraphManager.start(GraphManager.java:164) [com.repo~repo_module~1.0.0-SNAPSHOT/:na] at org.vertx.java.platform.Verticle.start(Verticle.java:82) [vertx-platform-2.1M1.jar:na] at com.englishtown.vertx.hk2.HK2VerticleLoader.start(HK2VerticleLoader.java:77) [com.englishtown~vertx-mod-hk2~1.6.0-SNAPSHOT/:na] at org.vertx.java.platform.impl.DefaultPlatformManager$19.run(DefaultPlatformManager.java:1551) [vertx-platform-2.1M1.jar:na] at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176) [vertx-core-2.1M1.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51] Caused by: java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_51] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) ~[na:1.7.0_51] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.7.0_51] at java.lang.reflect.Constructor.newInstance(Constructor.java:526) ~[na:1.7.0_51] at com.tinkerpop.blueprints.GraphFactory.open(GraphFactory.java:43) ~[blueprints-core-2.5.0.jar:na] ... 9 common frames omitted Caused by: java.lang.NullPointerException: null at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1124) ~[na:1.7.0_51] at java.util.concurrent.ConcurrentHashMap.putAll(ConcurrentHashMap.java:1162) ~[na:1.7.0_51] at org.neo4j.kernel.configuration.Config.applyChanges(Config.java:122) ~[neo4j-kernel-2.0.1.jar:2.0.1] at org.neo4j.kernel.configuration.Config.<init>(Config.java:88) ~[neo4j-kernel-2.0.1.jar:2.0.1] at org.neo4j.kernel.InternalAbstractGraphDatabase.<init>(InternalAbstractGraphDatabase.java:278) ~[neo4j-kernel-2.0.1.jar:2.0.1] at org.neo4j.kernel.ha.HighlyAvailableGraphDatabase.<init>(HighlyAvailableGraphDatabase.java:136) ~[neo4j-ha-2.0.1.jar:2.0.1] at org.neo4j.graphdb.factory.HighlyAvailableGraphDatabaseFactory$1.newDatabase(HighlyAvailableGraphDatabaseFactory.java:47) ~[neo4j-ha-2.0.1.jar:2.0.1] at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:198) ~[neo4j-kernel-2.0.1.jar:2.0.1] at com.tinkerpop.blueprints.impls.neo4j2.Neo4j2HaGraph.<init>(Neo4j2HaGraph.java:23) ~[blueprints-neo4j2-graph-2.5.0.jar:na] at com.tinkerpop.blueprints.impls.neo4j2.Neo4j2HaGraph.<init>(Neo4j2HaGraph.java:31) ~[blueprints-neo4j2-graph-2.5.0.jar:na] ... 14 common frames omitted

1 个答案:

答案 0 :(得分:0)

如果你想要Neo4j 2.x,那么你需要使用这种依赖:

<dependency>
  <groupId>com.tinkerpop.blueprints</groupId>
  <artifactId>blueprints-neo4j2-graph</artifactId>
  <version>2.5.0</version>
</dependency>

由于此版本在嵌入模式下运行,一次只有一个JVM进程可以访问数据库,因此您无法通过TinkerPop访问数据库并同时运行Neo4j Server以获取Neo4j WebAdmin控制台。如果您想在该模式下运行,那么您应该使用Neo4jHaGraph

https://github.com/tinkerpop/blueprints/wiki/Neo4jHa-Implementation

需要企业版:

http://docs.neo4j.org/chunked/stable/ha-setup-tutorial.html

Neo4jHaGraph也应存在于blueprints-neo4j2-graph包装中。