Cloud Computing Made Easy®
3-Tier Tomcat
From Cloud Computing Wiki - Kaavo
Contents |
Overview
This is a Sample System Definitions for demonstrating the deployment of a Enterprise Java application in a 3 tier setup. System has 3-tiers:
- DB_tier: MySQL Cluster (starting with 2 identical nodes)
- App_tier: Tomcat Server Cluster (starting with 2 identical nodes)
- Web_tier: Apache HTTP Service (1 node)
Scaling up, scaling down, and recovery actions/workflows are defined for Tomcat and MySQL clusters, so users can easily scale the Tomcat Cluster, or MySQL cluster or configure triggers to run the system on autopilot during runtime. Like other Sample System Definitions provided with IMOD, the Apache-Tomcat-MySQL-(EC2/Rackspace) is provided as an example. Users are expected to develop their own system definitions or customize the provided solutions for their own needs. The System Definition can be modified to deploy J2EE applications on any Kaavo supported platform. The information assumes that the users have basic understanding of deploying and starting systems in IMOD.
In this example after bring up the 3 tier Enterprise Java platform we automatically deploy one sample application (as sampleapp.war). Users can easily change the input parameters for the different actions (as mentioned in 'How to deploy your own application?' section below) to deploy their own custom Java application on the instantiated platform.
Note : We have tested this template with the below mentioned configuration:
Amazon EC2 Configuration:
All servers in web_tier, app_tier and db_tier are of Fedora 8, 32 Bit.
Rackspace Configuration:
All servers in web_tier, app_tier and db_tier are of CentOS 5.4, 64 Bit.
Please select RAM size ('Flavor Identifier' from UI) more than 1 GB while configuring Rackspace server instance.What are the system requirements for MySQL Cluster?
HTTP session replication is not enabled across Tomcat nodes. Load balancer has sticky session configuration.
Inputs
For testing, in general (in EC2/Rackspace) we need following inputs in the different actions, such as
a) Location of the ear/war file
b) Database schema name, username and password
c) Location of database restore and backup process
d) user access information for different Kaavo supported platform
In case there are any issues or questions please post them on http://forums.kaavo.com
After the application is up and running you can go to the http://ip-address-of-loadbalancer/sampleapp to start using the application.
Note: The provided sample application will first check whether there is any valid database connection or not, then check for whether there are any table/s or not. If no table/s found it will create tables ('sampleuser', 'samplerecords') and insert some records into 'sampleuser' for successfully login into the sample application. After the table has been created, one login screen will appear and user needs to provide username as 'sagar' and password as 'sagar' to login.
What deployment time Actions are included in the System Definition?
This system is divided into three parts.
*DB_tier: MySQL server and data node are running here
*App_tier: Tomcat Server and MySQL manager are running here
*Web_tier: Apache HTTP Service is running here
In these system, we start different tier in a specific order. First DB_tier, then App_tier and at last Web_tier gets started.
Amazon EC2 configuration
*Action for installing and starting DB_tier:
- install-mysql-ndbd
- create-ndbd-config
- ndb-api-start
- grant-mysql
*Action for installing and starting App_tier:
- install-mysql-manager
- create-manager-config
- manager-kick-start
- install-java
- download-ear-or-war-file
- create-tomcat-conf-context-file
- create-tomcat-conf-server-file
- create-application-ds
- configure-tomcat
- start-tomcat
*Action for installing and starting Web_tier:
- create-workers-properties
- create-mod-jk-conf
- start-apache
Rackspace configuration
*Action for installing and starting DB_tier:
- open-port-in-ndbd
- install-mysql-ndbd
- create-ndbd-config
- ndb-api-start
- grant-mysql
*Action for installing and starting App_tier:
- open-port-for-manager
- open-port-for-apptier
- restart-iptables-for-apptier
- install-mysql-manager
- create-manager-config
- manager-kick-start
- install-java
- download-ear-or-war-file
- create-tomcat-conf-context-file
- create-tomcat-conf-server-file
- create-application-ds
- configure-tomcat
- start-tomcat
*Action for installing and starting Web_tier:
- open-port-for-loadbalancer
- install_apache
- create-workers-properties
- create-mod-jk-conf
- start-apache
What run-time Events are defined in the System Definition?
a) For scaling up the Tomcat Server into the system trigger the event "ScaleUpApp_tier"
b) For scaling down the Tomcat Server from the system trigger the event "ScaleDownApp_tier"
c) For recovering dead Tomcat Server in the system trigger the event "RecoverApp_tier"
d) For scaling up the MySQL Data node into the system trigger the event "ScaleUpDB_Tier"
e) For scaling down the MySQL Data node from the system trigger the event "ScaleDownDB_tier"
f) For recovering dead MySQL Data node in the system trigger the event "RecoverDB_tier"
g) For recovering dead Apache HTTP service in the system trigger the event "RecoverWeb_tier"
How to deploy your own application?
It is very easy to deploy your own J2EE application in the system. You need to go to the action tab and edit the appropriate inputs for the relevant actions, e.g. location of ear/war file, file name etc. Following are the relevant actions and the inputs that you may need to replace with your own inputs.
Amazon EC2 configuration
Step 1: Modify ear or war file name and it's location for your application in action 'download-ear-or-war-file'.
Find below the screen shot
Step 2: Modify JNDI name, database name, username, password, application context path for your application in the action 'create-tomcat-conf-context-file'
Step 3: Modify JNDI name, database name, username, password for your application in the action 'create-application-ds'
Find below the screen shot
Step 4: Modify ear or war file name for your application in the action 'configure-tomcat'
Step 5: For database grant permission it needs database schema name, usename, passowrd as parameter in the action 'grant-mysql'.
Step 6: Insert your access_key and secret_key in action 'SetupS3cfg'
Step 7: For restoring the data into the MySQL server, it needs the already taken backup file name, location and database name as parameter in the action 'restore-database-from-s3files'.
For rackspace the name of the action is as 'restore-database-from-cloudfiles'.
Find below the screen shot
Step 8: For backup of valuable data, it needs the location, database schema name in the action 'backup-database'.
Find below the screen shot
Step 9: Specify the 'contextPath' for your application in action 'create-mod-jk-conf'.
Step 10: Specify the 'apachephrase' for apache HTTP service in action 'start-apache'.
Rackspace configuration
For deploying your application, follow all the above steps[0 to 10] except step 6.
In Rackspace, for downloading or uploading from/to rackspace cloud files, this system required three inputs for security reason, such as
a)HOST
b)API_KEY
c)USER
Insert these the information in the following actions,
1)restore-sampleapp-database-from-cloudfiles
2)backup-database
Note: Please select RAM size ('Flavor Identifier' from UI) more than 1 GB while configuring Rackspace server instance.
![[Wiki Home]](/skins/common/images/wiki.png)