Easiest way to start playing with Redis
What is Redis?
Redis is an open source key-value in-memory data store, similar to a NoSQL database. It’s very known for its speed, as read and write operations are done in memory (RAM) but it also supports data persistence in the disk.
One of the most common use cases for Redis is to cache results from a SQL databases queries in order to accelerate user requests and improve customer experience.
Create a Redis Instance
Easy way to start play with Redis is to create a free cloud stand-alone (yes, Redis can be used in a cluster mode which i will explain in a future post) instance provided by Redis Labs (30 MB storage included).
Link: https://redislabs.com/try-free
Registering is very easy and does not require add a credit card.
After you fill that tiny form you’ll get an activation e-mail and then it forwards you to redis cloud subscription page. Select your favorite cloud provider and be sure to select the 30Mb free tier option. At last, add a subscription name.
After create the subscription, please pick a database name and leave the remaining options as default.
Click on Activate and that’s it, Redis is up and running:
Save your redis endpoint and password in a safe place to connect to our brand new instance.
Install redis-cli on Ubuntu
Now the setup is done, let’s move forward to connect with Redis using a built-in client provided by Redis. Please follow below steps using a linux terminal:
- wget http://download.redis.io/redis-stable.tar.gz
- tar xvzf redis-stable.tar.gz
- cd redis-stable
- cp src/redis-cli /usr/local/bin/
- chmod 755 /usr/local/bin/redis-cli
Binaries are now compiled and available in the src directory. Run Redis with:
redis-cli -h <redisendpoint> -p <yourport> -a <yourpassword>
And we are done with redis connection. To test the connection you can ping the server or execute a echo command:
To get all available commands please check redis website.
And that’s all!! On next post we will explore available data types.
Thank you
Originally published at https://www.goncalomiranda.com on June 30, 2020.