General Information
Redis is “an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.”
Official Site: https://redis.io/
Checklist
Install redis
yum install redis
Start and Enable
systemctl enable redis
systemctl start redis
Verify service is available locally
[root@server01 ~]# redis-cli 127.0.0.1:6379> exit
Different Redis server options to configure that are not defaults.
The config file is located at: /etc/redis.conf
The default bind/listen interface is localhost (127.0.0.1).
If you would like clients to be able to connect over the network, you will need to change this.
Change the bind interface
bind 192.168.1.100
Redis was designed to be deployed on trusted networks. It is recommended to NOT expose Redis to the internet.
That being said, there are some protection measures that can be taken.
Firewall
# Allow only the 192.168.1.0/24 network firewall-cmd --zone=internal --add-source=192.168.1.0/24 --permanent # To the Redis port firewall-cmd --zone=internal --add-port=6379/tcp --permanent # Reload rules firewall-cmd --reload
Authentication (password) for clients
requirepass c5bdeb2b550e038740466ec0c8dc03df3e8bb629bde539251840da1af6ee62d2
echo "this is the coolest password ever" | sha256sum c5bdeb2b550e038740466ec0c8dc03df3e8bb629bde539251840da1af6ee62d2
Disable Certain Commands
rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
rename-command CONFIG ""
Encryption Tunneling
Daemonize
daemonize yes
Supervisor Interaction
supervised systemd
Append Log
appendonly yes
File Sync
appendfsync everysec
Install the Python Redis client
pip install redis
Import the Redis module and connect to the Redis server
import redis redis_db.keys() redis_db = redis.StrictRedis(host="192.168.1.151", port=6379, db=0, password="c5bdeb2b550e038740466ec0c8dc03df3e8bb629bde539251840da1af6ee62d2")
Example Client Use