JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 for JBoss Enterprise Application Platform 5 and JBoss Enterprise Web Server 5 Edition 5.2.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 for JBoss Enterprise Application Platform 5 and JBoss Enterprise Web Server 5 Edition 5.2.
Legal Notice Copyright © 2012 Red Hat, Inc. T his document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0 Unported License. If you distribute this document, or a modified version of it, you must provide attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red Hat trademarks must be removed.
Table of Contents Table of Contents .Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4. . . . . . . . . . 1. Document Conventions 4 1.1. T ypographic Conventions 4 1.2. Pull-quote Conventions 5 1.3. Notes and Warnings 6 2. Getting Help and Giving Feedback 6 2.1. Do You Need Help? 6 2.2. Give us Feedback 7 . . . . . . . . . 1. Chapter . . .Introduction . . . . . . . .
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 . .roubleshooting T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 ........... B.1. Diagnostic Information 30 B.2. JBoss Enterprise Web Server 30 . . . . . . . . . .History Revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table of Contents 3
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 Preface 1. Document Conventions T his manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information. In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. T he Liberation Fonts set is also used in HT ML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed.
Preface Character Map from the main menu bar. Next, choose Search → Find… from the Character Map menu bar, type the name of the character in the Search field and click Next. T he character you sought will be highlighted in the Character T able. Double-click this highlighted character to place it in the T ext to copy field and then click the Copy button. Now switch back to your document and choose Edit → Paste from the gedit menu bar.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 package org.jboss.book.jca.ex1; import javax.naming.InitialContext; public class ExClient { public static void main(String args[]) throws Exception { InitialContext iniCtx = new InitialContext(); Object ref = iniCtx.lookup("EchoBean"); EchoHome home = (EchoHome) ref; Echo echo = home.create(); System.out.println("Created Echo"); System.out.println("Echo.echo('Hello') = " + echo.echo("Hello")); } } 1.3.
Preface Red Hat also hosts a large number of electronic mailing lists for discussion of Red Hat software and technology. You can find a list of publicly available mailing lists at https://www.redhat.com/mailman/listinfo. Click on the name of any mailing list to subscribe to that list or to access the list archives. 2.2. Give us Feedback If you find a typographical error, or know how this guide can be improved, we would love to hear from you.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 Chapter 1. Introduction JBoss Cloud Access is a Red Hat subscription feature which allows you to easily move your JBoss instances between traditional on-premise servers and JBoss-certified cloud servers. You have the freedom to choose the best computing resources according to your needs, while keeping your existing business and support models.
Chapter 2. Overview Chapter 2. Overview 2.1. What is provided? Membership in the JBoss Cloud Access program enables you to access private Amazon Machine Images (AMIs) created by Red Hat. T hese AMIs have your choice of JBoss Enterprise Application Platform 5.1.x or JBoss Enterprise Web Server 1.0.x pre-installed and are fully supported by Red Hat. For ongoing management and monitoring of the platform, a JBoss Operations Network (JON) 3.0.x agent is pre-installed.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 Chapter 3. Identify a suitable Red Hat AMI 3.1. Supported instance types JBoss Cloud Access supports a subset of the instance types available on Amazon EC2, full details of which can be found in Amazon's User Guide for Amazon Elastic Compute Cloud. Choose from the following instance types according to your requirements: Supported Instance T ypes Standard Instance Have memory-to-CPU ratios suitable for most general-purpose applications.
Chapter 3. Identify a suitable Red Hat AMI When searching for the required AMI, you can search with a general criterion ("JBEAP", for example), or a specific one ("RHEL-6.2-JBEAP-5.1.2-x86_64"). Continue to the appropriate deployment chapter, depending on your desired configuration.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 Chapter 4. Launching a standalone JBoss Enterprise Web Server instance In this example a sample web application is deployed on Apache T omcat 6 server. An Apache HT T PD server is used as a reverse proxy. 4.1. Prerequisites Suitable Red Hat AMI identified in Chapter 3, Identify a suitable Red Hat AMI; A pre-configured Security Group which allows incoming requests on ports 22 and 80. 4.2.
Chapter 4. Launching a standalone JBoss Enterprise Web Server instance Important In JBoss Enterprise Web Server deployed on EC2, the contents of the User Data field are treated as a script. If the first line is "#!" then it is run as any executable file, otherwise its contents are executed/sourced into the Red Hat Enterprise Linux init shell.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 Chapter 5. Launching a standalone JBoss Enterprise Application Platform instance In this example a sample web application is deployed to a standalone JBoss Enterprise Application Platform instance. For an example using clustering and Amazon's Relational Database Service (RDS), refer to Chapter 6, Launching clustered JBoss Enterprise Application Platform instances. 5.1.
Chapter 5. Launching a standalone JBoss Enterprise Application Platform instance If the sample application has been deployed, as per the example, continue testing according to the steps below. However if your own application has been deployed then follow your own testing methodology. 1. In the instance details pane, note the instance's "Public DNS". 2. In a browser, navigate to http://:8080/hello. 3.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 Chapter 6. Launching clustered JBoss Enterprise Application Platform instances In this example clustered JBoss Enterprise Application Platform instances are deployed with a simple JMS sender and receiver application. T o support the application, a JBoss Enterprise Web Server instance is deployed as a proxy and a Relational Database Service instance is deployed to provide the required MySQL DBMS. 6.1.
Chapter 6. Launching clustered JBoss Enterprise Application Platform instances Warning T he above settings are sufficient for this example scenario but for a production environment it is highly recommended that you consider the failover and back-up features. It is good practice to create separate user/password pairs for each application accessing the database. T une other configuration options according to your application's requirements. 6.3. Create a Virtual Private Cloud (VPC) 1.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 echo 1 > /proc/sys/net/ipv4/ip_forward echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter iptables -I INPUT 4 -s 10.0.1.0/24 -p tcp --dport 7654 -j ACCEPT iptables -I INPUT 4 -p tcp --dport 80 -j ACCEPT iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -I FORWARD -s 10.0.1.0/24 -j ACCEPT iptables -t nat -A POSTROUTING -o eth0 ! -s 10.0.0.
Chapter 6. Launching clustered JBoss Enterprise Application Platform instances 7. Disable the Amazon EC2 cloud source/destination checking for this instance so it can act as a router. a. Right-click on the running EWS instance and choose "Change Source/Dest check". b. Click on Yes, Disable. 8. Assign the elastic IP to this instance. 6.5. Starting instances in a cluster 6.5.1.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 it's required to set up the S3 bucket. 6.5.4. S3 bucket setup 1. Open the S3 tab in the AWS console. 2. Click on "Create Bucket". 3. Choose a name (clusterbucket123 for example) and click on Create. Note that bucket names are unique across the entire S3 so you will not be able to use the chosen name again. 4. Right click over the new bucket and choose Properties. 5. In the permissions tab click on "Add bucket policy". 6.
Chapter 6. Launching clustered JBoss Enterprise Application Platform instances 2. Choose desired number of instances (this will be the cluster size). 3. Choose VPC and instance type. 4. Go to Security Group and allow all traffic from the JBoss Enterprise Application Platform cluster subnet (set other restrictions as desired). 5.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 MOD_CLUSTER_PROXY_LIST=10.0.0.4:7654 ## clustering setup JBOSS_JGROUPS_S3_PING_SECRET_ACCESS_KEY= JBOSS_JGROUPS_S3_PING_ACCESS_KEY= JBOSS_JGROUPS_S3_PING_BUCKET=clusterbucket123 JBOSS_CLUSTER_ID=S3 ## database credentials configuration JAVA_OPTS="$JAVA_OPTS -Ddb.host=instancename.something.rds.amazonaws.com Ddb.database=mydatabase -Ddb.user= -Ddb.
Chapter 6. Launching clustered JBoss Enterprise Application Platform instances name="ServerPeer">jboss.messaging:service=ServerPeer jboss.messaging:service=PostOffice SampleTopic true EODS ## this will workaround the problem that in a VPC, instance hostname is not resolvable grep -q 10.0.1.15 /etc/hosts || \ for (( i=1 ; i<255 ; i++ )); do echo -e "10.0.1.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 3. Connect to the JBoss Enterprise Web Server instance: ssh -L7654:localhost:7654 4. Open http://localhost:7654/mod_cluster-manager in a browser.
Chapter 7. Establish monitoring with JBoss Operations Network (JON) Chapter 7. Establish monitoring with JBoss Operations Network (JON) With your business application deployed to a correctly-configured AMI instance, the next step is to establish monitoring of the platform with JBoss Operations Network (JON). T he JON server is commonly located inside a corporate network, so it's necessary to establish a secure connection between the server and each of its agents.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 corporate VPN gateway is acting in NAT mode, the JON server does not have direct visibility of agents. Port forwarding needs to be configured so that, for each agent, one port on the gateway is forwarded to the JON agent's address or port on the managed machine. T he JON agent also needs to be configured to tell the server the forwarded port number and IP address (see rhq.communications.connector.* description in agent-configuration.
Chapter 7. Establish monitoring with JBoss Operations Network (JON) (available at http://docs.redhat.com/docs/en-US/JBoss_Operations_Network/index.html) for instructions on how to change the agent's IP address. If this does happen it is best to bind the JON agent's life cycle to the VPN connection's life cycle. When the connection drops, stop the agent. When the connection is up again, update JON_AGENT_ADDR in /etc/sysconfig/jon-agent-ec2 to reflect the new IP address and restart the agent.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 User Script Parameters Deploying and configuring JBoss Enterprise Application Platform using the User Data field provides for flexibility and ease of management of multiple configurations. T he flexibility comes from the use of various parameters which can be used to configure the platform or in the deployment of your custom application. A.1.
User Script Parameters used for registration, after that agent may communicate with other servers in the JON cluster. JON_SERVER_PORT Port used by the agent to communicate with the server. 7080 JON_AGENT _NAME Name of JON agent, must be unique. Instance's ID JON_AGENT _PORT Port that the agent listens on. 16163 JON_AGENT _ADDR IP address to which the JON agent is to be bound. T his is used when the server has more than one public address, e.g. VPN.
JBoss Enterprise Application Platform 5 Getting Started on Amazon EC2 Troubleshooting EC2 does not provide any method out of the box to indicate an instance has started correctly and services are running properly. Use of an external system for monitoring and management is recommended so that you can be proactive.
Revision History Revision History Revision 5.2.0-100.4 00 Rebuild with publican 4.0.0 2013-10-30 Rüdiger Landmann Revision 5.2.0-100 Wed 23 Jan 2013 Russell Dickenson Incorporated changes for JBoss Enterprise Application Platform 5.2.0 GA. For information about documentation changes to this guide, refer to Release Notes 5.2.0. Revision 5.1.2-201 First edition.