What Redis variables are necessary in a Spring Boot app?

Normally in a Spring Boot app I would just define the Redis port and host, but my health check is failing because the log says that Redis is listening on localhost. Why is this happening? Do I need need to set the Redis password, URL, and user? Can you please show me an example of the application.properties file?
19 Replies
Percy
Percy2y ago
Project ID: 59529c94-83a4-4029-89c7-3ac4d98ea51b
Nathan Lively
Nathan LivelyOP2y ago
59529c94-83a4-4029-89c7-3ac4d98ea51b
Brody
Brody2y ago
could you setup a variable reference for REDIS_URL and then use that in your app?
Nathan Lively
Nathan LivelyOP2y ago
Yes, I can set all of the variables. My question is, which ones do I need?
Nathan Lively
Nathan LivelyOP2y ago
As I mentioned, I've only ever had to set the port and host to use Redis locally. Do I need all of these variables set?
Brody
Brody2y ago
the simplest way would be to just use REDIS_URL since the URL also contains every other credential
Nathan Lively
Nathan LivelyOP2y ago
Thanks. Is the property just spring.redis.url?
Brody
Brody2y ago
i wouldn't know, thats something you would need to read the spring documentation for, reading documentation goes a very long way
Nathan Lively
Nathan LivelyOP2y ago
Thanks. I checked the documentation and found conflicting answers. That's why I asked. No worries. I'll test it.
Brody
Brody2y ago
I'm sorry I'm not a java developer
Nathan Lively
Nathan LivelyOP2y ago
I deployed the update and I'm still getting the same error. Somehow the Redis information is not set right. Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to localhost/<unresolved>:6379 It seems like somehow the variables for Redis are not being brought, which is confusing because I have the Redis variales set up in the same way I have the MySQL variables set up and those are working fine.
Brody
Brody2y ago
can you show me a screenshot of your service variables?
Nathan Lively
Nathan LivelyOP2y ago
Sure. Here's Redis.
Nathan Lively
Nathan LivelyOP2y ago
And the service.
Nathan Lively
Nathan LivelyOP2y ago
And my deployment properties file.
Nathan Lively
Nathan LivelyOP2y ago
You can see that I tried URL and then switched to trying host and port.
Brody
Brody2y ago
you'd need to use more variables than just host and port https://docs.railway.app/databases/redis#connect
Nathan Lively
Nathan LivelyOP2y ago
Thanks. The main problem I’m having now is that none of the variables seem to referenced. The app crashes on deployment because redis is still trying to listen on localhost.
Brody
Brody2y ago
I think you should familiarize yourself with the technologys you are trying to use
Want results from more Discord servers?
Add your server