- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
为了进一步了解 Docker,我想尝试编写一个自定义负载均衡器。我正在考虑使用默认网桥驱动程序创建一个 docker 网络,并将负载均衡器应用程序放入该网络的代理容器中。我将运行一个或多个具有多个副本的服务,代理将使用循环法将流量路由到每个容器。
我想代理应该知道同一网络中存在的所有其他实例以及它们提供的服务,以便进行负载平衡。这些是我的想法:
docker network inspect
提供了有关网络配置以及网络内运行的容器的详细信息,因此我想我可以发送也将此信息发送给代理。我的问题是:首选哪种方法?第二种方法是否可行?如果是,是否有任何我应该查看的指南或文档?我对操作系统和网络知之甚少,因此非常感谢任何将这些东西放在一起的帮助。
最佳答案
您还必须查看术语Service Discovery/Service Registry 以及如何将它们与您的负载均衡器一起使用。
发件人:Service Discovery and Load Balancing
Service Discovery
When we're handling a microservice architecture, it's very possible that we have multiple services across multiple servers or even multiple data servers. While the end user might not care much about the location of any of these services, our application is highly concerned with the connection details for each service. This problem is addressed with
Service Discovery
.1. What is Service Discovery?
As we mentioned, when services become spread out they become difficult to manage. It's tough to keep track of where each service is and what information details are needed to connect to each service. Service Discovery is exactly what it sounds like, the process of discovering all of our exposed services and how to connect with them.
This process of keeping track of multiple services is solved with the use of a
Service Registry
. Each service registers with the Service Registry upon creation, and the Service Registry is responsible for handling and maintaining the information required to connect to each service....
Since it's possible for microservices to go down from time to time, it's important to think of how that situation gets handled within the Service Registry. Generally a Service Registry is paired with a load balancer layer (mentioned in the previous section) that will seamlessly fail over upon discovering that the instance no longer exists. So if a service instance was to go down, the Service Registry would not be able to return the required information and the load balancer would kick in to handle it while also caching the service registry lookups.
关于linux - Docker - 如何编写自定义负载均衡器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55624785/
我是一名优秀的程序员,十分优秀!