Neo4j встроенный с высокой доступностью

Недавно я использовал Spring Data Neo4j Embedded для одного из POC. Он работает молниеносно на одной машине. Прежде чем перейти к производству, я хотел отделить базу данных от сервера приложений. Я настроил три экземпляра Neo4j Server и прокси высокой доступности и использовал Spring Data Neo4j Rest для подключения. Но скорость была хуже. Выполнение каждого запроса занимает более 30 секунд.

Я думаю использовать Neo4j Embedded с высокой доступностью? Может ли кто-нибудь предоставить мне ссылки/учебники по настройке Spring Data Neo4j во встроенном режиме с прокси-сервером HA.

Я хочу иметь 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> 

Мой файл neo4j-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

person RickDavis    schedule 14.05.2013    source источник


Ответы (2)


Рик,

вот пример того, как передать параметры для встроенной высокой доступности в файл 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>

Также см. здесь: Neo4j HA (встроенный) через Spring?

person Michael Hunger    schedule 15.05.2013
comment
Михаил, не работает. Обновлена ​​проблема с трассировкой. Он останавливается между ними, а затем tomcat не запускается. - person RickDavis; 28.05.2013

Я написал сообщение в блоге об этом некоторое время назад. Должен дать вам именно то, что вы хотите. (хотя я решил использовать конфигурацию Java).

http://michaelandrews.typepad.com/the_technical_times/2013/04/spring-data-neo4j-configuration-for-highly-available-cluster-and-sub-reference-type-representation-s.htmlrel=

M

person Michael Andrews    schedule 07.11.2013