what is the right way to drop/clear the schema & data of a graph in janusgraph

3,068 views
Skip to first unread message

csraj...@gmail.com

unread,
Nov 3, 2017, 9:03:11 AM11/3/17
to JanusGraph users
Hi,
  What is the right way to clear the schema and data of a graph.

I tried the following methods.

Method 1:
graph.close(); org.janusgraph.core.util.JanusGraphCleanup.clear(graph)

After clearing later when accessing the same graph it throws random errors like "vertex id 1211 was removed" like that. Looks like the graph goes into some inconsistent state.

Method 2: 
ConfiguredGraphFactory.drop()

But this method throws below error when run via gremlin shell.

Error: startup failed:
Script79.groovy: 1: [Static type checking] - Cannot find matching method org.janusgraph.core.ConfiguredGraphFactory#drop(java.lang.String). Please check if the declared type is right and if the method exists.
 @ line 1, column 1.
   ConfiguredGraphFactory.drop('samplegraph1')

I dont understand why the error says can not find method.

Any help is appreciated.

- Raj

ted.w...@experoinc.com

unread,
Nov 3, 2017, 9:07:08 AM11/3/17
to JanusGraph users
Hi Raj,
Are you on the latest 0.2.0 release? If so, have you been using ConfiguredGraphFactory with success for your other options? If you've just been using the plain JanusGraphFactory, and are on 0.2.0, you can also do JanusGraphFactory.drop(graph).

--Ted

Ankur Goel

unread,
Nov 9, 2017, 2:59:02 AM11/9/17
to JanusGraph users
Use

JanusGraphFactory.drop(graph);


This work fine with Cassandra/ES/Solr-Cloud.


If you are using standalone-Solr, it will not drop data, you have to manually drop collection/index data.


~

Don Omondi

unread,
Dec 3, 2017, 8:06:41 PM12/3/17
to JanusGraph users
Definitely not the right way but if all your doing is developing and finding the right way is slowing you down you can always do the nuclear option

curl -X DELETE http://127.0.0.1:9200/janusgraph_*  // Delete JG indexes from ES
Delete all data from Cassandra data folder

*** This is not the best option but if you are just developing and have nothing else in Cassandra it can help you move on don't forget to stop Cassandra and JS first then restart them in that order
Reply all
Reply to author
Forward
0 new messages