Redis
Redis is an in-memory data structure store, used as a database, cache, and message broker that allows for incredibly fast read and write ops.
We are going to see 3 ways of setting up Redis. I will be using Ubuntu 20.04 for this tutorial.
1. Installing Redis Locally
Installing docker on
sudo apt update
sudo apt install redis-server
You need to configure a couple of thing after this, use any editor and change the supervised
directive to systemd
.
sudo nano /etc/redis/redis.conf
You can also set your redis password, since Redis is pretty fast you need a very strong password. Use the following command to generate one.
openssl rand 60 | openssl base64 -A
Save the files and restart the Redis service to check if its running.
sudo systemctl restart redis.service
sudo systemctl status redis
2. Use a Docker Image
Pull the Redis docker image
docker pull redis
And start a redis instance
docker run --name some-redis -d redis
3. Managed Redis Labs instance
You can also use a free tier instance from Redis Labs.
Create an account and select your favourite cloud provider.
I'm gonna select the 30 MB free tier, that's more than enough for our project.
You will be directed to set up a database:
A few things to consider here:
- Type of eviction policy (I highly recommend setting up an eviction policy).
- If you want to use a Redis module, you can set it up here.
I have selected the allkeys-lru eviction policy and no modules.
This blog is part of a series, in the next part, we will set up our node server to cache data with Redis. You can continue with the series using any of the Redis setups mentioned in this blog.
Feel free to reach out to me on Twitter @cryptus_neoxys and connect with me on LinkedIn.
Refs
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-18-04
Top comments (0)