Question

Ubuntu 20.4 Droplet Laravel 9 Connecting to Redis DB cluster

Edit Solved!

I keep failing to set up a proper connection with a Redis cluster from Laravel 9 on a Ubuntu 20.4 Droplet. I can get it to work from the App platform so I know the redis server itself is working correctly.

I found multiple tutorials, videos & examples on how to do this on DO. But all of them are for older versions of Laravel. And there seem to be some differences.

If I use predis as the redis client I end up with the following error.

Predis\Connection\ConnectionException Connection timed out [tls://db-redis-***-db.ondigitalocean.com:25061]

If I use phpredis I end up with a 504 Gateway Time-out.

Any feedback is highly appreciated!

Edit Solved!

Turns out it was a stupid little mistake on my side!

After adding my droplet to the Redis DB Trusted Sources I can use the predis client without issues.


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.

Hi there,

Happy to hear that you’ve got it all working and thank you for sharing the solution here with the community.

As a reference, there was a similar question asked here which might help anyone who comes across this in the future:

https://www.digitalocean.com/community/questions/how-to-setup-laravel-with-digitalocean-managed-redis-cluster

Best,

Bobby