I setup a Redis master/slaves/sentinels from docker, and this is my docker-compose.yml
redis-master:
image: redis:3
ports:
- 6380:6379
redis-slave:
image: redis:3
ports:
- 6381:6379
command: redis-server --slaveof redis-master 6379
deploy:
replicas: 2
redis-sentinel:
image: mengli/redis-sentinel
ports:
- 26379:26379
deploy:
replicas: 3
environment:
- MASTER_HOST=redis-mater
- SENTINEL_PORT=26379
- SENTINEL_QUORUM=2
I want to connect the Redis out of docker, I use spring-data-redis, and this is my configuration:
redis:
sentinel:
master: mymaster
nodes: 127.0.0.1:26379
but when connect to the Redis, ip address as 10.0.0.* was found, which is the ip address in docker, so the a connection exception was thrown.
Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
Please tell me how to connect Redis with sentinels out of docker. Thanks