Skip to main content

Connecting with keydb-cli

This guide explains how to establish a connection between keydb-cli and a KeyDB database instance. It walks through the necessary setup, configuration, and execution of a simple KeyDB command from the terminal.

Variables

Certain parameters must be provided to establish a successful connection to a KeyDB database. Below is a breakdown of each required variable, its purpose, and where to find it. Here’s what each variable represents:

Variable

Description

Purpose

HOST

KeyDB hostname, from the Elestio service overview page

The address of the server hosting your KeyDB instance.

PORT

Port for KeyDB connection, from the Elestio service overview page

The network port used to connect to KeyDB. The default port is 6379.

PASSWORD

KeyDB password, from the Elestio service overview page

The authentication key required to connect securely to KeyDB.

These values can usually be found in the Elestio service overview details as shown in the image below. Make sure to take a copy of these details and use them in the command moving ahead.

Screenshot 2025-06-26 at 1.13.23 PM.jpg

Prerequisites

Install keydb-cli

Check if keydb-cli is installed by running:

keydb-cli --version

If not installed, you can install it via:

  • macOS:

brew install keydb
  • Ubuntu/Debian:

sudo add-apt-repository ppa:keydb/keydb
sudo apt-get update
sudo apt-get install keydb-tools
  • Windows:

Use Windows Subsystem for Linux (WSL) or download the CLI binaries from the KeyDB GitHub releases page.

Command

Once all prerequisites are set up, open the terminal or command prompt and run the following command:

keydb-cli -h HOST -p PORT -a PASSWORD

Replace HOST, PORT, and PASSWORD with the actual values from your Elestio KeyDB service.

If the connection is successful, the terminal will display a KeyDB prompt like this:

127.0.0.1:6379>

Test the Connection

You can then run a simple command to test the connection:

set testkey "Hello KeyDB"
get testkey

Expected output:

OK
"Hello KeyDB"

If the connection is successful, the terminal will display output similar to the above.