Using the Rexter 2.7 Graph Server with Couchbase Server
One of my side projects at Couchbase is a Graph-API on top of it. This article explains how you can use the Rexter Graph Server with this implementation of the Blueprints 2.x API.
There is a forked version of Rexter available here: https://github.com/dmaier-couchbase/rexster .
However, the modifications are quite simple.
I disabled the enforcer plug-in in the main pom.xml file.
The 'rexter-server/pom.xml' file contains additional dependencies.
Also the file 'rexter-server/config/rexter.xml' was edited in order to use the Couchbase instance.
To have this working it is expected that you have previously built CBGraph and that it sits in your local Maven cache. It can be found here: https://github.com/dmaier-couchbase/cb-graph
Your Couchbase connection is currently configured via the file 'couchbase.properties' which is part of the source code of CBGraph.
So the steps are:
There is a forked version of Rexter available here: https://github.com/dmaier-couchbase/rexster .
However, the modifications are quite simple.
I disabled the enforcer plug-in in the main pom.xml file.
The 'rexter-server/pom.xml' file contains additional dependencies.
<dependency> <groupId>com.couchbase.graph</groupId> <artifactId>couchbase-blueprints</artifactId> <version>1.0-SNAPSHOT</version> </dependency>
<dependency> <groupId>com.couchbase.client</groupId> <artifactId>java-client</artifactId> <version>2.1.3</version> </dependency>
Also the file 'rexter-server/config/rexter.xml' was edited in order to use the Couchbase instance.
<graph> <graph-enabled>true</graph-enabled> <graph-name>cbsample</graph-name> <graph-type>com.couchbase.graph.rexter.CouchbaseGraphConfiguration</graph-type> <graph-location>/tmp/cb-graph</graph-location> </graph>
To have this working it is expected that you have previously built CBGraph and that it sits in your local Maven cache. It can be found here: https://github.com/dmaier-couchbase/cb-graph
Your Couchbase connection is currently configured via the file 'couchbase.properties' which is part of the source code of CBGraph.
## Connection to Couchbase #cb.con.hosts=192.168.56.104,192.168.56.105,192.168.56.106 cb.con.hosts=192.168.7.160 cb.con.port=8091 cb.con.bucket.name=graph cb.con.bucket.pwd=test cb.timeout.op=30000 cb.admin.user=couchbase cb.admin.pwd=couchbase ## Views on side of Couchbase cb.view.autocreate=true cb.view.designdoc=graph_views cb.view.alledges=all_edges cb.view.allvertices=all_vertices cb.view.alledgelabels=all_edge_labels cb.view.allvertexprops=all_vertex_props cb.view.alledgeprops=all_edge_props
So the steps are:
- Run 'mvn install' in the CBGraph project
- Run 'mvn install' in the Rexter project
Rexter's target folder now should contain a folder which is called 'rexster-server-2.7.0-SNAPSHOT-standalone'.
- Execute 'bin/rexter.sh -s'
You should see a message like
[INFO] Slf4JLogger - Connected to Node 192.168.7.160[INFO] Slf4JLogger - Opened bucket graph[INFO] Slf4JLogger - Connected to Node 192.168.7.155[INFO] Slf4JLogger - Connected to Node 192.168.7.159
Now let's play a bit with the Rexter REST interface:
- All vertices: http://localhost:8182/graphs/cbsample/vertices
- All edges: http://localhost:8182/graphs/cbsample/edges
- A specific vertex called 'Bart': http://localhost:8182/graphs/cbsample/vertices/tae_bart
- Get all outgoing from Bart: http://localhost:8182/graphs/cbsample/vertices/tae_bart/outE
- ...
You can also browse the Graph via Rexter's UI: http://localhost:8182/doghouse
Here an example screen shot:
Comments
Post a Comment