2012-06-04 38 views
33

嗨我創建了一個neo4j數據庫與自定義Java應用程序,並試圖更改配置文件中的路徑,以連接到創建的數據庫。neo4j:如何切換數據庫?

雖然試圖檢查webadmin控制檯中的數據只有節點0是可見的(似乎數據庫是空的)。我試圖將相同的數據庫導入Gephi並且它不是空的。

此外,當我試圖切換回原始數據庫,這也是非空的,在webadmin中只出現節點0。

我試圖修改的Neo4j-server.propertied文件方式如下:

#***************************************************************** 
# Administration client configuration 
#***************************************************************** 

# location of the servers round-robin database directory. possible values: 
# - absolute path like /var/rrd 
# - path relative to the server working directory like data/rrd 
# - commented out, will default to the database data directory. 
org.neo4j.server.webadmin.rrdb.location=data/rrd 

# REST endpoint for the data API 
# Note the/in the end is mandatory 
#org.neo4j.server.webadmin.data.uri=/db/data/ #original database 
org.neo4j.server.webadmin.data.uri="/db/mydatabase" #my database 

# REST endpoint of the administration API (used by Webadmin) 
org.neo4j.server.webadmin.management.uri=/db/manage/ 

# Low-level graph engine tuning file 
org.neo4j.server.db.tuning.properties=conf/neo4j.properties 

切換回原來的數據庫(徵求意見的新路徑,並取消對舊)後

org.neo4j.server.webadmin.data.uri=/db/data/ #original database 
#org.neo4j.server.webadmin.data.uri="/db/mydatabase" #my database 

老wan似乎也是空的。

有誰知道如何以及在哪裏設置路徑,以便在webadmin控制檯中查看相應的數據庫並能夠在所需的數據庫上執行查詢?

謝謝!

回答

30

首先需要確認您連接到了正常關閉數據庫(意味着你不應該拍攝正在運行的數據庫的圖像)。

,如果你是在服務器模式從文件

conf/neo4j-server.properties 

通過編輯以下行設置數據庫的位置。

org.neo4j.server.database.location=data/graph.db 

,如果使用的是嵌入式的Neo4j你可以設置你的數據庫的位置,同時instantaniating的GraphDatabaseService爲下:

new EmbeddedGraphDatabase("Path To Db Directory"); 
+1

我已經使用「neo4j-community-3.0.1」,但沒有conf/neo4j-server.properties這樣的文件。並且有neo4j.conf的文件名,但是在這個文件中沒有這樣的屬性org.neo4j.server.database.location = data/graph.db。你能幫助我如何切換數據庫。 –

+2

@anujdhiman參閱https://github.com/neo4j/neo4j/wiki/Neo4j-3.0-changelog 配置 設定org.neo4j.server.database.location已被移除 新設置的DBMS。active_database用於指定要按名稱裝入的數據庫 新的設置dbms.directories.data用於配置數據目錄的路徑 –

4

您需要在數據庫目錄這樣的磁盤設置的位置:

org.neo4j.server.database.location=data/graph.db 

http://docs.neo4j.org/chunked/stable/server-configuration.html

+1

試圖設置這樣的位置,但所需的數據庫不會從Java應用程序和webadmin控制檯都看不到。 –

+1

@espeed我已經使用「neo4j-community-3.0.1」,但沒有conf/neo4j-server.properties這樣的文件。並且有neo4j.conf的文件名,但是在這個文件中沒有這樣的屬性org.neo4j.server.database.location = data/graph.db。你能幫助我如何切換數據庫。 –

3

對於別人苦苦尋找這個文件 - 在我的Ubuntu,我發現它在/etc/neo4j/neo4j.conf