Neo4j HA(嵌入式)通过Spring? [英] Neo4j HA (embedded) via Spring?
问题描述
使用1.8.2-尝试(最初)设置2节点HA群集.
Using 1.8.2 -- trying to set up (initially) a 2-node HA cluster.
遵循以下部分的"22.5.4.在HA模式下启动Neo4j Embedded"
Following section "22.5.4. Start Neo4j Embedded in HA mode" of
http://docs.neo4j.org/chunked/stable/ha-setup-tutorial.html
我在pom.xml中添加了以下内容:
I have added the following to my pom.xml:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ha</artifactId>
<version>${neo4j-version}</version>
</dependency>
并将我的application-content.xml修改为以下内容:
and modified my application-content.xml to the following:
<neo4j:config graphDatabaseService="graphDatabaseService" />
<context:property-placeholder
location="file:/etc/whiteRabbit.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>
和
/etc/whiteRabbit.properties包含:
/etc/whiteRabbit.properties contains:
节点1(地址:192.168.1.68)
node 1 (address: 192.168.1.68)
server.id=1
ha.server.address=localhost
ha.server.port=6001
database.path=/databases/data/graph.db
coordinators=localhost:2181,192.168.1.100:2181
和节点2(地址192.168.1.100)
and node 2 (address 192.168.1.100)
server.id=2
ha.server.address=localhost
ha.server.port=6001
database.path=/databases/data/graph.db
coordinators=localhost:2181,192.168.1.68:2181
启动每个实例时,我会获得正常的启动日志,然后
When I start up each instance, I get the normal startup logs, then
14:57:58.171 [localhost-startStop-1] INFO neo4j - WARNING! Deprecated configuration options used. See manual for details
14:57:58.171 [localhost-startStop-1] INFO neo4j - neo4j.ext.udc.disable has been replaced with neo4j.ext.udc.enabled
14:57:58.171 [localhost-startStop-1] INFO neo4j - cannot configure writers and searchers individually since they go together
(其中只有前两个与HA的更改有关)
(only the first two of those sem to relate to the change to HA)
然后..什么都没有...(!)
then.. nothing.... (!)
启动仅在此处停止.鉴于上面提到的页面中针对独立服务器的设置配置提到将协调器实例作为该过程的单独部分来启动,我是否需要在此处手动进行某些操作?还是应该自己照顾自己?我如何找到日志记录信息以开始计算为什么我只是看到节点挂起?如果我仅启动一个节点,BTW的行为也没什么不同-日志中的相同挂起位置,相同位置...
Startup simply stops there. Given that the setup configuration for standalone servers in the page noted above mentions starting the coordinator instances as a separate part fo the process, is that something I need to do manually here? Or should that just take care of itself? How do I find logging info to start working out why I'm just seeing the nodes hang? BTW behaviour is no different if I start up just a single node -- same hang, same place in the logs...
我猜我缺少一些简单的东西吗?
Im guessing I'm missing something simple?
D
推荐答案
您可以将bean放入属性文件中.同样要进行HA,您可以使用类HighlyAvailableGraphDatabase
.做这样的事情:
You can make your bean pull in your properties file. Also to do HA, you use the Class HighlyAvailableGraphDatabase
. Do something like this:
<bean id="configuration" class="org.neo4j.helpers.collection.MapUtil" factory-method="load">
<constructor-arg value="/etc/whiteRabbit.properties" />
</bean>
<bean id="graphDatabaseService" class="org.neo4j.kernel.HighlyAvailableGraphDatabase" destroy-method="shutdown" scope="singleton">
<constructor-arg name="storeDir" index="0" value="${database.path}" />
<constructor-arg name="config" index="1" ref="configuration" />
</bean>
但是configuration
bean应该指向一个neo4j.properties
文件,该文件可以包含上面的所有属性.
However the configuration
bean should point to a neo4j.properties
file, which you can have contain all the properties you have above.
这篇关于Neo4j HA(嵌入式)通过Spring?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!