How to install the Redis in-memory database server on Ubuntu 22.04

Date:

Share:


Jack Wallen walks you through installing and configuring a single-node Redis server for your in-memory database server needs.

Image: ronstik/Adobe Stock

Redis is an open-source, in-memory key-value store that can be used as a powerful database server. Redis supports numerous data structures, such as strings, hashes, lists, sets, bitmaps, sorted sets and much more. And given that Redis stores everything in-memory, it’s blazingly fast. The one caveat to this is you’ll want to install it on a server with a fairly large amount of RAM.

What I’m going to do here is walk you through the process of getting a single node Redis server up and running. In a later tutorial, we’ll discuss setting up a Redis cluster, so you can gain high availability with your server.

Until then, let’s get that single instance server up and running.

SEE: Hiring Kit: Database engineer (TechRepublic Premium)

What you’ll need

I’ll be demonstrating with Ubuntu Server 22.04, so you’ll need an instance of that Linux distribution up and running—although you can install it on 20.04 as well—and a user with sudo privileges.

That’s it. Let’s get to work.

How to install Redis

The first thing you’ll want to do is update Ubuntu Server with the commands:

sudo apt-get update
sudo apt-get upgrade -y

If the kernel gets upgraded in the process, you’ll need to restart the machine, so the changes take effect.

Once the upgrade is complete, install Redis with:

sudo apt-get install redis-server -y

The installation shouldn’t take too much time. Before you start/enable the server, let’s take care of a couple of configurations.

How to configure Redis

Open the Redis configuration file with the command:

sudo nano /etc/redis/redis.conf

Look for the following line:

bind 127.0.0.1 ::1

We’ll configure Redis, so it listens on the IP address of the hosting server by changing that line to (editing it to reflect your server’s IP address):

bind 192.168.1.22 ::1

Next, look for the line:

supervised no

Change that line to:

supervised systemd

Save and close the file.

How to start and enable Redis

Redis is probably already running, so what we’ll do is restart it, so the configuration changes take effect, with the command:

sudo systemctl restart redis-server

Next, enable Redis, so it starts at boot with the command:

sudo systemctl enable redis-server

Verify that Redis is running with the command:

sudo systemctl status redis-server

Test to make sure Redis is listening with the command:

redis-cli -h 192.168.1.22 -p 6397

You should now find yourself on the Redis console. Test it with:

ping “Hello, TechRepublic!”

You should see “Hello, TechRepublic!” in the output.

Congratulations, you now have a Redis in-memory database server up and running. Next time around we’ll configure this for a cluster and join a node. Until then, you can start learning your way around the Redis command-line interface (CLI) by reading the official documentation.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.



Source link

━ more like this

Sweet relief as prices fall in time for Halloween – London Business News | Londonlovesbusiness.com

According to the British Retail Consortium (BRC) in the period between 1 to 7 October shop price inflation decreased to 1.0% year on...

PSA: X users have until November 10 to re-enroll their security keys

If you’re a former Twitter user still using and rely on a hardware security key for your two-factor authentication (2FA) method, you...

Scientist believes 3I/Atlas is a ‘an intelligent visitor from another solar system’ – London Business News | Londonlovesbusiness.com

Another scientist has come forward with a theory that the interstellar object 3I/Atlas is possibly an “intelligent visitor from another solar system.” Michio Kaku,...

Event ROI in Latin America: How data and tech are changing how brands measure success – London Business News | Londonlovesbusiness.com

Latin America has become a vibrant event hub, from trade fairs to virtual conferences. As its influence grows, understanding event ROI is more...

OpenAI completes corporate reorganization with support from Microsoft

OpenAI has completed its long, drawn-out reorganization into a public benefit corporation, the company announced today in a blog post attributed to board...
spot_img