Learn How to Install and Configure Redis on Fedora
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.
1) Installing Redis
2) Configuring Redis
3) Verifying Redis is configured correctly
4) Benchmarking Redis.
Step 1: Installing Redis
dnf install redis -yOnce installed, you can start and activate the Redis service by running the following command:
systemctl enable --now redisTo confirm that the Redis service is running, enter the following command in your terminal:
systemctl status redisThis 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 redisAfter 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
nano /etc/redis/redis.confOnce 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 cliYou 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-benchmark -a yourpass -h 127.0.0.1 -qThe 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 20This 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 --latencyThis will show the minimum, maximum, and average latency stats for your Redis server based on the samples taken.
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.