如何在Traffic Server 9.1.1的records.config中给8080端口绑定多IP
Traffic Server 9.1.1 多IP绑定8080端口配置方案
正确配置格式
在records.config中,proxy.config.http.server_ports的配置需用逗号分隔每个绑定规则,且确保配置字符串无多余换行或空格干扰解析。以下两种格式均有效:
方式1:直接指定IP:端口组合
CONFIG proxy.config.http.server_ports STRING "10.120.36.138:8080,10.120.0.138:8080,10.120.37.32:8080,10.120.37.33:8080,10.120.37.34:8080,10.120.37.35:8080,10.120.37.36:8080,10.120.37.37:8080,10.120.37.38:8080,10.120.37.39:8080,10.120.37.40:8080,10.120.37.41:8080,10.120.37.42:8080,10.120.37.43:8080,10.120.37.44:8080,10.120.37.45:8080,10.120.37.46:8080,10.120.37.47:8080"
方式2:使用ip=参数格式(单行书写)
CONFIG proxy.config.http.server_ports STRING "8080:ip=10.120.36.138:proto=http,8080:ip=10.120.0.138:proto=http,8080:ip=10.120.37.32:proto=http,8080:ip=10.120.37.33:proto=http,8080:ip=10.120.37.34:proto=http,8080:ip=10.120.37.35:proto=http,8080:ip=10.120.37.36:proto=http,8080:ip=10.120.37.37:proto=http,8080:ip=10.120.37.38:proto=http,8080:ip=10.120.37.39:proto=http,8080:ip=10.120.37.40:proto=http,8080:ip=10.120.37.41:proto=http,8080:ip=10.120.37.42:proto=http,8080:ip=10.120.37.43:proto=http,8080:ip=10.120.37.44:proto=http,8080:ip=10.120.37.45:proto=http,8080:ip=10.120.37.46:proto=http,8080:ip=10.120.37.47:proto=http"
配置生效步骤
- 保存
records.config文件 - 执行命令重新加载配置:
traffic_line -x - 验证绑定结果:
或netstat -tulpn | grep traffic_serverss -tulpn | grep traffic_server
原配置失败原因
- 第二种尝试中使用了换行和多余空格,Traffic Server会将这些字符视为配置字符串的一部分,导致无法识别正确的IP端口规则
- 第三种尝试中单独的
8080会让服务绑定所有可用IP,若需求是仅绑定指定IP,需删除该条目,只保留指定IP的端口组合
内容的提问来源于stack exchange,提问作者Matthew Kutosi
相关产品推荐
相关产品推荐

