billysoftacademy.com

Learn How to Install and Configure Redis on Fedora

Introduction

Redis is a type of data store that operates in-memory and is commonly utilized to keep track of metadata related to user profiles, authentication data, and manifest files. Typically, it is employed as a quick-response database or application cache. This technology is optimized for real-time applications, including financial services, ad-tech, and gaming. One of the advantages of Redis is that it enables developers to minimize the amount of code required to store, access, and manage data within their applications. In the following article, we will provide a guide on how to install Redis on Fedora Linux.

Requirements

In order to install and configure Redis on Fedora successfully, the following is a list of items that are needed:
1) A desktop or laptop with atleast 4 GB RAM, a dual core processor and 50GB of free disk space
2) An SSH client such as Putty
3) Fedora 39 Workstation or Server Edition
4) For cloud deployment a fully qualified domain name and a public static IP address is also needed
5) A stable internet connection.

Overview

The following is an overview of the steps covered in this tutorial:
1) Installing Redis
2) Configuring Redis
3) Verifying Redis is configured correctly
4) Benchmarking Redis.

Step 1: Installing Redis

The Fedora default repository comes with Redis pre-installed, and you can initiate the installation process by executing the following command in your terminal:
dnf install redis -y
Once installed, you can start and activate the Redis service by running the following command:
systemctl enable --now redis
To confirm that the Redis service is running, enter the following command in your terminal:
systemctl status redis
This should display the Redis service status. Once Redis is launched, it will be actively accepting incoming connections on port 6379. In order to verify the status of the connection, you could execute the following command:
ss -antpl | grep -i redis
After running this command, it will output the following information:
LISTEN 0 511 127.0.0.1:6379 0.0.0.0:* users:((“redis-server”,pid=4066,fd=6))
LISTEN 0 511 [::1]:6379 [::]:* users:((“redis-server”,pid=4066,fd=7))

Step 2: Configuring Redis

Redis can be configured by modifying the default configuration file located at /etc/redis/redis.conf. In order to ensure that your Redis instance is secure, you will need to make some changes to this file. To do this, you can use a text editor such as nano to open the file:
nano /etc/redis/redis.conf
Once the file is open, you will need to make the following changes: – Change the bind line to include the IP address you want to bind to: bind 0.0.0.0 – Set a password for the Redis instance by modifying the requirepass line: requirepass yourpass – Enable the appendonly option and set the filename for the appendonly file:
appendonly yes
appendfilename "appendonly.aof"
After making these changes, save and close the file. In order to apply these changes, you will need to restart the Redis service:
systemctl restart redis

Step 3: Verifying Redis is configured correctly

After completing the installation and configuration process of Redis, proceed to connect to Redis instance utilizing the command:

redis cli
You can authenticate Redis by entering your password using the command ‘AUTH yourpass’ after opening Redis CLI. Subsequently, you can test the connectivity by running the command ‘PING’ and it should return ‘PONG’ as the output. To retrieve Redis server information, run the command ‘INFO Server’ and it will provide server information such as Redis version, system architecture, process ID, uptime, and configuration file path.

Step 4: Benchmarking Redis

Redis has a benchmark tool that can be used to measure performance by sending a predefined number of requests to the server. To check the number of requests per second that Redis can handle, run the following command:
 redis-benchmark -a yourpass -h 127.0.0.1 -q
The output will show the average number of requests per second that Redis can handle for various operations such as PING, SET, GET, INCR, LPUSH, RPUSH, LPOP, RPOP, SADD, HSET, SPOP, and ZADD. If you want to use 20 parallel connections to run SET requests on the server, you can use the -c and -t options with the following command:
 redis-benchmark -a yourpass -h 127.0.0.1 -p 6379 -n 100000 -c 20
This command will show the latency by percentile distribution for the requests completed. If you want to see real-time latency stats for your Redis server, you can run the following command:
redis-cli --latency
This will show the minimum, maximum, and average latency stats for your Redis server based on the samples taken.

Conclusion

In this guide, we have provided a comprehensive overview of installing and configuring Redis on Fedora Linux. By following the steps outlined in this tutorial, you will be able to set up a functional and secure Redis instance that can be used to improve the performance and efficiency of your applications. We have also covered how to verify the configuration and benchmark the performance of your Redis server, ensuring that it meets your specific needs.

Remember, Redis is a powerful tool that can offer significant benefits to developers and system administrators alike. By taking the time to learn and understand how to use Redis effectively, you can unlock its full potential and create applications that are both fast and responsive.

We encourage you to experiment with Redis and explore its diverse range of features. With its simple yet powerful capabilities, Redis can be a valuable asset in your development toolkit.

Additionally, it is important to consider the following points:

1. This guide was specifically written for Fedora 39 Workstation or Server Edition. The steps may vary slightly for other distributions or versions of Fedora.
2. Security is important when configuring Redis. Make sure to follow the recommended security practices outlined in the documentation.
3. The benchmark results will vary depending on your hardware and configuration. Use the benchmark results as a general guideline to assess the performance of your Redis server.

We hope this guide has been helpful. Please visit the home page for more helpful tutorials and how-to-guides.

Scroll to Top