CloudFoundry官方文档说的很清楚:
docs.cloudfoundry.org/devguide/cu…
By default, apps only receive requests on port 8080 for both HTTP and TCP routing, and so must be configured, or hard coded, to listen on this port.
在CloudFoundry上,默认的HTTP和TCP路由端口为8080.
使用8080之外的端口的场景:
Configuring custom app ports allows developers to bring workloads onto Cloud Foundry that listen on ports other than 8080. Here are some example use cases:
- 在端口A提供业务服务,端口B提供调试/管理/报表统计等业务
- 使用需要多端口支持的TCP交互方式
- 在CloudFoundry上运行Docker实例
首先要搞清楚CloudFoundry环境下的三种端口:
- Route port
路由端口,即客户端请求发送的目的端口。 - Backend port
后台端口,虚拟机监听的端口。应用容器就运行在这台虚拟机上。 - 应用端口
这个端口是应用运行的容器监听的端口,和容器内运行应用监听的端口是一一映射关系。
要获取更多Jerry的原创文章,请关注公众号"汪子熙":