我最近为其中一个POC使用了嵌入的Spring Neo4j。它在单机上工作得很快。在开始生产之前,我希望将数据库从应用服务器中分离出来。我配置了三个Neo4j服务器实例和HA,并使用Spring Neo4j Rest进行连接。但速度是最差的。每个查询的执行时间超过30秒。
我正在考虑使用嵌入HA的Neo4j吗?有人能给我提供链接/教程,用HA代理在嵌入式模式下配置Spring数据Neo4j吗?
我希望有3个neo4j服务器和多个应用服务器。谢谢。
附加原木
17:43:10.695 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Processing injected method of bean 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': AutowiredMethodElement for public void org.springframework.data.neo4j.config.Neo4jConfiguration.setConversionService(org.springframework.core.convert.ConversionService)
17:43:10.703 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Processing injected method of bean 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': AutowiredMethodElement for public void org.springframework.data.neo4j.config.Neo4jConfiguration.setGraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService)
17:43:10.703 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'graphDatabaseService'
17:43:10.703 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'graphDatabaseService'
17:43:10.832 [main] DEBUG neo4j - WARNING! Deprecated configuration options used. See manual for details
17:43:10.832 [main] DEBUG neo4j - neo4j.ext.udc.disable has been replaced with neo4j.ext.udc.enabled
17:43:10.832 [main] DEBUG neo4j - cannot configure writers and searchers individually since they go together
17:43:14.467 [main] DEBUG neo4j - Writing at flush-requested: -1
17:43:16.163 [main] DEBUG neo4j - Read HA server:54.234.75.138:6002 (for machineID 2) from zoo keeper
17:43:16.821 [main] DEBUG neo4j - Read HA server:54.234.75.138:6003 (for machineID 3) from zoo keeper
17:43:17.445 [main] DEBUG neo4j - Writing at flush-requested: -6
17:43:19.013 [main] DEBUG neo4j - getMaster 2 based on [MachineInfo[ID:2, sequence:46, last tx:672, server:(54.234.75.138, 6002), master for last tx:1], MachineInfo[ID:3, sequence:47, last tx:672, server:(54.234.75.138, 6003), master for last tx:1]]我已尝试将其设置如下:
<bean id="graphDatabaseService" class="org.neo4j.kernel.HighlyAvailableGraphDatabase" destroy-method="shutdown" scope="singleton">
<constructor-arg name="storeDir" index="0" value="data/graph.db" />
<constructor-arg index="1">
<map>
<entry key="ha.server_id" value="${server.id}"></entry>
<entry key="ha.server" value="${ha.server.address}:${ha.server.port}"></entry>
<entry key="ha.coordinators" value="${coordinators}"></entry>
<entry key="enable_remote_shell" value="port=1331"></entry>
<entry key="ha.pull_interval" value="1"></entry>
</map>
</constructor-arg>
</bean> 我的新4j-ha.properties文件
server.id=1
ha.server.address=192.168.1.9
ha.server.port=7474
coordinators=192.168.1.9:5001,192.168.1.9:5002,192.168.1.9:5003
server.id=2
ha.server.address=192.168.1.9
ha.server.port=7475
coordinators=192.168.1.9:5001,192.168.1.9:5002,192.168.1.9:5003
server.id=3
ha.server.address=192.168.1.9
ha.server.port=7476
coordinators=192.168.1.9:5001,192.168.1.9:5002,192.168.1.9:5003仍然没有运气,它停止使用下面的日志
16:49:13.386 [main] DEBUG o.s.b.f.annotation.InjectionMetadata - Processing injected method of bean 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': AutowiredMethodElement for public void org.springframework.data.neo4j.config.Neo4jConfiguration.setGraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService)
16:49:13.387 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating shared instance of singleton bean 'graphDatabaseService'
16:49:13.387 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Creating instance of bean 'graphDatabaseService'
16:49:13.522 [main] DEBUG neo4j - WARNING! Deprecated configuration options used. See manual for details
16:49:13.522 [main] DEBUG neo4j - neo4j.ext.udc.disable has been replaced with neo4j.ext.udc.enabled
16:49:13.522 [main] DEBUG neo4j - cannot configure writers and searchers individually since they go together发布于 2013-05-15 06:25:44
瑞克,
下面是一个示例,说明如何将嵌入式HA的参数传递给HighlyAvailableGraphDatabase。
<neo4j:config graphDatabaseService="graphDatabaseService" />
<context:property-placeholder
location="file:/etc/neo4j-ha.properties" />
<bean id="graphDatabaseService" class="org.neo4j.kernel.HighlyAvailableGraphDatabase"
destroy-method="shutdown" scope="singleton">
<constructor-arg index="0" value="${database.path}" />
<constructor-arg index="1">
<map>
<entry key="ha.server_id" value="${server.id}"></entry>
<entry key="ha.server" value="${ha.server.address}:${ha.server.port}"></entry>
<entry key="ha.coordinators" value="${coordinators}"></entry>
<entry key="enable_remote_shell" value="port=1331"></entry>
<entry key="ha.pull_interval" value="1"></entry>
</map>
</constructor-arg>
</bean>发布于 2013-11-07 14:15:52
不久前,我在博客上写了一篇文章。应该给你你想要的。(虽然我决定使用Java配置)。
times/2013/04/spring-data-neo4j-configuration-for-highly-available-cluster-and-sub-reference-type-representation-s.html
我
https://stackoverflow.com/questions/16542799
复制相似问题