How to Install and Configure Redis on Debian 10 Linux
Redis is an open-source in-memory key-esteem information store. It very well may be utilized as an information base, reserve, and, message dealer and supports different information structures, for example, Strings, Hashes, Lists, Sets, and that's only the tip of the iceberg. Redis gives high accessibility by means of Redis Sentinel, and programmed apportioning over various Redis hubs with Redis Cluster.
In this instructional exercise, we will cover how to introduce and design Redis on a Debian 10, Buster.
Installing Redis on Debian
Redis adaptation 5.0.x is remembered for the default Debian 10 vaults. To introduce it run the accompanying orders as root or client with sudo benefits :
sudo apt update
sudo apt install redis-server
The Redis administration will begin consequently when the establishment wraps up. You can check it by composing:
sudo systemctl status redis-server
The yield should look something like this:
? redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2019-11-28 14:15:23 PST; 27s ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Main PID: 2024 (redis-server)
Tasks: 4 (limit: 2359)
Memory: 6.9M
CGroup: /system.slice/redis-server.service
??2024 /usr/bin/redis-server 127.0.0.1:6379
Redis administration will neglect to begin if IPv6 is incapacitated on your worker.
That is it! Redis is introduced and running on your Debian 10 worker, and you can begin utilizing it.
Configure Redis Remote Access
Naturally, Redis is designed to tune in on localhost as it were. You can associate with the Redis worker just from the machine where the Redis administration is running.
In the event that you are utilizing a solitary worker arrangement, where the customer associating with the information base is likewise running on a similar host, you ought not empower far off access.
To arrange Redis to acknowledge distant associations open the Redis setup document with your word processor:
sudo vim /etc/redis/redis.conf
Quest for a line that starts with tie 127.0.0.1 ::1 and remark it.
/etc/redis/redis.conf
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# bind 127.0.0.1 ::1
Spare the document and close the proofreader.
Restart the Redis administration for changes to produce results:
sudo systemctl restart redis-server
Use ss or netstat to check that Redis is tuning in on all interfaces on port 6379:
ss -an | grep 6379
You should see something like underneath:
tcp LISTEN 0 128 0.0.0.0:6379 0.0.0.0:*
tcp LISTEN 0 128 [::]:6379 [::]:*
]:*
You'll additionally need to include a firewall decide that empowers traffic from your distant machines on TCP port 6379.
Accepting you are utilizing UFW to deal with your firewall, and you need to permit access from the 192.168.121.0/24 subnet, you would run the accompanying order:
sudo ufw allow proto tcp from 192.168.121.0/24 to any port 6
Ensure your firewall is arranged to acknowledge associations just from believed IP ranges.
When done, utilize the redis-cli utility to test the association by pinging the Redis worker from your far off machine:
redis-cli -h <REDIS_IP_ADDRESS> ping
The order should restore a reaction of PONG:
PONG
Conclusion
We have told you the best way to introduce Redis on Debian 10. To discover more data about how to deal with your Redis establishment, visit the Redis documentation page.