amazon-archives / dynamodb-janusgraph-storage-backend

The Amazon DynamoDB Storage Backend for JanusGraph
Apache License 2.0
447 stars 99 forks source link

Data not Persisting on Restart #230

Closed mainawycliffe closed 7 years ago

mainawycliffe commented 7 years ago

Hi, i have successfully installed Janusgraph with Dynamodb plugin successfully. Am able to load the graph of the gods and run all those queries either through the gremlin query and also using PHP driver for gremlin-server. One issue i do have, and would appreciate if someone explained to me is how do you create a new graph/schema? Or how does that work on graph databases. I am coming from MySQL Background where everything is less confusing for me.

Now my main question is why is my data not persisting on restart when i create new Vertexes, Edges and Properties, then i restart the services, it all disappears. I am using the following commands:

mgmt = graph.openManagement()
name = mgmt.makePropertyKey('name').dataType(String.class).cardinality(Cardinality.SET).make()
person = mgmt.makeVertexLabel('person').make()
mgmt.commit()

person = graph.addVertex(label, 'person', 'name', 'Maina Wycliffe' )

All Coppied From janusgraph.org

Something interesting is, when i add data using PHP Gremlin server driver, it is immediately available to gremlin console, but is lost on restart and data i add through the gremlin console is not visible vie the php queries.

amcp commented 7 years ago

The default configuration of DynamoDB Local is ephemeral by design. the inMemory flag does not persist data to disk. You can try removing it, but recall that DynamoDB Local is a testing tool and it is not a best practice to rely on it for persistence.

mainawycliffe commented 7 years ago

Thanks for the response. I understand what you are saying but, during early stages of app Development, i need to be able to find the structure of my database intact when i turn off my PC, so that i can continue from there. Atleast that's what i do when using MySQL. Maybe my approach is all wrong. Someone could give me some advice

amcp commented 7 years ago

You can remove the inMemory flag from DynamoDB Local when you start it up. Then, DynamoDB Local will write a file to disk containing your tables. The better approach would be to keep a Gremlin script that loads up your graph, so that you can start with a fresh graph each time.

mainawycliffe commented 7 years ago

Thanks, i think i will take your advice on keeping the gremlin scripts and start with a fresh graph