简体   繁体   English

WSO2 API Manager 3.2.0 高可用性端点的问题

[英]Issues with WSO2 API Manager 3.2.0 high availability endpoints

We have configured the high availability for API end points as mentioned here https://apim.docs.wso2.com/en/3.2.0/learn/design-api/endpoints/high-availability-for-endpoints/#configuring-load-balancing-endpoints我们已经配置了 API 端点的高可用性,如此处所述https://apim.docs.wso2.com/en/3.2.0/learn/design-api/endpoints/high-availability-for-endpoints/#configuring-负载平衡端点

In Load balance and Failover Configurations we have chosen the "EndpointType" as "Load Balanced".在负载平衡和故障转移配置中,我们选择了“EndpointType”作为“负载平衡”。 We could see the requests are routed to these load balanced end points successfully.我们可以看到请求已成功路由到这些负载平衡端点。 However when we stop any one of the end-point node, 2 requests are still routed to the stopped node before the remaining requests are successfully routed to the active node.然而,当我们停止任何一个端点节点时,在剩余请求成功路由到活动节点之前,仍有 2 个请求被路由到停止的节点。 This is happening again and again when we receive new requests.当我们收到新的请求时,这种情况会一次又一次地发生。 The particular failed end-point is not marked as inactive or down特定的失败端点未标记为不活动或关闭

The error response are {"fault":{"code":101503,"type":"Status report","message":"Runtime Error","description":"Error connecting to the back end"}}错误响应是 {"fault":{"code":101503,"type":"Status report","message":"Runtime Error","description":"Error connecting to the back end"}}

The entries from carbon logs are attached below碳日志的条目附在下面

TID: [-1234] [] [2022-12-14 09:51:23,307] WARN {org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler} - Error while getting throttling information for resource and http verb TID: [-1] [] [2022-12-14 09:51:23,308] WARN {org.apache.synapse.transport.passthru.ConnectCallback} - Connection refused or failed for: /100.66.2.32:7010 TID: [-1234] [] [2022-12-14 09:51:23,309] WARN {org.apache.synapse.endpoints.EndpointContext} - Endpoint: NewMCMInboundChannel-RESTAPIService--vv2_APIproductionEndpoint_1 with address http://100.66.2.32:7010/mcm-provider will be marked SUSPENDED as it failed TID: [-1234] [] [2022-12-14 09:51:23,309] WARN {org.apache.synapse.endpoints.EndpointContext} - Suspending endpoint: NewMCMInboundChannel-RESTAPIService--vv2_APIproductionEndpoint_1 with address http://100.66.2.32:7010/mcm-provider - current suspend duration is: 30000ms - Next retry after: Wed Dec 14 09:51:53 UTC 2022 TID: [-1234] [] [2022-12-14 09:51:23,310] WARN {org.apache.synapse.endpoints.Lo TID:[-1234] [] [2022-12-14 09:51:23,307] WARN {org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler} - 获取资源和 http 动词 TID 的节流信息时出错: [-1] [] [2022-12-14 09:51:23,308] WARN {org.apache.synapse.transport.passthru.ConnectCallback} - 连接被拒绝或失败:/100.66.2.32:7010 TID: [- 1234] [] [2022-12-14 09:51:23,309] WARN {org.apache.synapse.endpoints.EndpointContext} - 端点:NewMCMInboundChannel-RESTAPIService--vv2_APIproductionEndpoint_1 地址为http://100.66.2.32:7010/mcm -provider将被标记为已暂停,因为它失败了 TID:[-1234] [] [2022-12-14 09:51:23,309] WARN {org.apache.synapse.endpoints.EndpointContext} - 暂停端点:NewMCMInboundChannel-RESTAPIService-- vv2_APIproductionEndpoint_1,地址为http://100.66.2.32:7010/mcm-provider - 当前挂起持续时间为:30000ms - 下一次重试时间:Wed Dec 14 09:51:53 UTC 2022 TID:[-1234] [] [2022-12 -14 09:51:23,310] WARN {org.apache.synapse.endpoints.Lo adbalanceEndpoint} - Endpoint [NewMCMInboundChannel-RESTAPIService--vv2_APIproductionEndpoint] Detect a Failure in a child endpoint: Endpoint [NewMCMInboundChannel-RESTAPIService--vv2_APIproductionEndpoint_1] TID: [-1234] [] [2022-12-14 09:51:23,310] INFO {org.apache.synapse.mediators.builtin.LogMediator} - {api:admin--NewMCMInboundChannel-RESTAPIService:vv2} STATUS = Executing default 'fault' sequence, ERROR_CODE = 101503, ERROR_MESSAGE = Error connecting to the back end adbalanceEndpoint} - 端点 [NewMCMInboundChannel-RESTAPIService--vv2_APIproductionEndpoint] 检测到子端点中的故障:端点 [NewMCMInboundChannel-RESTAPIService--vv2_APIproductionEndpoint_1] TID:[-1234] [] [2022-12-14 09:51:23,310] 信息{org.apache.synapse.mediators.builtin.LogMediator} - {api:admin--NewMCMInboundChannel-RESTAPIService:vv2} STATUS = 执行默认的“故障”序列,ERROR_CODE = 101503,ERROR_MESSAGE = 连接到后端时出错

