Why does the cleandb extension refuse to delete my neo4j graph database?

半城伤御伤魂 提交于 2019-12-11 12:18:59

问题


When trying to purge neo4j (1.8.2) with the cleandb extension (for neo4j 1.8), it fails:

[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

Obviously, I do not only get a 500 error code, also the db is not purged. Of course, access URL and "secret-key" of the plugin are set up as used in the curl request:

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

I would conveniently add the cleandb tag, but I lack the 1500 reputation.

Any ideas? Thanks in advance!

EDIT (The reason I use cleandb is to set up unittests in neo4django). /EDIT


回答1:


Hm, I have the cleandb extension working locally against 1.8.2 and 1.9. For example, you can run

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

and trace the cleandb Python call, and it gets a 200 and accompanying response body,

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

I'm not sure what the difference between curl and the Python call might be- any chance you could try the above in a module, run it, and see what happens?

EDIT:

The cleandb extension is unmanaged, so you can't (IIRC?) set the URL to '/db/cleandb', it needs to be on its own root- I use '/cleandb'. LMK if that helps!

EDIT:

Aw, disregard that, '/db/' urls seem to work fine. Maybe you could use the 'install_local_neo4j.bash' script (https://github.com/scholrly/neo4django/blob/master/install_local_neo4j.bash) to install a copy of Neo4j and set it up the same way, if that works for you? And if so, maybe we can see how the setups differ...




回答2:


It only works with Neo4j versions up to 1.7 I think.

Didn't update it anymore b/c you can do that cleanup with cypher now, see: http://neo4j.org/resources/cypher

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


来源:https://stackoverflow.com/questions/16862852/why-does-the-cleandb-extension-refuse-to-delete-my-neo4j-graph-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!