Saturday, December 28, 2024
Google search engine
HomeData Modelling & AIHow To Install Redis on Debian 11 / Debian 10

How To Install Redis on Debian 11 / Debian 10

In this article we will discuss how to Install Redis onDebian 11 / Debian 10. Redis is an Open Source in-memory data structure store. It can be used as a message broker, a database server, or for caching data in memory for faster retrieval.

Redis has support for the following data structures:

  • Hashes
  • sets with range queries
  • Strings
  • sorted lists
  • Hyperloglogs
  • Bitmaps
  • Geospatial indexes e.t.c

Use below simple and easy steps to install Redis onDebian 11 / Debian 10 Linux server or Desktop.

Step 1: Update system

Login to your server where you’ll install Redis and run the commands below.

sudo apt -y update
sudo apt -y upgrade

Step 2: Install Redis Server

The default Debian apt repositories have redis server packages. The following commands should be sufficient for the installation.

sudo apt -y install redis-server

Once the package is installed, start it and set start at boot for the service.

sudo systemctl enable --now redis-server.service

Step 3: Configure Redis on Debian

The main Redis configuration file is located in /etc/redis/redis.conf. The default configuration parameters should work fine for simple installations. If you want to tune your Redis setup on Debian 10, you’ll have to make some changes.

sudo vim /etc/redis/redis.conf

Enable network Listen for Redis Service (Optional)

For network clients to connect to your Redis server, it needs the service to listen on a network IP Address.

Open the file /etc/redis/redis.conf with your favorite text editor

sudo vim /etc/redis/redis.conf

Then change line  bind 127.0.0.1 to your server IP address, e.g.

bind 172.12.10.11

To allow listen on all interfaces, use:

bind 0.0.0.0

Restart redis service after making the change:

sudo systemctl restart redis-server

Configure Redis Authentication – (Optional but recommended)

Configure Redis Authentication for clients to require AUTH <PASSWORD> before processing any other commands.

requirepass  <AuthPassword>

Example:

requirepass oOlaiY90BA

Set Redis Persistent Store for Recovery (Optional)

Set persistence mode by changing the appendonlyvalue to yes

appendonly yes
appendfilename "appendonly.aof"

Restart redis service after making the changes

sudo systemctl restart redis-server

Confirm service is running:

Step 4: Test connection to Redis Server

Confirm that you can connect to redis locally:

$ redis-cli
127.0.0.1:6379>

Test authenticate:

127.0.0.1:6379> AUTH <AuthPassword>
OK

You should receive OK in the output. If you input a wrong password, Authentication should fail:

127.0.0.1:6379> AUTH WrongPassword
(error) ERR invalid password

Check redis information.

127.0.0.1:6379>  INFO

This will output a long list of data. You can limit the output by passing Section as an argument.

127.0.0.1:6379> INFO Server
# Server
redis_version:5.0.3
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:355ed63f25401f51
redis_mode:standalone
os:Linux 4.19.0-4-amd64 x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:8.2.0
process_id:1629
run_id:efd3072970e2d29cc842eca0399b64e9044aa1e6
tcp_port:6379
uptime_in_seconds:56
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:2422257
executable:/usr/bin/redis-server
config_file:/etc/redis/redis.conf

Enjoy using Redis on Debian 11 / Debian 10 and check our monitoring guide:

RELATED ARTICLES

Most Popular

Recent Comments