简体   繁体   English

在 ECS Fargate 上运行 consul-master 服务器

[英]Running consul-master servers on ECS Fargate

Currently, I have 3 consul-master servers, one as the leader and the other two as the followers.目前,我有 3 台 consul-master 服务器,一台作为领导者,另外两台作为追随者。 All 3 consul servers are running on ec2 instances.所有 3 个领事服务器都在 ec2 实例上运行。 Here is the sample architecture diagram:这是示例架构图: 在此处输入图像描述

I have already moved my core application with consul-client-agent on ECS fargate.我已经在 ECS fargate 上使用 consul-client-agent 移动了我的核心应用程序。 consul client agent will run as the sidecar container in the ECS fargate task. consul 客户端代理将作为 ECS fargate 任务中的 sidecar 容器运行。

Now I am wondering, If I can run these consul-master EC2 servers on AWS ECS Fargate ?现在我想知道,如果我可以在AWS ECS Fargate上运行这些 consul-master EC2 服务器?

If so, what might be the possible setup?如果是这样,可能的设置是什么? will it be the same ecs cluster of core application but different ECS Service for consul server?它会是相同的核心应用程序的 ecs 集群,但 consul 服务器的 ECS 服务不同吗? or, will it be a completely different ecs cluster?或者,它会是一个完全不同的 ecs 集群吗?

If I understand you correctly you want to transfer your consul master and 2 followers to ECS in Fargate tasks running in services.如果我理解正确,您希望在服务中运行的 Fargate 任务中将您的领事主人和 2 个追随者转移到 ECS。 If that is what you meant you can either:如果这就是您的意思,您可以:

  1. Manually search the IP and join the followers and agents to the Consul cluster using the IP of the Fargate task with the main Consul server (must be in awsvpc mode if using private IP addresses)手动搜索 IP 并使用 Fargate 任务的 IP 将追随者和代理加入 Consul 集群和主 Consul 服务器(如果使用私有 ZA12A3079E14CED46E69BAB21A 地址,则必须处于 awsvpc 模式)

  2. Using CloudFormation put a load balancer in front of the leader then you can join the agents and 2 consul followers to the cluster by using the load balancers DNS name.使用 CloudFormation 在领导者前面放置一个负载均衡器,然后您可以使用负载均衡器 DNS 名称将代理和 2 个领事追随者加入集群。 You need to make a load balancer listener that listens on port 8301 (SERF port) with protocol TCP_UDP and fowards traffic to a target group with the same port and with the same protocol.您需要创建一个负载均衡器侦听器,该侦听器使用 TCP_UDP 协议侦听端口 8301(SERF 端口),并将流量转发到具有相同端口和相同协议的目标组。

See my post as a reference for option 2:请参阅我的帖子作为选项 2 的参考:

How can I join a Consul agent to a Consul cluster via a Consul server running in a different Fargate task with CloudFormation? 如何通过在 CloudFormation 的不同 Fargate 任务中运行的 Consul 服务器将 Consul 代理加入 Consul 集群?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM