本文介绍了如何在AWS ECS上的Fargate服务之间进行通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有六个docker容器都在各自的任务(6个任务)中运行,每个任务在ECS上的单独Fargate服务(6个服务)中运行.我需要这些服务能够相互通信,并且其中一些需要公开访问.我一直看到有关使用服务发现或分配给每个服务的负载平衡器的信息.我想尝试避免设置6个负载平衡器,因为它更昂贵且需要更多维护.

I have six docker containers all running in their own Tasks (6 tasks), and each task running in a separate Fargate service (6 services) on ECS.I need the services to be able to communicate with each other, and some of them need to be publically accessible.I keep seeing info about using either Service Discovery or a Load Balancer assigned to each service. I would like to try and avoid having to set up 6 load balancers as it's more expensive and more effort to maintain.

这是我当前设置服务发现的方式:

This is how I have set up Service Discovery currently:

  • 所有任务都设置为使用awsvpc
  • 已将所有服务设置为使用服务发现(在服务创建"页面中进行设置)
  • 所有服务都共享相同的命名空间,并且都使用A DNS记录

当我尝试从一个Docker容器中对< service_discovery_name>.< namespace> 进行ping操作时,我没有得到响应.但是,当ping私有IP地址时,我可以成功ping另一个容器.

When I try to ping <service_discovery_name>.<namespace> from within one of the docker containers I do not get a response. However, I can successfully ping another container when pinging the private IP Address.

我可以实现服务发现所需的功能吗?如果是这样,容器之间如何精确通信?

Can I achieve what I need to do with Service Discovery?If so, how exactly do the containers communicate with each other?

谢谢!如果我没有提供足够的信息,请告诉我.

Thanks heaps! Please let me know if I haven't provided enough info.

重新创建服务并使用新的服务发现设置它们似乎可以解决该问题.不知道为什么旧的发现不起作用.

Recreating the services and setting them up with a new Service Discovery seemed to resolve the issue. No idea why the old discovery didn't work.

推荐答案

根据评论,导致此问题的确切原因是不确定.但是,通过在ECS中创建新服务发现解决了该问题.

Based on the comments, the exact cause of the issue is undetermined. However, the problem was solved by creating a new Service Discovery in ECS.

这篇关于如何在AWS ECS上的Fargate服务之间进行通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:40