Installation
My system:
Laptop with ubuntu 16.04 OS.
Gremlin console version : 3.3.3 (to be installed)
Install the Gremlin console:
Download location http://tinkerpop.apache.org/
- wget https://www.apache.org/dyn/closer.lua/tinkerpop/3.3.3/apache-tinkerpop-gremlin-console-3.3.3-bin.zip
- unzip it in the folder
run the gremlin console as below,
cd apache-tinkerpop-gremlin-console-3.3.3/bin/gremlin.sh
Contrail gremln utilities
Contrail Gremlin repository is available in the below link
https://github.com/eonpatapon/contrail-gremlin-binaries
https://github.com/eonpatapon/contrail-gremlin
- Install the contrail-gremlin binary executables
procedure:
1.dump the contrail database(cassandra db) in to json file using gremlin-dump utility
contrail-gremlin-binaries$./gremlin-dump --cassandra 84.39.42.57 contrail_db.json
13:58:07.953 main.setup [NOTICE] Connecting to Cassandra...
13:58:12.469 main.setup [NOTICE] Connected.
Processing [read:70 write:69 dup:0] D
Processing [read:70 write:70 dup:0] D13:58:14.010 main.Start [NOTICE] Dump done in 1.40s
contrail-gremlin-binaries$
Here 84.39.42.57 is a cassandra server/cluster IP
2. Load the file in to gremlin console
start the gremlin console
suresh@suresh-Latitude-6430U:~$ gremlin/bin/gremlin.sh
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin>
Load the contrail_db.json file
open a empty tinkergraph
graph = TinkerGraph.open()
Load the json file in to the graph
graph.io(IoCore.graphson()).readGraph("/home/suresh/contrail_db.json")
do graph traversal
g=graph.traversal()
Example:
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> graph.io(IoCore.graphson()).readGraph("/home/suresh/contrail_db.json")
==>null
gremlin> graph
==>tinkergraph[vertices:70 edges:104]
gremlin> g=graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:70 edges:104], standard]
gremlin>
- Execute the sample query
gremlin> g.V().hasLabel("virtual_network")
==>v[281e7625-fc2f-47de-92fb-a542ace2580b]
==>v[14d23261-2570-4dac-ae82-8ecdf4654872]
==>v[7e0362f9-58a5-445d-bd29-7896d1c51f40]
==>v[5529e180-607a-4497-89d8-ef28e1c61529]
==>v[2fc4845d-6425-4a6a-972e-33cc7e577310]
==>v[00f26899-3061-425c-b522-02aa13aedf89]
gremlin>