Configure Redis on Droplets so other droplets can connect


I’m very new to DevOps. I just configured a droplet to run Redis following this tutorial and I want to set it up so my rails apps running on other droplets (and nothing more) can connect to it. Is there a guide I can follow? So far I’ve seen how to secure it for local host only and how to open it for everyone.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello friend!

One easy way to do this is using a firewall. It is very important that redis not be open to the world, so be careful in doing this. There are other paths as well, this is merely the first one that came to my mind. I will lay out an example:

In this example, redis is listening on port 3000, and the other droplet that I want to connect to it has an IP address of The steps to do this via firewall would then be:

iptables -I INPUT -p tcp --dport 3000 -j DROP iptables -I INPUT -p tcp --dport 3000 -s -j ACCEPT

This tells the firewall to drop all external incoming traffic on port 3000 unless the source IP is Then, after doing that, you could follow the instructions to open redis to the world and it would only open it to

Again, be very careful. Redis is high on the list of services scanned for by malicious actors who are looking to compromise servers to leverage them for their own use, as well as for scams where they wipe out your data and ask for a ransom to buy it back. Even a few minutes of it being exposed to the whole internet can be too many.

Kind Regards, Jarland

Thank you! I did just that :)