Guides / Storage

Run a graph database

This guide creates a GraphDatabase, queries it from a VPC, and suggests how to lay out your data. A GraphDatabase is a distributed graph database that you query with openCypher over Bolt or HTTP.

Its data is divided into regions kept in Etorm storage. Its servers sleep when idle, so an idle database costs only the storage it holds.

Access is by invitation. To ask for it, write to us. Until the engine is enabled for your project, a new GraphDatabase stays Pending with reason EngineNotAvailable. You do not need to do anything while it waits.

1. Create a database

kubectl apply -f - <<EOF
apiVersion: graphdatabase.etorm.com/v1alpha1
kind: GraphDatabase
metadata: {name: crm}
spec:
  vpcRef: {name: lan}
EOF
kubectl get graphdatabase crm -o jsonpath='{.status.phase} {.status.endpoints.bolt.address}{"\n"}'

The platform makes the password and shows it once, in the response that creates the database (status.password). To get a new one, raise spec.passwordGeneration.

A few more fields shape the database. spec.sizeClass bounds the servers, and auto grows with the data. spec.maxRegions bounds the number of regions. spec.consistency is strong, or bounded with staleSeconds.

2. Query it

From a member of the VPC, send openCypher to the HTTP endpoint on port 7474, or connect a Bolt driver on port 7687:

curl -u app:$PASSWORD -H 'Content-Type: application/json' \
  -d '{"statement": "MATCH (t:Ticket {status: $s}) RETURN t.uid LIMIT 10", "parameters": {"s": "open"}}' \
  http://[$ADDRESS]:7474/query

A person or a service account can sign in with an Etorm token instead of the password, if they hold the role graphdatabase-user on the database, or graphdatabase-reader for reads only. Each statement is one transaction. A write conflict is retried for you a few times, and after that it is reported as a transient error that you can retry.

Lay out your data

The database stores nodes with labels and properties, and relationships with a type. We suggest these conventions, which keep a graph simple to query and to extend:

What it costs

You pay for storage and processor time, on two meters. graphdatabase-storage-gib-second counts the bytes the database holds, and graphdatabase-cpu-second counts the processor time of its servers. A database with no traffic uses no processor time. Both meters are currently priced at 0.

Limits

Admission refuses read followers (replicas) and snapshots (backup). Each statement is its own transaction. Aggregation runs in the query servers, not in storage. The language engine does not support shortestPath or spatial types.