我一直在试图建立一个主从哨兵安装的应用程序基于docker。我正在起诉下面给出的docker-compose.yaml文件。但它不起作用而且失败了。docker图片来自bitnami。
docker编写文件:
version: '2'
networks:
app-tier:
driver: bridge
services:
redis:
image: 'bitnami/redis:latest'
environment:
- REDIS_REPLICATION_MODE=master
- ALLOW_EMPTY_PASSWORD=yes
networks:
- app-tier
ports:
- '6379'
redis-slave:
image: 'bitnami/redis:latest'
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis
- ALLOW_EMPTY_PASSWORD=yes
ports:
- '6379'
depends_on:
- redis
networks:
- app-tier
redis-sentinel:
image: 'bitnami/redis-sentinel:latest'
depends_on:
- redis
- redis-slave
ports:
- '26379:26379'
networks:
- app-tier
失败并出现错误:
INFO [2020-10-04 19:49:05,413] org.redisson.Version: Redisson 3.13.3
INFO [2020-10-04 19:49:05,773] org.redisson.connection.SentinelConnectionManager: master: redis://172.20.0.2:6379 added
INFO [2020-10-04 19:49:05,777] org.redisson.connection.SentinelConnectionManager: slave: redis://172.20.0.3:6379 added
INFO [2020-10-04 19:49:05,787] org.redisson.connection.SentinelConnectionManager: sentinel: redis://127.0.0.1:26379 added
ERROR [2020-10-04 19:49:17,857] com.flipkart.gamer.annotations.RedisService: Failed to Connected to Redis Server Unable to connect to Redis server: /172.20.0.2:6379
! io.netty.channel.ConnectTimeoutException: connection timed out: /172.20.0.2:6379
! at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:261)
! at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
! at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:170)
! ... 8 common frames omitted
! Causing: org.redisson.client.RedisConnectionException: Unable to connect to Redis server: /172.20.0.2:6379
暂无答案!
目前还没有任何答案,快来回答吧!