Error: spring boot redis unable to connect to localhost 6379

What's Causing This Error

The error 'spring boot redis unable to connect to localhost 6379' indicates that the Spring Boot application is unable to establish a connection with the Redis server running on the local system at the default port number of 6379. There could be several reasons behind this error, some of which are:

  • Redis server is not running: If the Redis server is not running or is not reachable from the application server, then it can't accept connections from the Spring Boot application.

  • Port number is incorrect: If the Redis server is running on a port other than the default port number of 6379, then the Spring Boot application needs to be configured accordingly to connect to the correct port.

  • Firewall or network issues: If there are firewall rules or network issues preventing the Spring Boot application from connecting to the Redis server, then the connection attempt will fail, resulting in this error.

Solution - Here's How To Resolve It

To resolve the 'spring boot redis unable to connect to localhost 6379' error, try the following solutions:

  • Ensure that Redis server is running and is reachable from the application server. You can use the Redis CLI tool to verify if the server is up and running.

  • Verify that the correct port number is being used by the Spring Boot application to connect to the Redis server. If Redis is running on a non-default port, make sure that the Spring Boot application is configured to connect to the correct port.

  • Check for any firewall rules or network issues that may be preventing the Spring Boot application from connecting to the Redis server. You may need to modify the firewall rules or network settings to allow the application to connect.

Was this content helpful?

Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.