设置网络地址转换 (NAT) 负载均衡以向代理分发请求。
开始之前
实现 NAT 负载均衡需要三个 IP 地址:
- 非转发地址:此地址远程连接至代理。作为负载均衡操作中未涉及到的管理 IP 地址,此地址是直接分配给网络接口卡 (NIC) 的主机 IP 地址。此 IP 地址是 hosts 文件中的第一个主机。
- 集群地址:这是客户机连接的主机名。在 Rational® solution for Collaborative Lifecycle Management (CLM) 中,此地址是与公用 URI 相关联的主机名。此地址由集群分配,并且不得预先分配。
- 返回地址:负载均衡器使用此地址与后端服务器进行通信。此地址由集群分配,并且不得预先分配。
此外,您需要知道下列 IP 地址:
- 客户机网关:客户机网关是传入客户机的路由器地址。将客户机网关设置为缺省网关。
- 服务器路由器:如果负载均衡器正在通过路由器与不在同一子网中的后端服务器联系,请将服务器路由器设置为服务器路由器地址。如果未使用路由器,请将服务器路由器设置为服务器地址。
- 服务器地址:要进行负载均衡的所有后端服务器的主机名或 IP 地址。
关于此任务
在此任务中,您使用两个代理
clmproxy1.example.org 和
clmproxy2.example.org,它们都在端口 443 传递安全套接字层 (SSL) 上的请求。您将这些代理服务器映射至
http://clm.example.org:443。
下列示例用于负载均衡器地址:
- 非转发地址:lb.example.org
- 集群地址:clm.example.org:443
- 返回地址:lbert.example.org
下列示例用于服务器地址:
- node1.example.org:9443
- node2.example.org:9443
过程
要设置 NAT 负载均衡,请打开命令提示符并输入下列命令:
- 启动负载均衡器:
dsserver start
dscontrol executor start
- 设置非转发地址:
dscontrol executor set nfa lb.example.org
dscontrol executor set clientgateway gateway.example.org
- 设置集群地址:
dscontrol cluster add clm.example.org
- 创建集群虚拟 IP 地址并分配此地址:
dscontrol executor configure clm.example.org
- 在端口 443 上使用 NAT:
dscontrol port add clm.example.org:443 method nat
- 创建返回虚拟 IP 地址并分配此地址:
dscontrol executor configure lbret.example.org
- 添加节点 1:
dscontrol server add clm.example.org:443:clmproxy1.example.org mapport 443 router clmproxy1.example.org returnaddress lbret.example.org
- 添加节点 2
dscontrol server add clm.example.org:443:clmproxy2.example.org mapport 443 router clmproxy2.example.org returnaddress lbret.example.org
- 启动管理器:
dscontrol mananger start
- 启动顾问程序:
dscontrol advisor start https 443