2012-11-21 27 views
1

我在Spring MVC應用程序中使用Neo4j 1.9.M01,該應用程序公開了一些域特定的REST服務(讀取,更新)。 Web應用程序在相同的Web容器(Tomcat 6)中部署了三次,每個「節點」都有自己的嵌入式Neo4j HA實例屬於同一個集羣。在1.9.M01 Neo4j HA複製問題

三個Neo4j的配置:

#node 1 
ha.server_id=1 
ha.server=localhost:6361 
ha.cluster_server=localhost:5001 
ha.initial_hosts=localhost:5001,localhost:5002,localhost:5003 

#node 2 
ha.server_id=2 
ha.server=localhost:6362 
ha.cluster_server=localhost:5002 
ha.initial_hosts=localhost:5001,localhost:5002,localhost:5003 

#node 3 
ha.server_id=3 
ha.server=localhost:6363 
ha.cluster_server=localhost:5003 
ha.initial_hosts=localhost:5001,localhost:5002,localhost:5003 

問題:當所述改變被複制到僅一個其它節點和所述第三節點的節點中的一個執行更新保持在舊狀態腐敗集羣的一致性。

我正在使用里程碑,因爲它不允許在web容器外運行任何東西,所以我不能依靠1.9之前版本中基於ZooKeeper的舊協調。 我在這裏錯過了一些配置,或者它可能是1.9中引入的新協調機制的問題嗎?

回答

4

此行爲(僅複製到另一個其他實例)與1.8中的默認值相同。這是受控於:

 
ha.tx_push_factor=1 

這是默認值。

奴隸得到主人的更新在幾個方面:

  • 通過配置較高的推動因素,例如:
 
    ha.tx_push_factor=2 

(在所有實例而是因爲一個在使用是當前主人的使用)。

  • 通過配置拉間隔爲從站從它的主獲取更新文件,例如:
 
    ha.pull_interval=1s 
  • 通過手動拉動使用Java API

  • 更新通過發出從站寫交易

進一步看到http://docs.neo4j.org/chunked/milestone/ha-configuration.html

+0

非常感謝馬蒂亞斯!更改tx_push_factor已經解決了這個問題,現在的變化會立即複製到所有節點。 – gadget

1

第一個猜測是設置

ha.discovery.enabled = false 

看到http://docs.neo4j.org/chunked/milestone/ha-configuration.html#_different_methods_for_participating_in_a_cluster一個解釋。

對於一個完整的分析,你可以請所有三個集羣成員提供data/graph.db/messages.log

備註:應該可以使用1.8也可以滿足您的要求。你也可以直接從tomcat產生zookeeper,只是模仿bin/neo4j-coordinator做什麼:在web應用程序啓動時,在一個單獨的線程中運行類org.apache.zookeeper.server.quorum.QuorumPeerMain