EliasDB is a graph-based database which aims to provide a lightweight solution for projects which want to store their data as a graph.
- Build on top of a custom key-value store which supports transactions and memory-only storage.
- Data is stored in nodes (key-value objects) which are connected via edges.
- Stored graphs can be separated via partitions.
- Stored graphs support cascading deletions - delete one node and all its "children".
- All stored data is indexed and can be quickly searched via a full text phrase search.
- EliasDB has a GraphQL interface which can be used to store and retrieve data.
- For more complex queries EliasDB has an own query language called EQL with an sql-like syntax.
- Includes a scripting interpreter to define alternative actions for database operations or writing backend logic.
- Written in Go from scratch. Only uses gorilla/websocket to support websockets for GraphQL subscriptions.
- The database can be embedded or used as a standalone application.
- When used as a standalone application it comes with an internal HTTPS webserver which provides user management, a REST API and a basic file server.
- When used as an embedded database it supports transactions with rollbacks, iteration of data and rule based consistency management.
Getting Started (standalone application)
You can download a pre-compiled package for Windows (win64) or Linux (amd64) here.
Extract it and execute the executable with:
The executable should automatically create 3 subfolders and a configuration file. It should start an HTTPS server on port 9090. To see a terminal point your webbrowser to:
After accepting the self-signed certificate from the server you should see a web terminal. EliasDB can be stopped with a simple CTRL+C or by overwriting the content in eliasdb.lck with a single character.
Getting Started (docker image)
You can pull the latest docker image of EliasDB from Dockerhub:
docker pull krotik/eliasdb
Create an empty directory, change into it and run the following to start the server:
docker run --user $(id -u):$(id -g) -v $PWD:/data -p 9090:9090 krotik/eliasdb server
This exposes port 9090 from the container on the local machine. All runtime related files are written to the current directory as the current user/group.
Connect to the running server with a console by running:
docker run --rm --network="host" -it -v $PWD:/data --user $(id -u):$(id -g) -v $PWD:/data krotik/eliasdb console
To get an idea of what EliasDB is about have a look at the tutorial. This tutorial will cover the basics of EQL and show how data is organized.
There is a separate tutorial on using ELiasDB with GraphQL.
The terminal uses a REST API to communicate with the backend. The REST API can be browsed using a dynamically generated swagger.json definition (https://localhost:9090/db/swagger.json). You can browse the API of EliasDB's latest version here.
EliasDB supports a scripting language called ECAL to define alternative actions for database operations such as store, update or delete. The actions can be taken before, instead (by calling
db.raiseGraphEventHandled()) or after the normal database operation. The language is powerful enough to write backend logic for applications.
EliasDB supports to be run in a cluster by joining multiple instances of EliasDB together. You can read more about it here.
Command line options
The main EliasDB executable has two main tools:
Usage of ./eliasdb <tool>
EliasDB graph based database
console EliasDB server console
server Start EliasDB server
The most important one is server which starts the database server. The server has several options:
Usage of ./eliasdb server [options]
Export the current database to a zip file
Show this help message
Import a database from a zip file
Do not start the server after initialization
EnableECALScripts configuration option is set the following additional option is available:
Start an interactive interpreter console for ECAL
The interactive console can be used to inspect and modify the runtime state of the ECAL interpreter.
Once the server is started the console tool can be used to interact with the server. The options of the console tool are:
Usage of ./eliasdb console [options]
Execute a single line and exit
Read commands from a file and exit
Show this help message
Host of the EliasDB server (default "localhost")
Port of the EliasDB server (default "9090")
On the console type 'q' to exit and 'help' to get an overview of available commands:
export Exports the last output.
find Do a full-text search of the database.
help Display descriptions for all available commands.
info Returns general database information.
part Displays or sets the current partition.
ver Displays server version information.
It is also possible to directly run EQL and GraphQL queries on the console. Use the arrow keys to cycle through the command history.
EliasDB uses a single configuration file called eliasdb.config.json. After starting EliasDB for the first time it should create a default configuration file. Available configurations are:
|Cluster configuration file.
|File which is used to store the console history.
|File which is used to store the cluster state.
|Lifetime for cookies used by EliasDB.
|Hostname the ECAL debug server should listen to.
|Port on which the debug server should listen on.
|Entry script for ECAL interpreter.
|Logfile for ECAL interpreter. An empty string will cause the logger to write to the console.
|Log level for ECAL interpreter. Can be debug, info or error.
|Directory for ECAL scripts.
|Number of worker threads in the ECA engine's thread pool.
|Flag if access control for EliasDB should be enabled. This provides user authentication and authorization features.
|Flag if EliasDB clustering support should be enabled. EXPERIMENTAL!
|Flag if the cluster terminal file /web/db/cluster.html should be created.
|Flag if the ECAL debug server should be started. Note: This will slow ECAL performance significantly.
|Flag if ECAL scripts should be executed on startup.
|Flag if the datastore should be open read-only.
|Flag if the files in the webfolder /web should be served up by the webserver. If false only the REST API is accessible.
|Flag if the web terminal file /web/db/term.html should be created.
|Name of the webserver certificate which should be used. A new one is created if it does not exist.
|Hostname the webserver should listen to. This host is also used in the dynamically generated swagger definition.
|Name of the webserver private key which should be used. A new one is created if it does not exist.
|Port on which the webserver should listen on.
|File which is used to store access control information. This file can be edited while the server is running and changes will be picked up immediately.
|Directory for datastore files.
|Directory for the webserver's SSL related files.
|File which is used to store (hashed) user passwords.
|Directory of the webserver's webfolder.
|Lockfile for the webserver which will be watched duing runtime. Replacing the content of this file with a single character will shutdown the webserver gracefully.
|Flag if the datastore should only be kept in memory.
|EQL queries create result sets which are cached. The value describes the amount of time in seconds a result is kept in the cache.
|EQL queries create result sets which are cached. The value describes the number of results which can be kept in the cache.
Note: It is not (and will never be) possible to access the REST API via HTTP.
Enabling Access Control
It is possible to enforce access control by enabling the
EnableAccessControl configuration option. When started with enabled access control EliasDB will only allow known users to connect. Users must authenticate with a password before connecting to the web interface or the REST API. On the first start with the flag enabled the following users are created by default:
|Default unprivileged user
Users can be managed from the console. Please do either delete the default users or change their password after starting EliasDB.
Users are organized in groups and permissions are assigned to groups. Permissions are given to endpoints of the REST API. The following permissions are available:
|Allowed HTTP Request Type
|Creating new data
|Modify existing data
The default group permissions are:
To build EliasDB from source you need to have Go installed (go >= 1.12):
- Create a directory, change into it and run:
git clone https://devt.de/krotik/eliasdb/ .
- You can build EliasDB's executable with:
go build cli/eliasdb.go
Building EliasDB as Docker image
EliasDB can be build as a secure and compact Docker image.
- Create a directory, change into it and run:
git clone https://devt.de/krotik/eliasdb/ .
- You can now build the Docker image with:
docker build --tag krotik/eliasdb .
- Chat - A simple chat application showing node modification via ECAL script, user management and subscriptions.
- Data-mining - A more complex application which uses the cluster feature of EliasDB and GraphQL for data queries.
- Game - A multiplayer game example using ECAL for simulating the game scene in the backend.
- A design document which describes the different components of the graph database. Link
- A reference for EliasDB's custom query language EQL. Link
- A reference for EliasDB's support for GraphQL. Link
- A quick overview of what you can do when you embed EliasDB in your own Go project. Link
EliasDB source code is available under the Mozilla Public License.
Package api contains general REST API definitions.
|Package api contains general REST API definitions.
Package ac contains management code for access control.
|Package ac contains management code for access control.
Package v1 contains EliasDB REST API Version 1.
|Package v1 contains EliasDB REST API Version 1.
Package cluster contains EliasDB's clustering code.
|Package cluster contains EliasDB's clustering code.
Package manager contains the management code for EliasDB's clustering feature.
|Package manager contains the management code for EliasDB's clustering feature.
Package console contains the console command processor for EliasDB.
|Package console contains the console command processor for EliasDB.
Package ecal contains the main API for the event condition action language (ECAL).
|Package ecal contains the main API for the event condition action language (ECAL).
Package dbfunc contains EliasDB specific functions for the event condition action language (ECAL).
|Package dbfunc contains EliasDB specific functions for the event condition action language (ECAL).
Package eql contains the main API for EQL.
|Package eql contains the main API for EQL.
Package interpreter contains the EQL interpreter.
|Package interpreter contains the EQL interpreter.
Package parser contains the EQL parser.
|Package parser contains the EQL parser.
Package graph contains the main API to the graph datastore.
|Package graph contains the main API to the graph datastore.
Package data contains classes and functions to handle graph data.
|Package data contains classes and functions to handle graph data.
Package graphstorage contains classes which model storage objects for graph data.
|Package graphstorage contains classes which model storage objects for graph data.
Package util contains utility classes for the graph storage.
|Package util contains utility classes for the graph storage.
Package graphql contains the main API for GraphQL.
|Package graphql contains the main API for GraphQL.
Package interpreter contains the GraphQL interpreter for EliasDB.
|Package interpreter contains the GraphQL interpreter for EliasDB.
Package hash provides a HTree implementation to provide key-value storage functionality for a StorageManager.
|Package hash provides a HTree implementation to provide key-value storage functionality for a StorageManager.
Package server contains the code for the EliasDB server.
|Package server contains the code for the EliasDB server.
Package storage contains the low-level API for data storage.
|Package storage contains the low-level API for data storage.
Package file deals with low level file storage and transaction management.
|Package file deals with low level file storage and transaction management.
Package paging contains functions and constants necessary for paging of records.
|Package paging contains functions and constants necessary for paging of records.
Package view contains general page view constants and functions.
|Package view contains general page view constants and functions.
Package slotting contains managers which deal with slots on pages.
|Package slotting contains managers which deal with slots on pages.
Package pageview contains object wrappers for different page types.
|Package pageview contains object wrappers for different page types.
Package util contains utility functions for slot headers.
|Package util contains utility functions for slot headers.