Redis is a scalable in-memory key-value store that excels at caching. DigitalOcean’s Redis One-Click application allows you to quickly spin up a Droplet with Redis pre-installed. It aims to help get your application off the ground quickly.
## Creating Your Redis Droplet
You can launch a new Redis instance by selecting **Redis on 14.04** from the Applications menu during Droplet creation:
![](https://assets.digitalocean.com/articles/redis-one-click/redis-one-click.png)
Once you have created the Droplet, connect to it via the web-based console in the DigitalOcean control panel or SSH:
“`
ssh root@your.ip.address
“`
## Accessing Redis
Your Redis instance will be available at `127.0.0.1:6379` It is bound to the localhost by default and its configuration details can be found in `/etc/redis/redis.conf`. To connect to Redis’s interactive shell, simply run:
“`command
redis-cli
“`
## Securing And Accessing Remotely
### Enabling Authentication
Before allowing remote access to your Redis database, it is recommended to enable password authentication. To do so, open its configuration file located in `/etc/redis/redis.conf` and append a line beginning with “requirepass” and followed by your password. For example:
requirepass your_redis_password
In order for this to take effect, you must first restart Redis with:
“`command
sudo service redis restart
“`
To verify that authentication has been enabled, enter the shell with `redis-cli` and attempt to run a query. You should be presented with an error:
“`custom_prefix(127.0.0.1:6379>)
CONFIG GET databases
(error) NOAUTH Authentication required.
“`
To provide the password you set, run:
“`custom_prefix(127.0.0.1:6379>)
AUTH your_redis_password
OK
“`
After authentication has been enabled, you will also need to update the init script to use it. In the file `/etc/init.d/redis`, find the line:
“`
CLIEXEC=/usr/local/bin/redis-cli
“`
and change it to:
“`
CLIEXEC=/usr/local/bin/redis-cli -a your_redis_password
“`
### Enabling Remote Access
In order to enable access over the internet, comment out the line beginning with `bind` in `/etc/redis/redis.conf`. Find this:
“`
bind 127.0.0.1
“`
and change it to this:
“`
# bind 127.0.0.1
“`
Then restart Redis to enable the change.
“`command
sudo service redis restart
“`
Now you can connect to your Redis instance from a remote host using the command:
“`
redis-cli -h redis_ip_address -p 6379 -a your_redis_password
“`
### Additional Security Steps
In addition to enabling authentication, setting up a firewall that only allows remote connections from specific IP addresses is a good security measure to implement. Managing an IP Tables firewall is [made easy using UFW on Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server). The following commands will erect a firewall which allows all outgoing connections from your server but only allow incoming connections via SSH or from the specified IP address (ip.address.to.allow).
“`
sudo apt-get install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow from ip.address.to.allow
sudo ufw enable
“`
For additional security recommendations, see [Redis’s security docs](http://redis.io/topics/security).
## Further Information
The One-Click application simply provides you with Redis as a pre-installed base. It’s up to you how you want to use it. Whether you are building out a cluster or you simply want to use it as a local cache for an app on the same host, we have a number of tutorials which should point you in the right direction:
* [How To Configure a Redis Cluster on Ubuntu 14.04](https://www.digitalocean.com/community/tutorials/how-to-configure-a-redis-cluster-on-ubuntu-14-04)
* [How To Configure Redis Caching to Speed Up WordPress on Ubuntu 14.04](https://www.digitalocean.com/community/tutorials/how-to-configure-redis-caching-to-speed-up-wordpress-on-ubuntu-14-04)
Source: DigitalOcean News