Reputation: 33
I am creating a Service Gateway for my project using Spring Cloud Gateway. Currently, I am trying to do rateLimiting for one of my APIs. I tried few samples provided on github which uses RedisRateLimiter. I am getting following exception on every request -
2018-11-01 21:33:39.321 ERROR 15568 --- [ parallel-2] o.s.c.g.f.ratelimit.RedisRateLimiter : Error determining if user allowed from redis org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to localhost:6379
My question is - What is the way to change the redis configurations? I have Redis installed on a different machine. Is there some property wherein I can provide my Redis host and port so that it does not point to localhost?
Upvotes: 0
Views: 1297
Reputation: 663
I connected my API gateway to the Redis instance which was on amazon elastic cache. Below is the configuration I have done in my bootstrap.yml of my API gateway microservice.
spring:
redis:
host: xyz (provide host name here)
port: 6379 (provide port here)
jedis:
pool:
maxIdle: 50 # max idle connections in the pool
minIdle: 10 # min idle connections in the pool
maxActive: -1 # no limit to the number of active connections
maxWait: 30000 # time limit to get a connection - only applies if maxActive is finite
You can use the Jedis client to add further configurations.
Hope it helps.
Upvotes: 2