You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何配置Artifactory Satellite Pass-through拓扑下服务器间KeepAlive?

Artifactory Satellite Pass-through拓扑下服务器间KeepAlive配置思路

1. 配置请求发起方(客户端角色)的KeepAlive

当一台Artifactory将另一台作为上游服务器发起请求时,需确保其HTTP客户端发送Keep-Alive请求并维持连接:

  • 编辑$ARTIFACTORY_HOME/etc/artifactory.system.properties,添加以下参数:
    # 启用客户端KeepAlive
    artifactory.http.client.keepAlive.enabled=true
    # 空闲连接超时(毫秒,建议大于防火墙超时)
    artifactory.http.client.keepAlive.timeout=60000
    # 单路由最大持久连接数
    artifactory.http.client.maxConnectionsPerRoute=20
    # 全局最大持久连接数
    artifactory.http.client.maxTotalConnections=100
    
  • 重启Artifactory生效。

2. 配置请求接收方(服务端角色)的KeepAlive

被请求的Artifactory需要响应Keep-Alive头,维持连接:

  • 编辑$ARTIFACTORY_HOME/tomcat/conf/server.xml,找到HTTP服务的Connector节点(通常对应8081端口),调整属性如下:
    <Connector port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol"
               connectionTimeout="20000"
               keepAliveTimeout="60000"
               maxKeepAliveRequests="-1"
               redirectPort="8443"/>
    
    • keepAliveTimeout:空闲连接保持时长(毫秒,需与客户端配置匹配,且小于防火墙超时)
    • maxKeepAliveRequests:单连接允许的最大请求数,-1表示无限制
    • 必须使用NIO/NIO2协议(如Http11NioProtocol),BIO协议对KeepAlive支持有限
  • 重启Artifactory服务。

3. 防火墙适配配置

由于服务器间通过防火墙互联,需调整防火墙规则:

  • 将TCP空闲超时设置为大于Artifactory的keepAliveTimeout(例如70秒),避免防火墙提前断开空闲连接
  • 确保防火墙允许Artifactory节点间的HTTP/HTTPS端口通信,不对KeepAlive连接做额外中断处理

4. 验证配置

  • 用curl测试连接复用:
    curl -v -H "Connection: Keep-Alive" http://<目标节点地址>:8081/artifactory/api/system/ping
    
    检查响应头是否包含Connection: Keep-Alive,重复请求确认连接是否被复用
  • 查看Tomcat日志($ARTIFACTORY_HOME/logs/tomcat/catalina.out),搜索KeepAlive关键字,确认连接复用状态
  • 检查防火墙连接状态,确认空闲连接未被过早断开

内容的提问来源于stack exchange,提问作者mobios

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 12:27:13