6.2. 使用 mod_cluster 和 VPC 启动集群的 JBoss EAP AMI
本节列出了启动 Apache HTTP 服务器实例以用作 mod_cluster
代理和 Virtual Private Cloud (VPC)的 NAT 实例的步骤。
- 您可以使用镜像提供的示例配置脚本。
Amazon Virtual Private Cloud (Amazon VPC)是 Amazon Web Services (AWS)的一个功能,允许您在专用网络中隔离一组 AWS 资源。可根据您的需要自定义此专用网络的拓扑和配置。
有关 Amazon VPC 的更多信息,请参阅 Amazon Virtual Private Cloud。
如果您使用 VPC 中的 mod_cluster
负载平衡器启动集群,则公共 JBoss EAP 服务器将无法访问。mod_cluster
负载平衡器可以是连接到互联网的唯一端点。
有关设置 域控制器实例,请参阅 启动实例以作为 域控制器的域控制器。
有关设置主机控制器实例,请参阅 启动一个或多个 实例作为主机控制器实例。
如需有关 S3 域控制器发现的信息,请参阅 启动一个或多个实例作为主机控制器。
配置 VPC 是可选的。如需更多信息,请参阅 Amazon VPC 用户指南中的 Detecting your Supported Platforms and whether Have a Default VPC 部分。
安装
jbcs-httpd24-mod_cluster-native
软件包及其所有依赖项。mod_cluster
配置文件安装在/opt/rh/jbcs-httpd24/root/etc/httpd/conf.d/mod_cluster.conf
中。有关安装 Red Hat JBoss Core Services Apache HTTP 服务器的更多信息,请参阅 Apache HTTP 服务器安装指南。
禁用
mod_cluster
的广告。将以下内容添加到/opt/rh/jbcs-httpd24/root/etc/httpd/conf.d/mod_cluster.conf
配置文件中的VirtualHost
:ServerAdvertise Off EnableMCPMReceive # AdvertiseFrequency # comment out AdvertiseFrequency if present
-
允许
SELinux
中的端口。如果需要,配置iptables
。使用semanage port -a -t http_port_t -p tcp $PORT_NR
命令可在 SELinux 中允许端口。 将 JBoss EAP 配置为查找
mod_cluster
侦听的地址上的mod_cluster
代理。注意提供了
/opt/rh/eap8/root/usr/share/wildfly/docs/examples/configs/standalone-ec2-ha.xml
示例配置文件。您需要在modcluster
子系统中配置
代理列表。您可以使用以下方法之一
定义
代理列表:使用适当的主机和端口定义一个名为
mod-cluster-proxy1
的outbound-socket-binding
:<outbound-socket-binding name="mod-cluster-proxy1"> <remote-destination host="${jboss.modcluster.proxy1.host}" port="${jboss.modcluster.proxy1.port}"/> </outbound-socket-binding>
将
modcluster
子系统中的proxies
属性设置为带有适当主机和端口的mod-cluster-proxy1
:/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=mod-cluster-proxy1:add(host={${jboss.modcluster.proxy1.host}}, port={${jboss.modcluster.proxy1.port}})