Neo4j HA(嵌入式)通过Spring?
作者:互联网
使用1.8.2-尝试(最初)设置2节点HA群集.
以下的“ 22.5.4.在高可用性模式下启动Neo4j Embedded”一节
http://docs.neo4j.org/chunked/stable/ha-setup-tutorial.html
我在pom.xml中添加了以下内容:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ha</artifactId>
<version>${neo4j-version}</version>
</dependency>
并将我的application-content.xml修改为以下内容:
<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包含:
节点1(地址: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)
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
当我启动每个实例时,我会获得正常的启动日志,然后
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的更改有关)
然后..什么都没有..(!)
启动仅在此处停止.鉴于上面提到的页面中针对独立服务器的设置配置提到将协调器实例作为该过程的单独部分来启动,我是否需要在此处手动执行某些操作?还是应该自己照顾自己?我如何找到日志记录信息以开始计算为什么我只是看到节点挂起?如果我仅启动一个节点,BTW行为也不会不同-日志中的相同挂起位置,相同位置…
我猜我缺少一些简单的东西吗?
d
解决方法:
您可以将bean放入属性文件中.同样要进行HA,您可以使用HighlyAvailableGraphDatabase类.做这样的事情:
<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>
但是,配置Bean应该指向neo4j.properties文件,该文件可以包含上面的所有属性.
标签:spring,neo4j,high-availability 来源: https://codeday.me/bug/20191010/1885440.html