Connect to Gremlin Server
Warning
This walkthrough runs Gremlin Server with its default Groovy script engine and is meant for local development only. If anyone other than you can reach Graph Explorer or the server, see Self-hosted Gremlin Server.
If you are using the default Gremlin Server docker image, you can get the server running with the following commands:
docker pull tinkerpop/gremlin-server:latestdocker run -p 127.0.0.1:8182:8182 \ tinkerpop/gremlin-server:latest \ conf/gremlin-server-rest-modern.yamlThen open Graph Explorer and add a new connection with the following settings:
- Name:
Gremlin Server - Database URL:
http://localhost:8182 - Query Language:
Gremlin - Connection method: Through the Graph Explorer server
These settings work when the Graph Explorer server runs on your machine. If Graph Explorer runs in a Docker container, localhost is that container rather than your machine, so the connection is refused. See Graph Explorer in Docker.
Graph Explorer in Docker
Section titled “Graph Explorer in Docker”Put both containers on a shared Docker network, so Graph Explorer reaches Gremlin Server by its container name and Gremlin Server’s port stays unpublished.
docker network create graph-explorer-netdocker run --network graph-explorer-net --name gremlin-server \ tinkerpop/gremlin-server:latest \ conf/gremlin-server-rest-modern.yamlStart Graph Explorer as in Deploy with Docker with --network graph-explorer-net added to its docker run command. To attach a container that’s already running, use docker network connect graph-explorer-net graph-explorer.
Then add a connection with these settings:
- Name:
Gremlin Server - Database URL:
http://gremlin-server:8182 - Query Language:
Gremlin - Connection method: Through the Graph Explorer server
The Air Routes sample sets up the same arrangement with Docker Compose.
Alternatively, run Gremlin Server with its port published on 127.0.0.1 as above and connect with Directly from your browser to http://localhost:8182. See Connect directly from the browser.
Enable REST
Section titled “Enable REST”Graph Explorer only supports HTTP(S) connections. When connecting to Gremlin-Server, ensure it is configured with a channelizer that supports HTTP(S) (i.e. Channelizer Documentation).
Tip
The Gremlin Server configuration can be usually found at:
/conf/gremlin-server.yamlConnect directly from the browser
Section titled “Connect directly from the browser”With Connection method set to Directly from your browser, your browser sends queries to Gremlin Server itself instead of going through the Graph Explorer server. Gremlin Server’s HTTP endpoint allows cross-origin requests from any site by default. It leaves the CORS headers off error responses, so a failed query shows as Database not reachable from the browser. To see the server’s error message, use Through the Graph Explorer server.
- The browser must be able to reach the Database URL. A server in a Docker container on your machine needs its port published to the host.
- When Graph Explorer is served over HTTPS, the browser usually blocks an
http://Database URL unless it points at a loopback host such aslocalhost. See Insecure Database URL.
A direct connection needs your browser to reach Gremlin Server, and every other site open in that browser can then reach it too, even when it listens only on localhost. Gremlin Server’s default Groovy script engine evaluates scripts from any of those sites, so weigh that before choosing this method. See Self-hosted Gremlin Server.
Versions Prior to 3.7
Section titled “Versions Prior to 3.7”If you have a version of Gremlin Server prior to 3.7, you will need to make the following changes:
- Enable property returns - Remove “.withStrategies(ReferenceElementStrategy)” from
/scripts/generate-modern.groovyso that properties are returned. - Enable string IDs - Change
gremlin.tinkergraph.vertexIdManagerandgremlin.tinkergraph.edgeIdManagerin/conf/tinkergraph-empty.propertiesto support string ids. You can useANY. - Build and run the Docker container as normal.