Redis technology is using as a database in main memory to maintain the database, cache, and Message Broker. In fact, it can be said that Redis stores data with a key-value system. Thanks to this feature, access to and retrieval of this information will be much easier as there is no complex relationship between the data. Redis is using as a database and cache. In this article, we are going to teach you step by step How to Install and Use Redis on AlmaLinux 8.4. You can visit the package available in Eldernode if you want to buy a Linux VPS server.
Table of Contents
How to Install and Use Redis on AlmaLinux 8.4
What is Redis?
In key-value storage systems, information is storing as keys and values. When we say in-memory key-value system, it means that this system stores information in RAM, so the speed of access to information will be multiplied. In Radis, each record has a title and data.
These days we see Redis support for different types of data such as String, Hash, List, Set, and Sorted Set. On the other hand, due to the fact that the data is storing in the main memory by Redis, this process is very fast. This makes Redis a good choice for Caching, Counting, Queues, and Pub and Sub.
The Redis structure is known as a NoSQL database, a feature that has also attracted the attention of developers. All of this is making big tech companies more and more inclined to use Redis. Great sites like Github, Weibo, Pinterest, Snapchat, Craigslist, Diggs, StackOverflow, and Flickr can mention in this regard. Thus, we expect to see an increase in the range of Redis users in the future.
This technology has less interaction with databases based on the cloud computing platform and will result in much lower costs. In addition to all this, the easy and simple use of Redis should also mention.
Some of the benefits of Redis include:
1. Free and open source
2. Simplicity in use
3. Persistence: Your data will not be lost due to restarting the server!
4. Replication Support: Redis supports Replication well. You can run different servers as your Master/Slave or custom scenarios.
5. Using a wide range of data types
6. Fantastic response speed
Install Redis on AlmaLinux 8.4
In this section, we want to teach you how to Install Redis on AlmaLinux 8.4. To do this, you must follow the steps below in order. You must first update the server using the following command:
dnf update -y
You can install Redis using the following command:
dnf install redis -y
It should be noted that the supervised instructions allow you to provide an init system to manage Redis as a service. So in the first step, you need to open the configuration file using the text editor you want:
vi /etc/redis.conf
After opening the configuration file you should look for “supervised” and change it from no to systems. Then save the configuration file and exit it.
Now you need to start and enable Redis using the following commands:
systemctl start redis
systemctl enable redis
Finally, to confirm that Redis has been successfully installed, you need to run the following command:
redis-cli ping
How to Configure and Use Redis on AlmaLinux 8.4
After you saw how to install Redis in the previous section, we now want to configure it.
The first step is to configure the password. Note that, like setting bind, the password is configured directly in the Redis, /etc/redis.conf configuration file. So you have to open the configuration file using the following command:
vi /etc/redis.conf
Then you need to find Findpasspass among the commands:
# requirepass foobared
The important thing to note is that you must uncomment it by deleting #. Then specify the password you want. After doing this, you can save the configuration file and exit it. Use the following command and restart the system once to apply the changes:
systemctl restart redis
To ensure that the password works correctly, you can first open the Redis client using the following command:
redis-cli
You can follow the steps below to check that the Redis password works properly. You can set a key to a value using the following command. Note that the following command will not work due to your lack of authentication.
set key1 23
So you can authenticate with the password specified in the Redis configuration file using the following command:
auth your_redis_password
Once you have authenticated, you can now successfully run the previous command again:
set key1 23
Using the following command, you can ask Redis for the value of the new key:
get key1
Finally, you can exit using the following command:
quit
Conclusion
As you read in this article, Redis is an open-source data repository, NoSQL key/value, and in-memory, which is mainly used as an application cache or fast response database. Redis stores data in RAM, instead of the hard disk or SSD drive. Redis provides you with unprecedented speed, reliability, and performance. In this article, we tried to teach you How to Install and Use Redis on AlmaLinux 8.4.