我正在使用最新的Neo4j 2.0快照,以下代码无法通过数据库创建:
HashMap<String, String> haConfig = new HashMap<String, String>();
haConfig.put("ha.server_id", "2");
haConfig.put("ha.initial_hosts", ":5001,:5002");
haConfig.put("ha.server", ":6003");
haConfig.put("ha.cluster_server", ":5001");
haConfig.put("org.neo4j.server.database.mode", "HA");
final GraphDatabaseService graphDb = new HighlyAvailableGraphDatabaseFactory()
.newHighlyAvailableDatabaseBuilder("test.db")
.setConfig(haConfig)
.newGraphDatabase();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
graphDb.shutdown();
}
});
System.out.println("Database is running");
它始终生成一个没有警告/错误的干净日志,这是一个例子:
2013-05-24 12:43:43.143+0000 INFO [org.neo4j]: --- INITIALIZED diagnostics END ---
2013-05-24 12:43:43.281+0000 INFO [org.neo4j]: Creating new db @ test.db\neostore
2013-05-24 12:43:43.312+0000 INFO [org.neo4j]: [test.db\neostore.nodestore.db.labels] brickCount=0 brickSize=0b mappedMem=0b (storeSize=68b)
2013-05-24 12:43:43.314+0000 INFO [org.neo4j]: [test.db\neostore.nodestore.db] brickCount=0 brickSize=964684b mappedMem=96468992b (storeSize=0b)
2013-05-24 12:43:43.317+0000 INFO [org.neo4j]: test.db\neostore.nodestore.db.labels hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.328+0000 INFO [org.neo4j]: test.db\neostore.nodestore.db hit=1 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.367+0000 INFO [org.neo4j]: [test.db\neostore.relationshiptypestore.db.names] brickCount=0 brickSize=0b mappedMem=0b (storeSize=38b)
2013-05-24 12:43:43.370+0000 INFO [org.neo4j]: [test.db\neostore.relationshiptypestore.db] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.370+0000 INFO [org.neo4j]: test.db\neostore.relationshiptypestore.db.names hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.373+0000 INFO [org.neo4j]: test.db\neostore.relationshiptypestore.db hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.385+0000 INFO [org.neo4j]: [test.db\neostore.labeltokenstore.db.names] brickCount=0 brickSize=0b mappedMem=0b (storeSize=38b)
2013-05-24 12:43:43.386+0000 INFO [org.neo4j]: [test.db\neostore.labeltokenstore.db] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.387+0000 INFO [org.neo4j]: test.db\neostore.labeltokenstore.db.names hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.390+0000 INFO [org.neo4j]: test.db\neostore.labeltokenstore.db hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.399+0000 INFO [org.neo4j]: [test.db\neostore.relationshiptypestore.db.names] brickCount=0 brickSize=0b mappedMem=0b (storeSize=38b)
2013-05-24 12:43:43.400+0000 INFO [org.neo4j]: [test.db\neostore.relationshiptypestore.db] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.400+0000 INFO [org.neo4j]: [test.db\neostore.labeltokenstore.db.names] brickCount=0 brickSize=0b mappedMem=0b (storeSize=38b)
2013-05-24 12:43:43.400+0000 INFO [org.neo4j]: [test.db\neostore.labeltokenstore.db] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.401+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db.strings] brickCount=0 brickSize=296704b mappedMem=296747008b (storeSize=128b)
2013-05-24 12:43:43.401+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db.index.keys] brickCount=0 brickSize=0b mappedMem=0b (storeSize=38b)
2013-05-24 12:43:43.402+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db.index] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.403+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db.arrays] brickCount=0 brickSize=335488b mappedMem=335544320b (storeSize=128b)
2013-05-24 12:43:43.404+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db] brickCount=0 brickSize=3481269b mappedMem=348127232b (storeSize=0b)
2013-05-24 12:43:43.406+0000 INFO [org.neo4j]: [test.db\neostore.relationshipstore.db] brickCount=0 brickSize=4267692b mappedMem=426770432b (storeSize=0b)
2013-05-24 12:43:43.407+0000 INFO [org.neo4j]: [test.db\neostore.nodestore.db.labels] brickCount=0 brickSize=0b mappedMem=0b (storeSize=68b)
2013-05-24 12:43:43.407+0000 INFO [org.neo4j]: [test.db\neostore.nodestore.db] brickCount=0 brickSize=96460b mappedMem=96468992b (storeSize=14b)
2013-05-24 12:43:43.407+0000 INFO [org.neo4j]: [test.db\neostore.schemastore.db] brickCount=0 brickSize=0b mappedMem=0b (storeSize=64b)
2013-05-24 12:43:43.408+0000 INFO [org.neo4j]: [test.db\neostore] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.411+0000 INFO [org.neo4j]: test.db\neostore.relationshiptypestore.db.names hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.414+0000 INFO [org.neo4j]: test.db\neostore.relationshiptypestore.db hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.417+0000 INFO [org.neo4j]: test.db\neostore.labeltokenstore.db.names hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.421+0000 INFO [org.neo4j]: test.db\neostore.labeltokenstore.db hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.424+0000 INFO [org.neo4j]: test.db\neostore.propertystore.db.strings hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.428+0000 INFO [org.neo4j]: test.db\neostore.propertystore.db.index.keys hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.431+0000 INFO [org.neo4j]: test.db\neostore.propertystore.db.index hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.434+0000 INFO [org.neo4j]: test.db\neostore.propertystore.db.arrays hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.438+0000 INFO [org.neo4j]: test.db\neostore.propertystore.db hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.441+0000 INFO [org.neo4j]: test.db\neostore.relationshipstore.db hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.444+0000 INFO [org.neo4j]: test.db\neostore.nodestore.db.labels hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.448+0000 INFO [org.neo4j]: test.db\neostore.nodestore.db hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.451+0000 INFO [org.neo4j]: test.db\neostore.schemastore.db hit=0 miss=0 switches=0 ooe=0
2013-05-24 12:43:43.454+0000 INFO [org.neo4j]: test.db\neostore hit=0 miss=8 switches=0 ooe=0
2013-05-24 12:43:43.459+0000 INFO [org.neo4j]: [test.db\neostore.relationshiptypestore.db.names] brickCount=0 brickSize=0b mappedMem=0b (storeSize=38b)
2013-05-24 12:43:43.460+0000 INFO [org.neo4j]: [test.db\neostore.relationshiptypestore.db] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.460+0000 INFO [org.neo4j]: [test.db\neostore.labeltokenstore.db.names] brickCount=0 brickSize=0b mappedMem=0b (storeSize=38b)
2013-05-24 12:43:43.460+0000 INFO [org.neo4j]: [test.db\neostore.labeltokenstore.db] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.461+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db.strings] brickCount=0 brickSize=296704b mappedMem=296747008b (storeSize=128b)
2013-05-24 12:43:43.461+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db.index.keys] brickCount=0 brickSize=0b mappedMem=0b (storeSize=38b)
2013-05-24 12:43:43.461+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db.index] brickCount=0 brickSize=0b mappedMem=0b (storeSize=0b)
2013-05-24 12:43:43.462+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db.arrays] brickCount=0 brickSize=335488b mappedMem=335544320b (storeSize=128b)
2013-05-24 12:43:43.462+0000 INFO [org.neo4j]: [test.db\neostore.propertystore.db] brickCount=0 brickSize=3481269b mappedMem=348127232b (storeSize=0b)
2013-05-24 12:43:43.462+0000 INFO [org.neo4j]: [test.db\neostore.relationshipstore.db] brickCount=0 brickSize=4267692b mappedMem=426770432b (storeSize=0b)
2013-05-24 12:43:43.463+0000 INFO [org.neo4j]: [test.db\neostore.nodestore.db.labels] brickCount=0 brickSize=0b mappedMem=0b (storeSize=68b)
2013-05-24 12:43:43.463+0000 INFO [org.neo4j]: [test.db\neostore.nodestore.db] brickCount=0 brickSize=96460b mappedMem=96468992b (storeSize=14b)
2013-05-24 12:43:43.463+0000 INFO [org.neo4j]: [test.db\neostore.schemastore.db] brickCount=0 brickSize=0b mappedMem=0b (storeSize=64b)
2013-05-24 12:43:43.464+0000 INFO [org.neo4j]: [test.db\neostore] brickCount=0 brickSize=0b mappedMem=0b (storeSize=54b)
2013-05-24 12:43:43.481+0000 INFO [org.neo4j]: Opened logical log [test.db\nioneo_logical.log.1] version=0, lastTxId=1 (clean)
2013-05-24 12:43:43.486+0000 INFO [org.neo4j]: TM new log: tm_tx_log.1
2013-05-24 12:43:43.547+0000 INFO [org.neo4j]: BackupServer communication server started and bound to /0.0.0.0:6362
2013-05-24 12:43:43.602+0000 INFO [org.neo4j]: Opened logical log [test.db\index\lucene.log.1] version=0, lastTxId=1
有什么想法吗?
答案 0 :(得分:2)
newGraphDatabase()调用将一直等到声明的集群中的两个实例都启动并运行。是吗?