您正在查看的是 Apigee Edge 文档。
转到 Apigee X 文档。 信息
问题
通过 Edge 界面或 Management API 部署 API 代理修订版本会失败,并出现超时错误。
错误消息
Click to change deployment status. The revision is deployed and traffic can flow, but flow may be impaired. Error: Call timed out; either server is down or server is not reachable
可能的原因
此问题的典型原因如下:
原因 | 详细说明 | 适用于 |
网络连接问题 | 由于网络连接问题或防火墙规则而导致管理服务器与消息处理器之间的通信失败。 | 仅限 Private Cloud 用户 |
大型 API 代理软件包 | 如果 API 代理软件包过大,从而导致 RPC 超时,消息处理器可能需要很长时间才能激活。 | 私有云和公有云用户 |
网络连接问题
注意:只有 Edge Private Cloud 用户可以执行以下步骤。如果您使用的是 Edge 公有云,请与 Apigee Edge 支持团队联系。
诊断
- 使用以下 Management API 调用获取显示错误的特定 API 的部署状态:
curl -v http://<management-server-IPaddress>:<port#>/organizations/<orgname>/environments/<envname>/apis/<apiname>/deployments -u <username>
显示错误的示例输出:
{ "error": "Call timed out; either server is down or server is not reachable", "status": "error", "type": [ "message-processor" ], "uUID": "ebbc1078-cbde-4a00-a7db-66a3c1b2b748" }, { "status": "deployed", "type": [ "message-processor" ], "uUID": "204e2b7e-52f7-46d9-b458-20f9bfb51e6d" }, { "status": "deployed", "type": [ "router" ], "uUID": "967e63c6-ee95-47c0-9608-f4a32638fb1e" }, { "status": "deployed", "type": [ "router" ], "state" : "error" }
上面的示例输出显示,其中一个 UUID 为“
ebbc1078-cbde-4a00-a7db-66a3c1b2b748
”的消息处理器上发生了错误。 - 根据 API 代理的部署状态输出,使用显示了错误的相应 UUID 登录每个消息处理器,然后执行以下步骤:
- 检查消息处理器是否正在监听端口 4528:
netstat -an | grep LISTEN | grep 4528
如果消息处理器未在端口 4528 上进行监听,则重启消息处理器:
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- 使用上面第 1 步中所示的 Management API 调用来重新检查 API 代理的部署状态。如果没有错误,则表示问题已解决。
- 检查消息处理器是否正在监听端口 4528:
- 如果问题仍然存在,请按照以下步骤在端口 4528 上测试从管理服务器到消息处理器的连接:
- 如果 telnet 可用,请使用 telnet:
telnet <MessageProcessor_IP> 4528
- 如果 telnet 不可用,请使用 netcat 检查连接,如下所示:
nc -vz <MessageProcessor_IP> 4528
- 如果您收到“连接被拒绝”或“连接超时”响应,请与您的网络运营团队合作。
- 如果 telnet 可用,请使用 telnet:
- 按照以下步骤在端口 4526 上测试从消息处理器到管理服务器的连接:
- 如果 telnet 可用,请使用 telnet:
telnet <management-server-IP> 4526
- 如果 telnet 不可用,请使用 netcat 检查连接,如下所示:
nc -vz <management-server-IP> 4526
- 如果您收到“连接被拒绝”或“连接超时”响应,请与您的网络运营团队联系。
- 如果 telnet 可用,请使用 telnet:
- 与您的网络运营团队合作,并执行以下操作:
- 确保管理服务器和消息处理器上允许使用 RPC 协议。
- 移除管理服务器和消息处理器之间的所有防火墙限制或安全规则设置,以允许连接到管理服务器上的端口 4526,以及从管理服务器到端口 4528 上的消息处理器的连接。
- 重新检查部署状态(请参阅上面的第 1 步)。如果您没有看到任何错误,则表示错误已解决。
- 如果问题仍然存在,请检查消息处理器是否存在网络问题。如果存在网络问题,重启显示超时错误的特定消息处理器(根据部署状态输出)可能会解决问题:
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- 如果问题仍然存在,请前往以下网址查看 Management Server 日志:
/opt/apigee/var/log/edge-management-server/logs/system.log
。管理服务器日志中的“调用超时”错误示例
2016-05-17 09:29:56,448 org:myorg env:prod qtp281969267-360792 ERROR DISTRIBUTION - RemoteServicesConfigEventHandler.configureServers() : exception for server with uuid e1381db7-d83b-4752-ae04-2de33f07e555 : cause = RPC Error 504: Call timed out communication error = true com.apigee.rpc.RPCException: Call timed out at com.apigee.rpc.impl.AbstractCallerImpl.handleTimeout(AbstractCallerImpl.java:64) ~[rpc-1.0.0.jar:na] at com.apigee.rpc.impl.RPCMachineImpl$OutgoingCall.handleTimeout(RPCMachineImpl.java:483) ~[rpc-1.0.0.jar:na] at com.apigee.rpc.impl.RPCMachineImpl$OutgoingCall.access$000(RPCMachineImpl.java:402) ~[rpc-1.0.0.jar:na] at com.apigee.rpc.impl.RPCMachineImpl$OutgoingCall$1.run(RPCMachineImpl.java:437) ~[rpc-1.0.0.jar:na] at io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:532) ~[netty-all-4.0.0.CR1.jar:na] at io.netty.util.HashedWheelTimer$Worker.notifyExpiredTimeouts(HashedWheelTimer.java:430) ~[netty-all-4.0.0.CR1.jar:na] at io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:371) ~[netty-all-4.0.0.CR1.jar:na] at java.lang.Thread.run(Thread.java:745) ~[na:1.7.0_79]
如果您观察到上例中所示的类似错误,请增加管理服务器上的 RPC 超时,以便在出现任何网络速度缓慢的情况时,管理服务器应该有时间连接到消息处理器。
分辨率
注意:只有 Edge Private Cloud 用户可以执行以下步骤。如果您使用的是 Edge 公有云,请与 Apigee Edge 支持团队联系。
- 请执行以下步骤以增加 RPC 超时:
- 在管理服务器计算机上创建文件
/opt/apigee/customer/application/management-server.properties
(如果尚不存在)。 - 将以下代码行添加到此文件中:
conf_cluster_rpc.connect.timeout=<time in seconds>
RPC 默认超时值为 10,建议将其增加到 40 秒。设置如下:
conf_cluster_rpc.connect.timeout=40
- 确保此文件归 Apigee 所有:
chown apigee:apigee /opt/apigee/customer/application/management-server.properties
- 重启管理服务器:
/opt/apigee/apigee-service/bin/apigee-service edge-management-server restart
- 如果您有多个管理服务器,请在所有管理服务器上重复上述步骤。
- 在 Edge 界面中或使用 Edge Management API 调用部署 API 代理。如果 API 代理顺利部署,没有任何问题,则表示问题已解决。
- 在管理服务器计算机上创建文件
- 如果问题仍然存在,请从管理服务器和消息处理器收集
tcpdump 命令。在每个服务器上启用 tcpdump 命令,然后从界面或使用 Management API 启动 API 代理的部署:
- 从管理服务器运行以下 tcpdump 命令:
tcpdump -i any -s 0 host <message-processor-IP address> -w <File name>
- 从消息处理器运行以下 tcpdump 命令:
tcpdump -i any -s 0 host <management-server-IP address> -w <File name>
- 请与 Apigee Edge 支持团队联系,获取有关分析 tcpdump 并进一步排查问题的帮助。
- 从管理服务器运行以下 tcpdump 命令:
大型 API 代理软件包
诊断
- 检查观察到部署错误的 API 代理软件包的大小。
- 如果大小相当大(10 MB 或更大),那么消息处理器很可能需要更多时间来激活 API 代理。
- 如果 API 代理软件包大小超过 15 MB,请继续阅读 API 代理软件包大小超过 15MB。
分辨率
注意:只有 Edge Private Cloud 用户可以执行以下步骤。如果您使用的是 Edge 公有云,请与 Apigee Edge 支持团队联系。
请增加管理服务器上的 RPC 超时,以便消息处理器有足够的时间激活大型 API 代理捆绑包。请执行以下步骤以增加 RPC 超时值:
- 如果管理服务器机器上还没有
/opt/apigee/customer/application/management-server.properties
文件,请创建一个。 - 将以下代码行添加到此文件中:
conf_cluster_rpc.connect.timeout=<time in seconds>
RPC 超时值为 10,建议将其增加到 40 秒。设置如下:
conf_cluster_rpc.connect.timeout=40
- 确保此文件归 Apigee 所有:
chown apigee:apigee /opt/apigee/customer/application/management-server.properties
- 重启管理服务器:
/opt/apigee/apigee-service/bin/apigee-service edge-management-server restart
- 如果您有多个管理服务器,请在所有管理服务器上重复上述步骤。
如果问题仍然存在,请与 Apigee Edge 支持团队联系,以获取进一步帮助。