복붙노트

[SPRING] Neo4j HA (임베디드)를 통해 봄?

SPRING

Neo4j HA (임베디드)를 통해 봄?

1.8.2 사용 - 2 노드 HA 클러스터를 (초기에) 설정하려고합니다.

다음 절의 "22.5.4. HA 모드에서 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 로의 변경과 관련된 sem의 처음 두 개만)

그럼 아무것도 .. .... (!)

시동은 단순히 거기에서 멈 춥니 다. 위에서 언급 한 페이지의 독립 실행 형 서버에 대한 설치 구성에서 코디네이터 인스턴스를 프로세스의 개별 부분으로 시작한다고 언급 했으므로 여기서 수동으로 수행해야하는 작업이 있습니까? 아니면 그냥 스스로 처리해야합니까? 어떻게하면 노드가 멈추는 지 알기 쉽게 로깅 정보를 찾을 수 있습니까? BTW 동작은 단일 노드를 시작한 경우에도 마찬가지입니다. 동일한 정지, 로그의 동일한 위치 ...

나는 뭔가 간단한 것을 놓치고 있다고 생각하고 있니?

해결법

  1. ==============================

    1.bean을 속성 파일에서 가져올 수 있습니다. 또한 HA를 수행하려면 클래스 고 가용성 GraphDatabase를 사용합니다. 다음과 같이하십시오.

    bean을 속성 파일에서 가져올 수 있습니다. 또한 HA를 수행하려면 클래스 고 가용성 GraphDatabase를 사용합니다. 다음과 같이하십시오.

    <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 파일을 가리켜 야합니다.

  2. from https://stackoverflow.com/questions/16524542/neo4j-ha-embedded-via-spring by cc-by-sa and MIT license