Docker swarm redis连接问题

时间:2018-05-24 07:58:19

标签: docker redis swarm

我有import pygame, sys from pygame.locals import * def main(): pygame.init() WHITE = (255, 255, 255) BLACK = (0, 0, 0) mouse_position = (0, 0) drawing = False screen = pygame.display.set_mode((600, 800), 0, 32) screen.fill(WHITE) pygame.display.set_caption("ScratchBoard") last_pos = None while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() elif event.type == MOUSEMOTION: if (drawing): mouse_position = pygame.mouse.get_pos() if last_pos is not None: pygame.draw.line(screen, BLACK, last_pos, mouse_position, 1) last_pos = mouse_position elif event.type == MOUSEBUTTONUP: mouse_position = (0, 0) drawing = False elif event.type == MOUSEBUTTONDOWN: drawing = True pygame.display.update() if __name__ == "__main__": main() redis config。

docker-compose.yml

有两个主机version: '3.5' services: db: image: redis:latest command: redis-server --bind 0.0.0.0 --appendonly yes --protected-mode no ports: - target: 6379 published: 6379 protocol: tcp mode: ingress (经理)和leader-0(工人)

redis-0

Redis主机> root@leader-0:~# docker node ls ID HOSTNAME STATUS 46tmallxr4l8xr7i90vlwntjq * leader-0 Ready mofbedj4sqlxgnyatbxhlokc7 redis-0 Ready 按预期在localhost上公开6379端口:

redis-0

但是经理上没有6379(尽管它应该):

> root@redis-0:~# redis-cli -h 127.0.0.1 ping
PONG

有趣的部分是:

  1. > root@leader-0:~# redis-cli -h 127.0.0.1 ping Could not connect to Redis at 127.0.0.1:6379: Connection timed out (未拒绝)。
  2. 其他工作者宿主上的
  3. Connection timed out按预期工作(返回redis-cli -h 127.0.0.1 ping)。
  4. Docker重叠mash网络应该在每个主机上的本地接口上暴露6379端口,但看起来出了问题,我搞砸了搞清楚到底是什么。

    经理主机上的其他服务正常工作(我可以  PONG)。

    Manager主机具有与工作主机相同的防火墙规则(+其他端口已打开)

0 个答案:

没有答案
相关问题