Redis (Remote Dictionary Server) is an open-source NoSQL data structure server. Redis functions simultaneously as a database, a cache, and a message broker. As a database, the key-value store model used by Redis allows it to store and access very large amounts of data more efficiently than do relational databases. As a cache, Redis generally holds the entire database in memory, so complex analytical operations can be completed very quickly. As a message broker, Redis supports a number of popular protocols for job queues. Bindings for Redis are available for most widely-used programming languages. The present tutorial will guide you through the basics of installing and configuring Redis on Ubuntu 14.04.
All commands in this tutorial are written as if they are executed by root.
Always makes sure your Ubuntu 14.04 system is fully up to date before you install any new packages. Use the following apt-get commands to update your server’s system.
apt-get update && apt-get upgrade -y
We recommend you use the Redis server package provided in the base repositories to install Redis on Ubuntu 14.04. To do so, simply enter the following command:
apt-get install redis-server -y
Make Redis Secure
The default security settings on Redis allow users to connect to it from any IP address. Unless Redis is meant to be deployed on a cluster or you intend to connect to Redis from an external site, the safest option is to bind Redis to the local IP address. Doing so will prevent unauthorized users from gaining access to your Redis Keystore.
To bind Redis to the local IP address, open the configuration file in the nano text editor:
Search for the line that starts with bind. Make sure the line is uncommented (no # at the beginning) and that it reads as follows:
Save and close the configuration file.
Getting Started With Redis
You are now ready to start Redis. Enter this command:
service redis-server start
To save yourself the trouble of having to start Redis manually in the future, set it to start automatically when your Ubuntu 14.04 server boots:
update-rc.d redis-server enable
update-rc.d redis-server defaults
Finally, test that Redis is working. Go ahead and enter your first data into the Redis server using the SET command:
127.0.0.1:6379> set besthost "Globo.Tech"
To check that you have successfully entered the data, use the command GET to retrieve your first entry.
127.0.0.1:6379> get besthost
You have installed, secured, and tested Redis on your Ubuntu 14.04 server. Whether you need to analyze a small amount of data or perform complex analytical tasks with an enormous dataset, Redis can now help you get the job done. Whatever languages you prefer to program in, there are almost certainly bindings available that will enable you to program Redis to do what you want it to do. If this guide was helpful to you, kindly share it with others who may also be interested.