Here what you are experiencing is the default behavior of the endpoint suspension.您在这里遇到的是端点挂起的默认行为。 Any endpoint created with API Manager can be in 3 states.使用 API Manager 创建的任何端点都可以处于 3 种状态。

  1. Active积极的
  2. Timeout暂停
  3. Suspended暂停

In your configuration, since you have configured two endpoints in a load-balanced manner, initially both endpoints are in the active state.在您的配置中,由于您以负载平衡的方式配置了两个端点,因此最初两个端点都处于活动状态。 Both endpoints share the load.两个端点共享负载。 Once the endpoint 2 is stopped, the next request routed to the endpoint failed with an error code and that has put the endpoint from active to suspended state.端点 2 停止后,路由到端点的下一个请求失败并显示错误代码,并且已将端点从活动状态变为暂停状态。

There are three configurations you can set in such suspended situation.在这种暂停情况下,您可以设置三种配置。

  1. Error code (The error code which puts the endpoint from active to suspended state)错误代码(将端点从活动状态变为挂起状态的错误代码)
  2. Initial suspension duration.初始暂停持续时间。
  3. Maximum duration最长持续时间
  4. Progression Factor进展因素

In the default configurations, initial suspension duration is set to 30 seconds.在默认配置中,初始暂停持续时间设置为 30 秒。 This means, server will remove the suspended state of the endpoint after 30 seconds from the endpoint failure and will put it back to the active state.这意味着,服务器将在端点故障 30 秒后删除端点的挂起状态,并将其恢复为活动状态。 That's why you can observe that endpoint is getting active from time to time.这就是为什么您可以观察到端点不时变得活跃的原因。 This is expected as the server tries to determine whether the endpoint is active or not.这是预期的,因为服务器会尝试确定端点是否处于活动状态。

You can increase this suspension time with the configurations and suspension time is calculated considering the other 3 configurations.您可以使用配置增加此暂停时间,并且暂停时间是在考虑其他 3 种配置的情况下计算的。

Endpoint suspension time = Min(current suspension duration * progressionFactor, maximumDuration)端点暂停时间 = Min(当前暂停时长 * progressionFactor, maximumDuration)

With each failed attempt, the progression factor will increase the suspension duration until the maximum time.对于每次失败的尝试,进展因子都会增加暂停持续时间,直到达到最长时间。 This will reset once the endpoint has served at least one successful request.一旦端点服务了至少一个成功的请求,这将重置。

You can configure all the in the publisher UI, endpoints section as below.您可以在发布者 UI 的端点部分中配置所有这些,如下所示。

在此处输入图像描述

More information on endpoint suspension can be found in here 1 .有关端点暂停的更多信息,请参见此处1

1 - https://docs.wso2.com/display/EI660/Endpoint+Error+Handling 1 - https://docs.wso2.com/display/EI660/Endpoint+Error+Handling

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

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