logo
icon

Redis

Redis is an in-memory database that persists on disk.

PlatformZeabur
Deployed939
Publisheryuaanlin
Deployed939 times
Publisheryuaanlin
Created2024-06-03
Services
service icon
Tags
Database

What is Redis?

Redis is often referred to as a data structures server. What this means is that Redis provides access to mutable data structures via a set of commands, which are sent using a server-client model with TCP sockets and a simple protocol. So different processes can query and modify the same data structures in a shared way.

Data structures implemented into Redis have a few special properties:

  • Redis cares to store them on disk, even if they are always served and modified into the server memory. This means that Redis is fast, but that it is also non-volatile.
  • The implementation of data structures emphasizes memory efficiency, so data structures inside Redis will likely use less memory compared to the same data structure modelled using a high-level programming language.
  • Redis offers a number of features that are natural to find in a database, like replication, tunable levels of durability, clustering, and high availability.

Environment Variables

  • ${REDIS_CONNECTION_STRING}: The connection string for the Redis service.
  • ${REDIS_HOST}: The hostname of the Redis service.
  • ${REDIS_PORT}: The port of the Redis service.
  • ${REDIS_PASSWORD}: The password for the Redis service.

After you deploy the Redis service, Zeabur will automatically inject the relevant environment variables into other services.

You can also find the connection information in the “Instructions” section on the console.

Connecting to the Database

redis-cli

redis-cli is a command-line tool that allows you to interact with the Redis database. Using redis-cli, you can execute Redis commands in the command-line terminal or interactive mode.

After downloading and installing according to the documentation, return to Zeabur. Click on the Instructions tab in the Redis service, and click the copy button for Command to connect to your Redis to copy the connection address.

connect-path

Paste the copied command into the terminal and enter PING to test if the connection is successful:

test-connection

At this point, you can start operating Redis.