2013-05-31 26 views
1

當試圖清除neo4j(1.8.2)與cleandb擴展名(Neo4j的1.8),它失敗:爲什麼cleandb擴展拒絕刪除我的neo4j圖形數據庫?

[path] ? curl -v -X DELETE 'http://localhost:7475/db/cleandb/12sE$lkj3%' 
* About to connect() to localhost port 7475 (#0) 
* Trying 127.0.0.1... 
* Connected to localhost (127.0.0.1) port 7475 (#0) 
> DELETE /db/cleandb/12sE$lkj3% HTTP/1.1 
> User-Agent: curl/7.29.0 
> Host: localhost:7475 
> Accept: */* 
> 
< HTTP/1.1 500 Internal Server Error 
< Content-Length: 0 
< Server: Jetty(6.1.25) 
< 
* Connection #0 to host localhost left intact 

很顯然,我並不只得到一個500錯誤代碼,也該數據庫不清除。 當然,訪問URL和插件的「祕密鑰匙」被設置爲在curl請求中使用:

org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.server.extension.test.delete=/db/cleandb 
org.neo4j.server.thirdparty.delete.key=12sE$lkj3% 

我會方便添加cleandb標籤,但我缺少1500的聲譽。

任何想法?提前致謝!

編輯 (我使用cleandb的原因是在neo4django中設置unittests)。 /編輯

回答

2

嗯,我有cleandb擴展對1.8.2和1.9在本地工作。例如,您可以運行

from neo4django.db import connection 
from pdb import set_trace; set_trace() 
connection.cleandb() 

和跟蹤cleandb Python的調用,它得到200和伴隨的響應體,

{\n "node-indexes" : [ ],\n "nodes" : 4,\n "relationship-indexes" : [ ],\n "relationships" : 0,\n "maxNodesToDelete" : 1000\n} 

我不知道什麼捲曲和Python的之間的區別調用可能是 - 你有可能在模塊中嘗試上述內容,運行它並查看會發生什麼?

編輯:

的cleandb擴展非託管的,所以你不能(?IIRC)設置爲 '/ DB/cleandb',它需要在自己的根 - 我使用URL「/ cleandb 」。 LMK如果有幫助!

編輯:

哦,無視, '/ DB /' 網址似乎很好地工作。也許你可以使用「install_local_neo4j.bash」腳本(https://github.com/scholrly/neo4django/blob/master/install_local_neo4j.bash)安裝的Neo4j的副本,並設置它以同樣的方式,是否適合你?如果是的話,也許我們可以看到設置有什麼不同...

+0

哈!這很愚蠢!我從密鑰中刪除了'$'和'%'符號,現在**工作**。 _Either_cleandb不支持密鑰中的特殊字符,或者URL編碼出現問題 - 也許'curl'本身並不這樣做,不像瀏覽器,我應該已經提供了URL編碼的URL。實際上,現在我懷疑'$'是罪魁禍首(儘管兩者在URL中都有特殊含義)。那麼,我想我想遵循好的密碼準則,以及有特殊的字符,而不僅僅是字母數字... :-) –

+0

@Michael Hunger:你能證實這一點嗎? –

1

它只適用於Neo4j版本高達1.7我認爲。

沒有再更新過b/c可以做暗號是立即清除,請參見:http://neo4j.org/resources/cypher

start n=node(*) 
match n-[r?]->() 
where id(n) <> 0 
delete n,r 
+0

其實,有1.8 [這裏](https://github.com/jexp/neo4j-clean-remote-db-addon特定版本/下載),(我使用這個版本匹配我的Neo4j 1.8.2(我使用的,因爲這是neo4django是針對測試)。 –

+0

事實上,我碰到cleandb偶然,因爲它是在neo4django –

+0

@ASz做單元測試的建議方法neo4django主也對測試1.9RC1。我一直更新特拉維斯CI建立從1.9RC1到1.9,但我敢肯定一切仍然有效,因爲我對測試1.9,我發展,我會打開它馬上和更新文檔。 –