Question

I have clustered 3 instances of Neo4j Enterprise Edition (v1.8.2) on 3 different machine with Ha and they are working good as of now (when accessing through Ha front end url).
I wanted to know how can I configure my Spring configuration (applicationContext.xml) in order to use Ha front end url , which target to 3 instances of neo4j server in backend.
I went through this link. which describe below lines:

<bean id="haDatabase" class="org.neo4j.kernel.HighlyAvailableGraphDatabase" destroy-method="shutdown">
<constructor-arg index="0" value="target/config-test"/>
<constructor-arg index="1">
<map>
<entry key="ha.server_id" value="1"/>
<entry key="ha.server" value="192.168.1.10:6001"/>
<entry key="ha.coordinators" value="192.168.1.10:2181,192.168.1.9:2182,192.168.1.8:2183"/>
</map>
</constructor-arg>
</bean>
<neo4j:config graphDatabaseService="haDatabase"/>

I am exactly not getting, how and why should I re-configure the server_id and coordinators here, which I have already done for all neo4j server configuration.

Update #1

After applying above configuration, and kept all three instances running with Ha proxy. I get below logs in Eclipse and get hanged over there while debugging my application ...

14:29:13.220 [pool-2-thread-1] DEBUG neo4j - Read HA server:192.168.1.10:6001 (for machineID 1) from zoo keeper
14:29:13.227 [pool-2-thread-1] DEBUG neo4j - Read HA server:192.168.1.8:6003 (for machineID 3) from zoo keeper 14:29:13.232 [pool-2-thread-1] DEBUG neo4j - Read HA server:192.168.1.9:6002 (for machineID 2) from zoo keeper 14:29:13.239 [pool-2-thread-1] DEBUG neo4j - Writing at flush-requested: -6 14:29:13.268 [pool-2-thread-1] DEBUG neo4j - getMaster 3 based on [MachineInfo[ID:1, sequence:29, last tx:97, server:(192.168.1.10, 6001), master for last tx:3], MachineInfo[ID:2, sequence:30, last tx:97, server:(192.168.1.9, 6002), master for last tx:3], MachineInfo[ID:3, sequence:31, last tx:97, server:(192.168.1.8, 6003), master for last tx:3]] 14:29:13.333 [pool-13-thread-1] DEBUG neo4j - org.neo4j.kernel.ha.zookeeper.ZooClient$WatcherImpl@169a0c5, Fri Aug 09 14:29:13 IST 2013 Got event: WatchedEvent state:SyncConnected type:None path:null (path=null)

Update #2
Another query raised is, I am not using direct Haproxy front end url anywhere in my spring configuration. then what is role Haproxy play in my spring app ? I discussed this with one of my friend, and as per his suggestion there should be some way to use Ha proxy url.

Update #3
<bean id="graphDatabaseService" class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
<constructor-arg index="0" value="http://192.168.1.46:81/db/data" />
</bean>

I have tried above case as well, but what I felt its performance was not upto the mark (http://192.168.1.46:81 is my haproxy front end url targeting to 3 instances of neo4j server).

any clue, where I am stuck to ? Please help

Was it helpful?

Solution

Issue resolved, just by implementing below changes in my applicationContext.xml spring configuration:
<bean id="graphDatabaseService" class="org.neo4j.kernel.HighlyAvailableGraphDatabase" destroy-method="shutdown">
<constructor-arg index="0" value="/opt/build/mydb/graph.db"/>
<constructor-arg index="1">
<map>
<entry key="ha.server_id" value="1"/>
<entry key="ha.server" value="192.168.1.10:6001"/>
<entry key="ha.coordinators" value="192.168.1.10:2181,192.168.1.9:2182,192.168.1.8:2183"/>
</map>
</constructor-arg>
</bean>
<neo4j:config graphDatabaseService="graphDatabaseService"/>

As per my understanding, We need to mention at least primary location of graph.db followed by ha configuration with coordinators details.
Would like to thanks Michael for this (link 1 and link 2). Appreciated Thanks :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top