Skip to content

Redis Graph

This project is a Redis module that implements a graph database. Nodes in the graph represent entities such as persons or places, and connections such as 'visit' are made between the different entities.

Suppose we had a person entity representing Barack Obama, it might have two attributes: "age" (55) and "profession" (ex-president). We could also have another entity represent Hawaii with an attribute "population" (1442949). Finally we could construct a simple graph by connecting Barack Obama with an edge representing the relation "born" with Hawaii.

Primary features:

  • A graph database implementation
  • Nodes and edges may have attributes
  • Nodes and edges can be labeled
  • Supports openCypher graph queries

To see Redis Graph in action see Demos.


  1. Build the Redis Graph module library
  2. Load Redis Graph to Redis
  3. Use it from any client

Building the module

Linux Ubuntu 16.04


  • The Redis Graph repository: git clone
  • The build-essential and cmake packages: apt-get install build-essential cmake

To build the module, run make in the project's directory

Congratulations! You can find the compiled module library at src/

Loading the module to Redis


We recommend you have Redis load the module during startup by adding the following to your redis.conf file:

loadmodule /path/to/module/src/

In the line above replace /path/to/module/src/ with the actual path to the module's library. Alternatively, you can have Redis load the module using the following command line argument syntax:

~/$ redis-server --loadmodule /path/to/module/src/

Lastly, you can also use the MODULE LOAD command. Note, however, that MODULE LOAD is a dangerous command and may be blocked/deprecated in the future due to security considerations.

Once the module has been loaded successfully, the Redis log should have lines similar to:

30707:M 20 Jun 02:08:12.314 * Module 'graph' loaded from <redacted>/src/

Using Redis Graph

Before using Redis Graph, you should familiarize yourself with its commands and syntax as detailed in the commands reference document.

You can call Redis Graph's commands from any Redis client.

With redis-cli

$ redis-cli> GRAPH.QUERY social "CREATE (:person {name: 'roi', age: 32, gender: 'male', status: 'married'})"

With any other client

You can call the module's API using your client's ability to send raw Redis commands. Depending on your client of choice, the exact method for doing that may vary.

Python example

This code snippet shows how to use Redis Graph with raw Redis commands from Python with redis-py:

import redis

r = redis.StrictRedis()
reply = r.execute_command('GRAPH.QUERY', 'social', "CREATE (:person {name:'roi', age:32, gender:'male', status:'married')")

Client libraries

Some languages have client libraries that provide support for Redis Graph's commands:

Project Language License Author URL
redisgraph-py Python BSD Redis Labs GitHub