Thursday, September 3, 2015

Setting up Orientdb - a graph database

I recently found myself dabbling to graph databases for some interesting analytics work. One of the software that we wanted to test out is a document-graph database called Orientdb. The software is interesting because it covers functionality from both document databases (e.g., MongoDB) and pure graph databases (e.g., Neo4j). While trying to set up the server however, faced a few gaps in the documentation, which is why this post. I am using Orientdb Community Edition v2.1.1.

Using Custom Port

By default, Orientdb binary server runs at port 2424 and web server runs at port 2480. To use different ports with Orientdb, one has to change the settings in config/orientdb-server-config.xml. There you would find the port ranges provided for each server operation (i.e., binary and web servers). Honestly, I have not seen port ranges for other servers before, presumably this is for the purpose that if a particular port is occupied, the software will run on next available port - kinda curious. Anyways, you will have to change the starting port numbers for your desired port in those settings.

Connecting from Orientdb console

The console example provided in the documentation does not provide examples when you are running the servers on custom port. Here is how you can connect to the server, or to a database.

orientdb> connect remote:localhost:3306 root root

Connecting to remote Server instance [remote:localhost:3306] with user 'root'...OK
orientdb {server=remote:localhost:3306/}>

orientdb {server=remote:localhost:3306/}> list databases

Found 1 databases:

* GratefulDeadConcerts (plocal)
 You can also directly connect to a database, while mentioning the port, as follows:
orientdb> connect remote:localhost:3306/GratefulDeadConcerts root root

Connecting to database [remote:localhost:3306/GratefulDeadConcerts] with user 'root'...OK
orientdb {db=GratefulDeadConcerts}> classes

 NAME                                         | SUPERCLASS                         | CLUSTERS   | RECORDS        |
 E                                            |                                    | 10         |              0 |
 followed_by                                  | [E]                                | 11         |           7047 |
Will update this post with more notes.