问题描述
我一直在尝试为基于docker的应用设置主从标签设置。我很喜欢下面给出的docker-compose.yaml文件。但是它没有工作并且没有失败。 泊坞窗图像来自bitnami。
Docker-Compose文件:
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
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)