429 要求數量過多

您目前查看的是 Apigee Edge 說明文件。
前往 Apigee X 說明文件
info

問題

您可能會看到路由器傳回這項錯誤,且追蹤記錄中不會顯示 429,因為要求未傳送至訊息處理器。直接撥打給路由器本身的電話也會回傳 429

錯誤訊息

<html>
  <head> <title>429 Too Many Requests</title> </head>
  <body> <center> <h1>429 Too Many Requests</h1> </center> <hr> <center>server</center> </body>
</html>
    

可能原因

一般來說,nginx 設定檔的設定為 conf_load_balancing_load.balancing.driver.nginx.limit_conn=5000,這可能對連入連線來說太低。

診斷

  1. 使用下列指令檢查 nginx 路由器上的預設限制:
    /opt/apigee/apigee-service/bin/apigee-service edge-router configure -search conf_load_balancing_load.balancing.driver.nginx.limit_conn
            
  2. 檢查虛擬主機 access_log 項目是否有 429 錯誤,並確認錯誤並非來自上游訊息處理器,而是直接來自路由器:
    cd /opt/apigee/var/log/edge-router/nginx/ grep "429 " org~env-port_access_log
            

解析度

  1. 使用 ssh 指令,逐一連線至路由器節點。
  2. 開啟下列檔案 (如果檔案不存在,請建立檔案):
    /opt/apigee/customer/application/router.properties
            
  3. 新增下列程式碼:
    conf_load_balancing_load.balancing.driver.nginx.limit_conn=25000
            
  4. 儲存檔案。
  5. 確認該檔案的擁有者為 apigee:apigee:
    sudo chown apigee:apigee router.properties
            
  6. 重新啟動路由器:
    /opt/apigee/apigee-service/bin/apigee-service edge-router restart
            
  7. 使用下列指令驗證,確認已設定屬性:
    /opt/apigee/apigee-service/bin/apigee-service edge-router configure -search conf_load_balancing_load.balancing.driver.nginx.limit_conn
            
  8. 在每個路由器上重複上述步驟。