此内容没有您所选择的语言版本。
Chapter 5. Launching Clustered JBoss EAP
5.1. Launch Clustered JBoss EAP AMIs (without mod_cluster and VPC)
This topic lists the steps to launch clustered JBoss EAP AMIs without mod_cluster and VPC.
- You can use the example configuration scripts that are provided with the image. For system path details, see System Paths.
- For information about configuring JBoss EAP subsystems for Amazon EC2, see Configuring JBoss EAP Subsystems to Work on Cloud Platforms.
To start clustered JBoss EAP AMI on standalone server instance, you can use the example /etc/opt/rh/eap7/jboss-ec2-eap/standalone/standalone-ec2-ha.xml
that contains a preconfigured S3_PING JGroups stack. For more information, see S3_PING. This standalone-ec2-ha.xml
profile file must be copied from /etc/opt/rh/eap7/jboss-ec2-eap/standalone/
to the JBoss EAP configuration directory /opt/rh/eap7/root/usr/share/wildfly/standalone/configuration/
. Then, you have to add the following line to the JBoss EAP service configuration file:
WILDFLY_SERVER_CONFIG=standalone-ec2-ha.xml
A unique instance-id
needs to be set for each standalone server instance in the undertow
subsystem. The example standalone-ec2-ha.xml
configuration sets this using instance-id="${jboss.jvmRoute}"
. A value for jboss.jvmRoute
can be specified in standalone.conf
using the JAVA_OPTS
variable. Alternatively, a value for the instance-id
can be set manually by editing standalone-ec2-ha.xml
or using the CLI.
The jgroups
subsystem in the EC2 configuration file requires some S3_PING
specific properties to discover cluster members. You must specify access key to S3, secret access key, and the S3 bucket to use for discovery. These properties can either be specified as Java options or put directly into the XML file by editing it or using CLI.
The S3 bucket for discovery needs to be created, for more information, see Amazon Simple Storage Service Documentation. You may also have to configure the required permissions. The JGroups stack needs to be bound to an IP address, which is used to communicate with other nodes. This can be done by adding Java options, along with S3 Java options to the /opt/rh/eap7/root/usr/share/wildfly/bin/standalone.conf
file. For example, if the private IP address was 10.10.10.10
, then you would add the following line to the standalone.conf
file:
JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.private=10.10.10.10"
You can deploy a sample application: /opt/rh/eap7/root/usr/share/java/eap7-jboss-ec2-eap-samples/cluster-demo.war
and observe the logs in /opt/rh/eap7/root/usr/share/wildfly/standalone/log/server.log
to see that the JBoss EAP servers have created a cluster.
For Domain Controller Instance
-
Copy the
domain-ec2.xml
file from/etc/opt/rh/eap7/jboss-ec2-eap/domain
to the JBoss EAP configuration directory. Set the following variables in the appropriate service configuration file:
WILDFLY_SERVER_CONFIG=domain-ec2.xml WILDFLY_HOST_CONFIG=host-master.xml
Add S3 domain controller discovery configuration to the
host-master.xml
file:<local> <discovery-options> <discovery-option name="s3-discovery" module="org.jboss.as.host-controller" code="org.jboss.as.host.controller.discovery.S3Discovery"> <property name="access-key" value="S3_ACCESS_KEY"/> <property name="secret-access-key" value="S3_SECRET_ACCESS_KEY"/> <property name="location" value="S3_BUCKET_NAME"/> </discovery-option> </discovery-options> </local>
- Configure users and add the secret values for users to the host controller instances. For more information, see Create a Managed Domain on Two Machines in the JBoss EAP Configuration Guide.
For Host Controller Instance
Set the following variable in the appropriate service configuration file:
WILDFLY_HOST_CONFIG=host-slave.xml
Add S3 domain controller discovery configuration to the
host-slave.xml
file:<remote security-realm="ManagementRealm"> <discovery-options> <discovery-option name="s3-discovery" module="org.jboss.as.host-controller" code="org.jboss.as.host.controller.discovery.S3Discovery"> <property name="access-key" value="S3_ACCESS_KEY"/> <property name="secret-access-key" value="S3_SECRET_ACCESS_KEY"/> <property name="location" value="S3_BUCKET_NAME"/> </discovery-option> </discovery-options> </remote>
NoteFor information about S3 domain controller discovery, see Launch One or More Instances to Serve as Host Controllers.
Running a JBoss EAP cluster in a subnet with network mask smaller than 24-bits or spanning multiple subnets complicates acquiring a unique server peer ID for each cluster member.
The auto-scaling Amazon EC2 feature can be used with JBoss EAP cluster nodes. However, ensure it is tested before deployment. You should ensure that your particular workloads scale to the required number of nodes, and that the performance meets your needs for the instance type you are planning to use, different instance types receive a different share of the EC2 cloud resources.
Furthermore, instance locality and current network/storage/host machine/RDS utilization may affect cluster performance. Test with your expected real-life loads and try to account for unexpected conditions.
The Amazon EC2 scale-down action terminates the nodes without any chance to gracefully shut down and as some transactions might be interrupted, other cluster nodes and load balancers need time to fail over. This is likely to impact your application users' experience.
It is recommended that you either scale down the application cluster manually by disabling the server from the mod_cluster management interface until processed sessions are completed, or shut down the JBoss EAP instance gracefully using SSH access to the instance or Red Hat JBoss Operations Network.
Test your procedure for scaling down does not lead to adverse effects on your users' experience. Additional measures might be required for particular workloads, load balancers, and setups.
5.2. Launch Clustered JBoss EAP AMIs (with mod_cluster and VPC)
This topic lists the steps to launch an Apache HTTP server instance to serve as a mod_cluster
proxy and a NAT instance for the Virtual Private Cloud (VPC).
- You can use the example configuration scripts that are provided with the image. For system path details, see System Paths.
- For information about configuring JBoss EAP subsystems for Amazon EC2, see Configuring JBoss EAP Subsystems to Work on Cloud Platforms.
An Amazon Virtual Private Cloud (Amazon VPC) is a feature of Amazon Web Services (AWS) that allows you to isolate a set of AWS resources in a private network. The topology and configuration of this private network can be customized to your needs.
For more information about Amazon Virtual Private Cloud website, see Amazon Virtual Private Cloud (VPC).
If you start a cluster with a mod_cluster
load balancer inside a VPC, the JBoss EAP servers are inaccessible to public. The mod_cluster
load balancer can be the only endpoint that is connected to the Internet.
For setting up domain controller instance, see Launch an Instance to Serve as a Domain Controller.
For setting up host controller instance, see Launch One or More Instances to Serve as Host Controllers.
For information about S3 domain controller discovery, see Launch One or More Instances to Serve as Host Controllers.
5.2.1. To launch clustered AMIs with VPC and mod_cluster
Configuring the VPC is optional. For more information, see http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/default-vpc.html#detecting-platform.
Install
jbcs-httpd24-mod_cluster-native
package and all of its dependencies. Themod_cluster
configuration file is installed in/opt/rh/jbcs-httpd24/root/etc/httpd/conf.d/mod_cluster.conf
.NoteFor more information about installation of Red Hat JBoss Core Services Apache HTTP Server, see the Apache HTTP Server Installation Guide.
Disable advertising for
mod_cluster
. Add the following toVirtualHost
in the/opt/rh/jbcs-httpd24/root/etc/httpd/conf.d/mod_cluster.conf
configuration file.ServerAdvertise Off EnableMCPMReceive # AdvertiseFrequency # comment out AdvertiseFrequency if present
-
Allow ports in
SELinux
. If required, configure theiptables
. Ports can be allowed in SELinux by using thesemanage port -a -t http_port_t -p tcp $PORT_NR
command. Configure JBoss EAP to look for
mod_cluster
proxy on the address thatmod_cluster
listens on.NoteThe
/etc/opt/rh/eap7/jboss-ec2-eap/standalone/standalone-mod_cluster-ec2-ha.xml
sample configuration file has been provided. You need to configure themod-cluster-binding
andoutbound-socket-binding
. Insert themod_cluster
address and port.