Skip to content

Installation

DiceDB is an in-memory real-time database with SQL-based reactivity. It is hyper-optimized for building and scaling truly real-time applications on modern hardware while being a drop-in replacement for Redis.

Note: DiceDB is still in development and it supports a subset of Redis commands. So, please do not use it in production. But, feel free to go through the open issues and contribute to help us speed up the development.

How is it different from Redis?

  1. DiceDB is multi-threaded and follows shared-nothing architecture.
  2. DiceDB supports a new command called QWATCH that lets clients listen to a SQL query and get notified in real-time whenever something changes.

With this, you can build truly real-time applications like Leaderboard with simple SQL query.

Leaderboard with DiceDB

Get started

Using Docker

The easiest way to get started with DiceDB is using Docker by running the following command.

$ docker run dicedb/dicedb

The above command will start the DiceDB server running locally on the port 7379 and you can connect to it using DiceDB CLI and SDKs, or even Redis CLIs and SDKs.

Note: Given it is a drop-in replacement of Redis, you can also use any Redis CLI and SDK to connect to DiceDB.

Setting up DiceDB from source for development and contributions

To run DiceDB for local development or running from source, you will need

  1. Golang
  2. Any of the below supported platform environment:
    1. Linux based environment
    2. OSX (Darwin) based environment
    3. WSL under Windows
$ git clone https://github.com/dicedb/dice
$ cd dice
$ go run main.go
  1. Install GoLangCI
$ sudo su
$ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /bin v1.60.1

Live Development Server

DiceDB provides a hot-reloading development environment, which allows you to instantly view your code changes in a live server. This functionality is supported by Air

To Install Air on your system you have following options.

  1. If you’re on go 1.22+
Terminal window
go install github.com/air-verse/air@latest
  1. Install the Air binary
Terminal window
# binary will be installed at $(go env GOPATH)/bin/air
curl -sSfL https://raw.githubusercontent.com/air-verse/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin

Once air is installed you can verify the installation using the command air -v

To run the live DiceDB server for local development:

Terminal window
$ git clone https://github.com/dicedb/dice
$ cd dice
$ air

Setting up CLI

The best way to connect to DiceDB is using DiceDB CLI and you can install it by running the following command.

$ pip install dicedb-cli

Because DiceDB speaks Redis dialect, you can connect to it with any Redis Client and SDK also. But if you are planning to use the QWATCH feature then you need to use the DiceDB CLI.