首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Neo4j HA (嵌入式)通过Spring?

Neo4j HA (嵌入式)通过Spring?
EN

Stack Overflow用户
提问于 2013-05-13 22:28:30
回答 1查看 1.1K关注 0票数 0

使用1.8.2 --尝试(最初)设置2节点HA集群。

遵循的"22.5.4.以HA模式启动嵌入的Neo4j“一节

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

我已经在我的pom.xml中添加了以下内容:

代码语言:javascript
复制
<dependency>
   <groupId>org.neo4j</groupId>
   <artifactId>neo4j-ha</artifactId>
   <version>${neo4j-version}</version>
</dependency>

并将我的application-content.xml修改为:

代码语言:javascript
复制
<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)

代码语言:javascript
复制
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)

代码语言:javascript
复制
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

当我启动每个实例时,我会得到正常的启动日志,然后

代码语言:javascript
复制
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

(只有首两个与医管局变更有关的高级管理人员)

然后..。没什么..。(!)

初创公司只是止步于此。鉴于上面提到的页面中独立服务器的设置配置提到将协调器实例作为流程的单独部分启动,我是否需要在此处手动执行此操作?或者,这应该自己照顾自己吗?我如何找到日志记录信息,以便开始找出为什么我只看到节点挂起?顺便说一句,如果我只启动一个节点,行为也没有什么不同--相同的挂起,日志中的相同位置……

我猜我错过了一些简单的东西?

D

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-05-13 22:40:01

您可以在属性文件中创建bean。此外,为了实现HA,您可以使用类HighlyAvailableGraphDatabase。这样做:

代码语言:javascript
复制
<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文件,您可以让该文件包含上面拥有的所有属性。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16524542

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档