Brew Redis



Redis is a fast, versatile in-memory key-value store. With its rapid response, it is mainly used in the caching layer.

  • The Missing Package Manager for macOS (or Linux). It’s all Git and Ruby underneath, so hack away with the knowledge that you can easily revert your modifications and merge upstream updates.
  • To set a new instance of redis, all you need is a new redis config file, start redis with that config file and you will have a second redis instance up and running. Copy the default redis config file that is used for the default redis instance.
  • Redis 5.0 is the first version of Redis to introduce the new stream data type with consumer groups, sorted sets blocking pop operations, LFU/LRU info in RDB, Cluster manager inside redis-cli, active defragmentation V2, HyperLogLogs improvements and many other improvements. Redis 5 was release as GA in October 2018.

What is Redis Server?

Using Homebrew will save you lot of times in setting up and configuring the development environment on macOS. If you don’t have it in your Mac, try installing using the guideline here. There are two ways to start Redis server. Either you can start Redis as a service so that it will keep running in the background with the following command: brew services start redis Or, if you don't want a background service you can just run below command.

Redis stands for Remote Dictionary, and was founded when its founder Salvatore Sanfilippo wanting to improve his startup's scalability. As traditional database systems have major issues scaling some types of workloads, Redis was created to adress those concerns, working as a store and a cache at the same time.

Brew redis-cli

Unlike traditional applications, Redis always modifies and stores data on the main computer memory. Though it stores some data on the disk that's unsuitable for RAM, it reconstructs it back into memory once the computer restarts. This makes it fast and there for very popoular among key-value databases.

In this tutorial, you will learn how to install the Redis server on Ubuntu 20.04 LTS, as well as how to secure it with a password and TLS encryption and perform some redis server config.

Preparing Our VPS Server

Let's prepare our server for our setup; after connecting , you will update the local package index and upgrade any packages that are outdated.

First, we run the apt-get update command as follows:

An output similar to the following (cut for brevity) will be displayed, and indexes will be updated.

Now with the following command, you will upgrade outdated packages.

The output will look like this:

How to build Redis server in Ubuntu 20.04

The first step in the Redis build process is installing the dependencies required to complete it.

Now, change directory to /tmp.

Download Redis' latest stable version as follows.

Extract the archive using the tar command.

Change to the newly created directory.

Compile Redis server using the make command with two options, one definining the malloc library, and the other enabling TLS support.

An output like below will be displayed:

How to Install Redis server

Once the build is successfull you can continue the Redis install process.

First you need to create a user for Redis server. This user doesn't need to login and doesn't need to have a home directory.

Change directory to build artifacts i.e. src.

Copy executable files to /usr/local/bin so they are in the system path.

Create a data directory for Redis server, change the ownership to redis user, and make sure only redis user and redis group are able to read and write.

Create a directory to hold the logs.

Create a directoy to hold the pid file.

Finally, create a directory for configuration files.

Change directory to the source.

Copy the distributed configuration file to the redis configiration directory.

Create a file to be used for systemd to manage the Redis server service.

Paste the following and save and exit (using Ctrl-x)

How to perform Redis server config

The first step in Redis configuration is to copy the distribution configuration so we have a backup:

Open the Redis config, redis.conf with your favorite editor. This guide uses nano.

Change the supervised setting to systemd as we are using a systemd based distribution.

Set the daemonize option to yes.

Make sure Redis server listens on all IP addresses so other servers can reach. If you are setting up a local Redis server you can skip this step.

Set the pidfile directive to the correct path.

Set the logfile directive to the correct path.

Set the data folder to the correct path.

Save and exit (using Ctrl-x)

Brew redis version

Securing Redis server with password

In this step, you will configure Redis server with a password so that only authenticated clients are allowed.

Generate a random password using the openssl command.

Brew Redis Reviews

A similar output to below will be shown.

Open redis.conf with the editor.

Paste the following at the end of the file. This defines the password required to authenticate.

Save and exit (using Ctrl-x)

Secure Redis server with TLS

In this section, you will generate a key/certificate pair to secure the communication between Redis server and client.

First you will create the certificate and the key using the openssl command

After generating the required certificate, go ahead and edit the configuration file.

With the following lines you point it to the certificate, key file and system certificate authority file.

Now, disallow clients that don't use TLS.

Brew Redis Config

Disable non-TLS services.

Enable TLS based service on default Redis port.

Save and exit (using Ctrl-x)

Restart the Redis server.

Check the status of the Redis server.

An output similar to the following will be displayed:

Brew Redis Beer

Now you can connect to your Redis server via redis-cli client.

When setting a key/value pair, the server points out that authentication is required.

Authenticate using the auth command and the password you set earlier.

Authentication is successful.

Brew Redis Stop

Now you can set the key test with value hello world.

Operation is a success.

Now you can retreive the value.

Conclusion

You have now learned to install Redis on Ubuntu, as well as how to configure it and secure it with password authentication and client-server encryption.

Your secure Redis server is ready to use.

References

For a fast, private VPS to use with your Redis serverinstall, sign up to BitLaunch here.

πŸš€πŸš€πŸš€ A faster, better and more stable redis desktop manager, compatible with Linux, windows, mac. What's more, it won't crash when loading a large number of keys.

Windows

Download latest exe package from release [or gitee in China], double click to install.

Linux

Download latest AppImage package from release [or gitee in China], chmod +x, double click to run.

Mac

  • Download latest dmg package from release [or gitee in China], double click to install.
  • Or by brew: brew install --cask another-redis-desktop-manager
  • Or sponsor by app store, It's not free, and I will be very grateful to you.

Enjoy!

Feature Log

  • 2021-02-28: Connection Color Tag && Search History Support
  • 2021-02-03: Multiple SelectDelete && Msgpack Viewer Support
  • 2020-12-30: Tree View Support!!!
  • 2020-11-03: Binary View Support && SSH PassparseTimeout Support
  • 2020-09-04: SSH Cluster Support && Extension Commands Support
  • 2020-06-18: SSL/TLS Support!!!
  • 2020-04-28: Page Zoom && Big Key Loads With Scan && Auto Json
  • 2020-04-18: Unvisible KeyValue Format Support
  • 2020-04-04: Cluster Support!!!
  • 2020-03-13: Dark Mode Support!!! && JsonView In Other Place
  • 2020-02-16: SSH Private Key Support
  • 2020-02-13: Open Cli Console In Tabs
  • 2019-06-14: Custom Font-Family Support
  • 2019-05-28: Key List Resizable
  • 2019-05-09: Search Support In Hash List Set Zset
  • 2019-04-26: Auto Updater
  • 2019-04-09: SSH Tunnel Connection Support
  • 2019-04-01: Extract Search Support
  • 2019-02-22: Single Connection Support
  • 2019-01-08: Project Start

Dev Build Setup

Linux Or Mac

If linux errors like this:

Windows

Build Package

Sponsor

Brew Redis Meaning

  • Give me a star ⭐!

  • Through OpenCollective

  • Through Paypal

  • If you are a Mac user, you can purchase this software from the app store to sponsor, and then let the app store automatically update it for you.

  • Wechat sponsor code

Contributors

This project exists thanks to all the people who contribute.

License

Support