I am trying to get ECS Service Connect to work our services. But for some reason, just not able to get it to work.
What we have in place:
我正在尝试让ECS服务连接来工作我们的服务。但由于某些原因,就是不能让它工作。我们已具备的条件:
- One service (
admin
) needs to get some data from another service (metrics
).
- Both services are deployed on ECS
- The containers in both services are using the
awsvpc
network mode
- Service Connect has been configured for both services
Service Connect for Metrics Service
指标服务的服务连接
Service Connect for Admin Service
管理服务的服务连接
Both services are in the same cluster and using the same Service Connect Namespace (service-discovery-cluster
).
This is reflected in CloudMap entry for the Namespace.
这两个服务位于同一群集中,并且使用相同的服务连接命名空间(服务发现集群)。这反映在命名空间的CloudMap条目中。
CloudMap entries for the services
服务的CloudMap条目
So far, all this was as expected. And the services are accessible via an ALB and working fine.
However, I would have expected that the Admin Service can call the Metric service with http://metrics.service-discovery-cluster
(the recommended http://service-dns.cluster
pattern), but this cannot be resolved by the HTTP Library.
到目前为止,这一切都符合预期。而且这些服务可以通过ALB访问,并且运行良好。然而,我希望管理服务可以使用http://metrics.service-discovery-cluster(推荐的http://service-dns.cluster模式)调用指标服务,但这不能由HTTP库解决。
I know I am missing something very basic somewhere but just can't work it out.
我知道我在某些方面遗漏了一些非常基本的东西,但就是解决不了。
Could someone help out, please?
有没有人能帮帮忙?
Other details:
其他细节:
- I am using Unirest with Java (I don't think that should matter, but still)
- All tasks have
awsvpc
networking mode
- Exact error:
java.net.UnknownHostException: metrics.service-discovery-cluster: Name or service not known
I tried using ports for the services (e.g., http://metrics.service-discovery-cluster:8084
), but that didn't work either.
我尝试使用服务的端口(例如,http://metrics.service-discovery-cluster:8084),),但也不起作用。
更多回答
is there any firewall? and make sure the required port is open for both server ip on security groups check that also
有防火墙吗?并确保安全组上的两个服务器IP都打开了所需的端口
The ports are open in the SG. As mentioned, I can call the API through the ALB. Not sure what you meant by Firewall here though. The Admin Service is calling Metrics Service and both are hosted in the same ECS Cluster and same namespace.
SG中的端口打开。如前所述,我可以通过ALB调用API。但不知道你在这里所说的防火墙是什么意思。Admin Service正在调用CNORTService,两者都托管在同一ECS群集和同一命名空间中。
我是一名优秀的程序员,十分优秀!