简体   繁体   English

GCP:HTTP(S) 负载平衡后端服务区域选择

[英]GCP: HTTP(S) Load Balancing backend service region select

What we have:我们有什么:

  • 3 stateful backend servers located in different regions. 3 个位于不同区域的有状态后端服务器。
  • Mqtt broker in each region (with IoT-devices connected).每个区域的 Mqtt 代理(连接物联网设备)。
  • Users that related to specific region, to able to see they IoT data.与特定区域相关的用户,能够看到他们的物联网数据。
  • Unique host name for each server.每个服务器的唯一主机名。

What we want:我们想要什么:

  • One host name to serve all users一个主机名服务所有用户
  • Mqtt can still connected to each backend by i'ts unique host name Mqtt 仍然可以通过我唯一的主机名连接到每个后端
  • The decision where to redirect should come from the user information and not from the IP (for example field in JWT)重定向的决定应该来自用户信息而不是 IP(例如 JWT 中的字段)

Did the GCP HTTP(S) load balancing is capable to do such think, or there is a technical limitation? GCP HTTP(S) 负载平衡是否能够做到这样的想法,或者存在技术限制?

Any ideas will be much appreciated!任何想法将不胜感激!

I think that you can achieve the most with HTTPS Global load balancer (GLB).我认为您可以使用 HTTPS 全局负载平衡器 (GLB) 获得最大的收益。 You have here an article that can help you in the setup.您在这里有一篇文章可以帮助您进行设置。

Only the redirect condition seems tricky.只有重定向条件似乎很棘手。 Initially the GLB route to the closest region to the user (thus based on IP), and then you can set up a sticky param, either based on IP or on cookies.最初 GLB 路由到离用户最近的区域(因此基于 IP),然后您可以设置一个粘性参数,基于 IP 或基于 cookie。 I'm not sure that feat your latest requirement.我不确定这是否符合您的最新要求。 You can also route to a backend according with the url path provided.您还可以根据提供的 url 路径路由到后端。 But not from the JWT claims.但不是来自 JWT 的声明。

If you want one hostname to serve all users, you can use HTTP(S) load balancer for achieving this.如果您希望一个主机名为所有用户提供服务,您可以使用 HTTP(S) 负载平衡器来实现这一目标。 Here is an article which gives more insight about the same 1 .这是一篇文章,它提供了关于相同1的更多见解。

Your need to redirect based on user information and not from the IP, can be achieved via Session affinity: 2您需要根据用户信息而不是 IP 进行重定向,可以通过 Session affinity 来实现: 2

Google Cloud HTTP(S) Load Balancing offers two types of session affinity: Google Cloud HTTP(S) 负载平衡提供两种类型的会话关联:

  • Client IP affinity 3 sends requests from the same client IP address to the same backend. Client IP affinity 3将来自相同客户端 IP 地址的请求发送到相同的后端。

  • Generated cookie affinity 4 sets a client cookie when the first request is made, then sends requests with that cookie to the same backend. Generated cookie affinity 4在发出第一个请求时设置客户端 cookie,然后将带有该 cookie 的请求发送到同一后端。

When you use session affinity, the RATE balancing mode is recommended, rather than UTILIZATION.当您使用会话亲和性时,建议使用 RATE 平衡模式,而不是 UTILIZATION。

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

相关问题 GCP HTTP/S 负载平衡器路由规则 - GCP HTTP/S Load Balancer Routing Rules GCP 负载平衡(非经典)- URL 重写 - GCP Load Balancing (non classic) - URL rewrite 来自配置了 psc 后端的 gcp 负载均衡器的 http 流量是否安全? (对 Apigee) - Is http traffic from a gcp load balancer with psc backend configured secure? (to Apigee) 是否可以从 GCP 负载均衡器重写对后端服务(例如 Cloud Run)的传入请求? - Is it possible to rewrite an incoming request to the backend service (e.g. Cloud Run) from a GCP load balancer? GCP HTTP(s) 第 7 层负载均衡器中的动态 SSL 分配 - Dynamic SSL allocation in GCP HTTP(s) Layer 7 Load balancer 如何通过 gcloud 替换 GCP Load Balancer 后端服务健康检查 - How to replace GCP Load Balancer Backend Service Health Check via gcloud GKE - 使用 Ingress 和内部负载平衡公开服务 - GKE - expose service with Ingress and Internal Load Balancing Kubernetes 服务:IPVS 负载均衡算法 - Kubernetes Service: IPVS load balancing algorithm Azure 云服务的负载平衡不工作 - Azure Load Balancing of Cloud Service not working GCP 负载平衡器:502 服务器错误,“failed_to_connect_to_backend” - GCP Load Balancer: 502 Server Error, "failed_to_connect_to_backend"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM