类似的问题
我想知道为什么我可以通过将ports
配置更改为expose
来解决这个问题?如果Redis示例需要可访问,则需要在docker compose文件中设置端口。
在这种情况下,如何解决问题:SYNC套接字上的错误条件:拒绝连接?
redis.conf
# Redis configuration file
bind 0.0.0.0
databases 16
# Disable replication
replicaof no one
# Other Redis settings...
save ""
appendonly no
字符串
Docker编写文件:
api:
build:
context: apps/api
dockerfile: apps/api/Dockerfile
env_file:
- apps/api/.env.development
ports:
- 12710:3000
networks:
- api_network
depends_on:
- redis
redis:
image: redis
restart: always
expose:
- 6379
volumes:
- redis:/data
- ./data/redis/redis.conf:/usr/local/etc/redis/redis.conf
command: redis-server /usr/local/etc/redis/redis.conf
networks:
- api_network
networks:
api_network:
volumes:
redis:
型
如果我添加ports: - 6379:6379
,Redis会正常工作一段时间,然后出现这个问题:
app-redis-1 | 1:S 24 Apr 2023 13:59:22.947 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
app-redis-1 | 1:S 24 Apr 2023 13:59:22.947 * Connecting to MASTER 194.38.20.225:8886
app-redis-1 | 1:S 24 Apr 2023 13:59:22.950 * MASTER <-> REPLICA sync started
app-redis-1 | 1:S 24 Apr 2023 13:59:22.950 * REPLICAOF 194.38.20.225:8886 enabled (user request from 'id=33 addr=109.237.96.251:34384 laddr=172.18.0.2:6379 fd=8 name= age=0 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=47 qbuf-free=20427 argv-mem=24 multi-mem=0 rbs=1024 rbp=0 obl=0 oll=0 omem=0 tot-mem=22320 events=r cmd=slaveof user=default redir=-1 resp=2')
app-redis-1 | 1:S 24 Apr 2023 13:59:23.186 # Error condition on socket for SYNC: Connection refused
app-redis-1 | 1:S 24 Apr 2023 13:59:23.436 * Connecting to MASTER 194.38.20.225:8886
app-redis-1 | 1:S 24 Apr 2023 13:59:23.436 * MASTER <-> REPLICA sync started
app-redis-1 | 1:S 24 Apr 2023 13:59:23.673 # Error condition on socket for SYNC: Connection refused
app-redis-1 | 1:S 24 Apr 2023 13:59:24.440 * Connecting to MASTER 194.38.20.225:8886
app-redis-1 | 1:S 24 Apr 2023 13:59:24.440 * MASTER <-> REPLICA sync started
型
1条答案
按热度按时间6yt4nkrj1#
字符串
redis-master是主容器,使用docker可以通过内网找到ipaddress的链接
型