Getting Started

stephen mallette edited this page May 10, 2013 · 57 revisions

The Rexster distribution comes configured with the TinkerPop Toy Graph and the Grateful Dead dataset. This section will describe the basics of loading up the Rexster web server and accessing some basic services.

Building and Installing Rexster

There are two ways to start working with Rexster: building the latest from source or downloading a pre-built version. Building Rexster from the latest source code, assumes that you have Git installed and Maven and can be accomplished with the following commands:

git clone https://github.com/tinkerpop/rexster.git
cd rexster
mvn clean install

Starting the Rexster Web Server

There is a shell script called rexster.sh. When that script is evaluated at the command line with the --start option, it starts up the Rexster web server.

./bin/rexster.sh --start

Note that using the rexster.bat requires backslashes instead of forwardslashes at the command line.

Rexster Configuration is handled through an XML file. By default, Rexster looks for a file called rexster.xml in the root of the working directory. Please be aware sample rexster.xml files are provided with the standard Rexster packaging. If that file cannot be found, Rexster tries to load rexster.xml as a resource packaged within Rexster itself. It is possible to make use of different configuration through a different XML file by calling:

./bin/rexster.sh --start -c other.xml
[INFO] Application - .:Welcome to Rexster:.
[WARN] RexsterSettings - Could not load configuration from [C:\git\tp\rexster\rexster-server\target\rexster-server-2.2.0-SNAPSHOT-standalone\rexster.xml]
[INFO] RexsterSettings - Using [rexster.xml] resource as configuration source.
[INFO] RexsterApplicationGraph - Graph [emptygraph] - configured with allowable namespace [tp:gremlin]
[INFO] GraphConfigurationContainer - Graph emptygraph - mocktinkertransactionalgraph[vertices:0 edges:0] loaded
[INFO] RexsterApplicationGraph - Graph [tinkergraph] - configured with allowable namespace [tp:gremlin]
[INFO] GraphConfigurationContainer - Graph tinkergraph - mocktinkertransactionalgraph[vertices:6 edges:6 directory:data/graph-example-1] loaded
[INFO] RexsterApplicationGraph - Graph [tinkergraph-readonly] - configured with allowable namespace [tp:gremlin]
[INFO] GraphConfigurationContainer - Graph tinkergraph-readonly - readonlyindexablegraph[tinkergraph[vertices:6 edges:6 directory:data/graph-example-1]] loaded
[INFO] RexsterApplicationGraph - Graph [gratefulgraph] - configured with allowable namespace [tp:gremlin]
[INFO] GraphConfigurationContainer - Graph gratefulgraph - tinkergraph[vertices:809 edges:8049 directory:data/graph-example-2] loaded
[INFO] GraphConfigurationContainer - Graph emptysailgraph -  not enabled and not loaded.
[INFO] GraphConfigurationContainer - Graph sailgraph -  not enabled and not loaded.
[INFO] GraphConfigurationContainer - Graph orientdbsample -  not enabled and not loaded.
[INFO] GraphConfigurationContainer - Graph neo4jsample -  not enabled and not loaded.
[INFO] GraphConfigurationContainer - Graph dexsample -  not enabled and not loaded.
[INFO] GraphConfigurationContainer - Graph remotetinkergraph -  not enabled and not loaded.
[INFO] Application - Gremlin ScriptEngine configured to reset every [500] requests. Set to -1 to never reset.
[INFO] HttpRexsterServer - Using org.glassfish.grizzly.strategies.WorkerThreadIOStrategy IOStrategy for HTTP/REST.
[INFO] HttpRexsterServer - Rexster Server running on: [http://localhost:8182]
[INFO] RexProRexsterServer - Rexster configured with no security.
[INFO] RexProRexsterServer - Using org.glassfish.grizzly.strategies.WorkerThreadIOStrategy IOStrategy for RexPro.
[INFO] RexProRexsterServer - RexPro serving on port: [8184]
[INFO] ShutdownManager$ShutdownSocketListener - Bound shutdown socket to /127.0.0.1:8183. Starting listener thread for shutdown requests.

GETing the Basics

When the web server is loaded, it is possible to get the list of of currently loaded graphs as well as other server information by accessing the base-URI:

http://localhost:8182/graphs

The result of GETing this base-URI should look as follows (consider using the JSONView plugin for Firefox or Chrome for nicely formatted JSON)

{
    "version": "*.*",
    "name": "Rexster: A Graph Server",
    "graphs": [
        "tinkergraph",
        "gratefulgraph",
        "tinkergraph-readonly",
        "emptygraph"
    ],
    "queryTime": 3.480889,
    "upTime": "0[d]:00[h]:06[m]:53[s]"
}

To look at the properties of an individual graph, append the names of one of the values from the “graphs” array above to the base-URI as in:

http://localhost:8182/graphs/tinkergraph

and the result will look like:

{
    "version": "*.*",
    "name": "tinkergraph",
    "graph": "mocktinkertransactionalgraph[vertices:6 edges:6 directory:data/graph-example-1]",
    "features": {
        "ignoresSuppliedIds": false,
        "supportsTransactions": false,
        "supportsSelfLoops": true,
        "supportsBooleanProperty": true,
        "supportsEdgeKeyIndex": true,
        "supportsUniformListProperty": true,
        "supportsThreadedTransactions": false,
        "isPersistent": true,
        "supportsVertexIndex": true,
        "supportsStringProperty": true,
        "supportsIntegerProperty": true,
        "isWrapper": false,
        "supportsMixedListProperty": true,
        "supportsVertexKeyIndex": true,
        "isRDFModel": false,
        "supportsLongProperty": true,
        "supportsVertexIteration": true,
        "supportsKeyIndices": true,
        "supportsEdgeIteration": true,
        "supportsPrimitiveArrayProperty": true,
        "supportsDoubleProperty": true,
        "supportsSerializableObjectProperty": true,
        "supportsIndices": true,
        "supportsEdgeIndex": true,
        "supportsMapProperty": true,
        "supportsFloatProperty": true,
        "supportsDuplicateEdges": true
    },
    "readOnly": false,
    "type": "com.tinkerpop.rexster.util.MockTinkerTransactionalGraph",
    "queryTime": 1.297372,
    "upTime": "0[d]:00[h]:08[m]:17[s]"
}

Reading more about the Basic REST API for Rexster will help in learning more about how general access to the graph will work.

The Dog House

The Dog House provides for browser-based access to some of the underlying Rexster services (basic vertex/edge browsing and Gremlin console) and by default is available at:

http://localhost:8182/doghouse

Stopping the Rexster Web Server

To shutdown the web server:

./bin/rexster.sh --stop

This will properly release resources and shutdown the server and exit. The following will appear in the server console:

[INFO] ShutdownManager$ShutdownSocketHandler - Received request for shutdown
[INFO] ShutdownManager - Calling ShutdownListener: com.tinkerpop.rexster.Application$1@4a93837b
[INFO] DefaultRexsterApplication - Shutting down [tinkergraph] - [mocktinkertransactionalgraph[vertices:6 edges:6 directory:data/graph-example-1]]
[INFO] DefaultRexsterApplication - Shutting down [tinkergraph-readonly] - [readonlyindexablegraph[tinkergraph[vertices:6 edges:6 directory:data/graph-example-1]]]
[INFO] DefaultRexsterApplication - Shutting down [gratefulgraph] - [tinkergraph[vertices:809 edges:8049 directory:data/graph-example-2]]
[INFO] DefaultRexsterApplication - Shutting down [emptygraph] - [mocktinkertransactionalgraph[vertices:0 edges:0]]
[INFO] ShutdownManager - ShutdownListener com.tinkerpop.rexster.Application$1@4a93837b complete
[INFO] ShutdownManager - Calling ShutdownListener: ShutdownListener [bindHost=/127.0.0.1, port=8183]
[INFO] ShutdownManager$ShutdownSocketListener - Caught SocketException on shutdownSocket, assuming close() was called: java.net.SocketException: socket closed
[INFO] ShutdownManager - ShutdownListener ShutdownListener [bindHost=/127.0.0.1, port=8183] complete
[INFO] ShutdownManager - Calling ShutdownListener: JVM Shutdown Hook Remover
[INFO] ShutdownManager - ShutdownListener JVM Shutdown Hook Remover complete