Redis is an abbreviation for Remote Dictionary Server. This is an open source storage/storage database with constant core values that stores data as pairs of core values and duplicates them as a message broker. Redis supports a wide range of data structures, including sets, lists, hashes, strings, HyperLogLogs, and more.
What’s a key value pair?
A key value pair is a set or a pair of two elements that are connected to each other. Let’s think about this:
Car = Mercedes
In this case the key is the car and the value is the Mercedes. In the Redis database this information can be written with the syntax :
SET1 button Value1
Our example translates into… Over at this website cPanel Server Management.
Mercedes SET vehicle
Benefits of using Redis
- Unlike relational databases such as MySQL, Redis is a NoSQL database that stores data as a key value pair. This makes the process simple and flexible, because there is no need to create tables, columns and rows that are linked to relational databases. Data transfer to Redis is simple and clear.
- An obvious application of Redis is its use as a caching system. However, it also ensures the persistence of the data stored there.
- Redis’ internal memory architecture enables ultra-fast data storage and retrieval.
- The redis-caching system is sufficiently reliable and resistant to failures and interruptions.
- Redis comes with a master-slave replication function. When changes are made to the master node, they are automatically replicated to the slave nodes to ensure high availability.
- Redis is able to store large key pairs and values up to 512 MB.
- Due to its small size, Redis can be installed in IoT devices such as Raspberry Pi and Arduino to support IoT applications.
- Redis is a multi-platform database and caching system that can be installed on Windows, Mac and Linux.
Re-use of accessories
With the above mentioned advantages Redis can be used in the following way:
- Real-time analysis of statistical data.
- It is used for integration with AWS services such as CloudTrail, CloudWatch and Amazon EC2.
- This can be an excellent option for caching websites.
- Social networking platforms such as Instagram use Redis to store images.
- Redis supports a wide range of data types such as hyperlogs, hashes and geodata.
Now we want to see how we can install Redis on CentOS 8 / RHEL 8.
Step 1: System Storage Update
Log in to CentOS 8 / RHEL 8 and update system packages and repositories with the command
$ sudo dnf update -y
Step 2: Install Redis with dnf
Version 5.0.x of Redis is now included in the CentOS 8 AppStream repository and its installation is a walk in the park. Let the team go:
$ sudo dnf install redis -y
Once installed, you can check the installed version of Redis by running the command:
[[Protected by email] ~]$ rpm -q redis
[[Protected by email] ~]$ [[Protected by email] ~]$ [[Protected by email]].
You can see on the output that we have installed version 5.0.3 of Redis. For more information about Redis, such as the version, the architecture, the license and a brief description, follow the command :
revs per minute – chi red
To start and activate the Redis service, select systemctl :
$ sudo systemctl start redis
$ sudo systemctl sudo systemctl activate sudo systemctl sudo systemctl redis
Once released, you can check its status with the command
$ sudo systemctl status redis
By default Redis runs on port 6379. You can confirm this by executing the netstat command:
$ sudo netstat -pnltu | grep redis
Step 3: Redis configuration for remote access
The default setting only allows connections to the localhost or the redis server and blocks all external connections. We will configure Redis to allow remote connection from the client machine.
Go to the configuration file as shown in the figure :
$ sudo vim /etc/redis.conf
Find the binding parameter and replace 127.0.0.1 with 0.0.0.0.
Save and exit the configuration file. In order for the changes to take effect, you need to start over.
$ sudo systemctl reboot redis
To enter the Redis-Shell, execute the command
$ radish cake
Try pinging the redis server. You should receive a PONG response as shown in the figure.
[Email Protection] ~]$ redis-cli
Step 4: Redis Server protection
Our Redis installation gives everyone access to the shell and databases without authentication, which is a serious security risk. To set a password, go back to the configuration file /etc/redis.conf.
Find and select the option of the required passe-partout and enter a secure password, as shown in the image.
Reboot Redis and return to the server.
$ sudo systemctl reboot redis
If you try to execute a command before authenticating, the following error is displayed
[[E-Mail Protection] ~]$ redis-cli
(Error) NOAUTH authentication required.
To authenticate yourself, enter auth followed by a password. In our case, yes:
auth [email is secure]
You can then proceed with the execution of your orders.
127.0.0.1:6379> auth [protected e-mail]
To leave the redis-cli, you go into an exit.
Step 5: Firewall configuration for redis
Finally, we need to configure the firewall to allow remote connections to the Redis server. To do this, open gate redis 6379.
All right, carry out the orders below.
sudo firewall-cmd –add-port=6379/tcp – constant
$ sudo firewall-cmd – reloads
For remote access to Redis, use the following syntax.
$ redis-cli -h REDIS_IP_ADDRESS
Then verify yourself and press ENTER.
The IP address of our Redis server is 192.168.1.5 The command from another client PC looks as follows
$ redis-cli -h 192,168.1.5
Then enter the password and press ENTER.
auth [email is secure]
The above confirms that the Redis server has been successfully installed, let’s continue with the next section.
How to reach the benchmark Redis?
Redis has an integrated tool, known as the redis benchmark, that provides information on system performance, such as data throughput, throughput and latency, to name but a few.
Here are some command options you can use with Redis
- -n : This determines the number of applications submitted. Default setting 100000
- -c : Defines the number of parallel connections for the simulation. By default this value is 50
- -p : This is the Redis port, which is set to 6379 by default.
- -h : It is used to determine the host. By default, this value is set to localhost (127.0.0.1).
- -a : Used to request a password when the server requires authentication.
- -q : This is silent mode. Indicates the average number of requests per second
- -t : Used to perform a combination of tests
- -P : Used for laying pipelines to increase productivity.
- -d : Specifies the data size in bytes for the GET and SET values. The default setting is 3 bytes.
To confirm the average number of requests your Redis server can process, execute the command:
$ redis-Benchmark -q
Watch out for the last line. This shows that Redis can process 2,3046 requests per second.
You can also use the -t option to execute a subset of commands. In the example below, we use it to display the average number of requests for SET and GET commands.
$ redis benchmark -t bet, -q get
[[Protected Email] ~]$ redisbenchmark -t set,get -q
SET: 26102.84 requests per second
GET : 25555.84 Requests per second
[[E-mail Security] ~]$[in
In the output we see that we have 26102.84 requests per second for the SET command and 25555.84 requests per second for the GET command.
By default, the number of parallel connections is 50. To specify a different number of client connections, for example 1000, use the parameter -c as shown in the figure :
[[Protected e-mail] ~]$ redisbenchmark -t set,get -q -c 1000
SET: 21997.36 requests per second
GET : 22119.00 Requests per second[[protected per email] ~]$ [[protected per email]] $ 22119.00 Requests per second[[protected per email] ~]$ 22119.00 Requests per second[[protected per email] ~]$ 22119,00 Requests per second[[protected by email] ~]$ 22119.00 Requests per second[[protected by email] ~]$ 22119.00 Requests per second[[protected by email] ~]$ 22119.00 Requests per second[[protected by email] ~]$ 22119.00 Requests per second
As you may have noticed, the number of requests per second has increased from 50 to 1000 due to the increase in parallel connections.
Let’s go ahead and set the number of applications at 10,000,000.
redis-bank -t set,get -q -c 1000 -n 1000000
SET: 16660,28 requests per second
GET : 21550.79 Requests per second[[Protected Email] ~]$ [[Protected Email] ~]$ 21550.79 Requests per second[[Protected Email] ~]$ 21550.79 Requests per second[[Protected Email] ~]$ 21550.79 Requests per second[[Protected Email] ~]$ 21550.79 Requests per second[[Protected Email] ~]$ 21550,79 Requests per second[[Protected email] ~]$ 21550.79 Requests per second[[Protected email] ~]$ 21550.79 Requests per second[[Protected email] ~]$ 21550.79 Requests per second[[Protected email] ~]$ 21550.79 Requests per second[[Protected email] ~]$ 21550.79 Requests per second[[Protected email] ~]$ 21550.79 Requests per second[[Protected email] ~]$ 21550.79 Requests per second
Here, too, the SET and GET values have increased from the standard 100,000 to 1,000,000 due to the increase in the number of applications.
And that concludes today’s topic. We successfully installed the Redis server on CentOS 8 and were able to perform several benchmark tests on our server. We welcome your feedback and comments.install redis centos 8,install redis on windows