• No results found

tc Server Webinar Series Deployments

N/A
N/A
Protected

Academic year: 2021

Share "tc Server Webinar Series Deployments"

Copied!
34
0
0

Loading.... (view fulltext now)

Full text

(1)

tc Server Webinar Series

Large Scale Tomcat

Large Scale Tomcat

Deployments

Filip Hanik

SpringSource

2009

2009

(2)

Agenda

• Basic Installation Prelude

• Basic Installation Prelude

• Flexible Directory Layout

• Configuration Templates

• Configuration Templates

• Environment variables

D

• Demos

– Installation

– Upgrade

(3)

Tomcat Folder Structure

Folder structure overview

Folder structure overview

apache-tomcat-6.0.x/ bi - bin - conf - lib - logs - temp - webapps - work

(4)

Tomcat Folder Structure

Folder structure overview

Folder structure overview

apache-tomcat-6.0.x/

bi d d i t t

- bin - used during startup - conf - CATALINA_BASE

- lib - CATALINA_HOME

- logs - logging.properties - temp - CATALINA_TMPDIR

- webapps – server.xml (<Host>) - work - server.xml (<Host>)

(5)

How Tomcat reads directories

• bin directory

y

– Only storage space for scripts and bootstrap libraries

– Never used during runtime

• All other directories are 'configurable'

There are some slight exceptions

– There are some slight exceptions

• We can take advantage of this

– Tomcat upgrades/downgrades

– JVM upgrades/downgrades

(6)

Starting up Tomcat

bin/

startup.(sh|bat)

shutdown.(sh|bat)

<start>

<stop>

(7)

Starting up Tomcat

catalina.(sh|bat)

setclasspath.(sh|bat)

setenv.(sh|bat)

<invokes>

<invokes>

Startup Scripts

JVM Launch

(8)

Setting custom options

z

setenv.sh - Any custom options here

sete

s

y custo

opt o s e e

z

JAVA_HOME

z

JAVA_OPTS

z

CATALINA_OPTS

z

CATALINA_HOME

z

CATALINA BASE

_

z

CATALINA_TMPDIR

z

CATALINA_PID

•All these are read by catalina.sh

(9)

Setting Custom Options

z

setenv.sh doesn't ship with Tomcat

sete

s does t s p

t

o cat

z

Upgrading Tomcat

z

Simply copy setenv.sh

z

No need to modify Tomcat scripts, or keep track

of changes inside Tomcat scripts

(10)

Up/Down-grading JVM

/development/tomcatx/example/ / p / / p / - apache-tomcat-6.0.18/ - apache-tomcat-6.0.20/ - jdk1.5.0_19/ jdk1 6 0 14/ - jdk1.6.0_14/ - myapplications z

setenv sh

z

setenv.sh

z

JAVA_HOME points to 1.5 or 1.6

z

Easy to switch back and forth

Easy to switch back and forth

(11)

Tomcat Folder Structure

/development/tomcatx/example/ / p / / p / - apache-tomcat-6.0.18/ - apache-tomcat-6.0.20/ - jdk1.5.0_19/ jdk1 6 0 14/ - jdk1.6.0_14/ - tomcat-instance-01/ - bin - conf - logs - webapps - work - temptemp

(12)

So far

setenv.sh

sete

s

CATALINA_HOME=/usr/local/apache-tomcat-6.0.18 CATALINA BASE=/usr/local/tomcat instance 01 CATALINA_BASE=/usr/local/tomcat-instance-01 JAVA_HOME=/usr/local/jdk1.6.0_14

CATALINA_PID=$CATALINA_BASE/logs/tomcat.pid

Modify JAVA_HOME to change JVM

(13)

Tomcat upgrades

• Most important thing during a production

ost

po ta t t

g du

g a p oduct o

upgrade:

– How to downgrade/roll back if something goes wrong

• With Tomcat, that's easy, keep multiple

installations

• With JVM, that's easy, keep multiple

installations

(14)

Going further

• So far

So a

– Understanding setenv.sh

– Understanding file/directory structure

• Lets take it to the next step

• Lets create a setup that will make all this seem

so much more intuitive

(15)

Creating the layout

apache-tomcat-6.0.x/

* A l T t i t ll

* A regular Tomcat install

run.sh

* Control script

shared/

* Shared instance data

instance_1/

* An instance of a Tomcat server

instance 2/ instance_2/ instance_n/

(16)

Creating the layout

shared/ f/ - conf/ logging.properties server.xml tomcat-users.xml - logs/

(17)

Creating the layout

instance_1/ bi / - bin/

setenv.sh * Instance specific JVM options

- conf/ * Instances configuration

catalina.properties

- logs/ * catalina.out goes here

- webapps/ * Instance applications

- work/ * Instance work directory

(18)

Creating the layout

instance_2/ bi / - bin/

setenv.sh * Instance specific JVM options

- conf/ * Instances configuration

catalina.properties

server.xml * non shared config

- logs/ * catalina.out goes here

- webapps/ * Instance applications

- work/work/ * Instance work directory Instance work directory

(19)

Configuration

shared/conf/server.xml

<Server port="${shutdown.port}" shutdown="SHUTDOWN">

<Connector port="${http.port}" protocol="HTTP/1.1"

connectionTimeout="20000" /> run.sh

(20)

Configuration

instance_1/conf/catalina.properties

shutdown.port=8005 http.port=8080

* Anything in here gets read into System.getProperties(...)

(21)

Configuration

shared/conf/logging.properties 1catalina.org.apache.juli.FileHandler.level = FINE 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/../shared/logs 1catalina.org.apache.juli.FileHandler.prefix =

${catalina instance} catalina

${catalina.instance}.catalina.

* Single configuration file

(22)

Configuration

instane_1/bin/setenv.sh

CATALINA_OPTS=”-Xmx512m -Xss192k”

(23)

The Script

• run.sh

u s

– The script that does it all

– Takes advantage of configuration options in Tomcat

– Creates a simple, flexible and yet powerful layout

structure

– Provides ability to switch JVM and Tomcat versions

without changing any configuration

(24)

tc Server

• tc Server

tc Se e

– Tomcat on steroids

– 100% application compatibility with Apache Tomcat

– Leverages Apache Tomcat layout features

(25)

tc Server

• Installation

sta at o

– Same concept – unzip and run

– Comes with a command line installer

– Or a zip file in format for .sfx.jar

#Platform independent installp

>java -jar tcServer-6.0.20.A.sfx.jar >ls

tcServer 6 0 20 tcServer-6.0.20

(26)

tc Server

• Folder Layout

o de

ayout

– Same concept – binaries and instances

#Platform independent install

>ls tcServer-6.0.20

instance1 instance3 instance2 tcserver-ctl sh tcserver-ctl bat tcserver ctl.sh tcserver ctl.bat

tcserver-instance.sh tcserver-instance.bat tomcat-6.0.18.A tomcat-6.0.19.A t t 6 0 20 A tomcat-6.0.20.A tijars

(27)

tc Server

• Folder Layout

o de

ayout

– Binaries – always complete versions of Tomcat

#Platform independent install

>ls tcServer-6.0.20

instance1 instance3 instance2 tcserver-ctl sh tcserver-ctl bat tcserver ctl.sh tcserver ctl.bat

tcserver-instance.sh tcserver-instance.bat tomcat-6.0.18.A tomcat-6.0.19.A t t 6 0 20 A tomcat-6.0.20.A tijars

(28)

tc Server

• Folder Layout

o de

ayout

– Multiple instances

#Platform independent install

>ls tcServer-6.0.20

instance1 instance3 instance2 tcserver-ctl sh tcserver-ctl bat tcserver ctl.sh tcserver ctl.bat

tcserver-instance.sh tcserver-instance.bat tomcat-6.0.18.A tomcat-6.0.19.A t t 6 0 20 A tomcat-6.0.20.A tijars

(29)

tc Server

• Folder Layout

o de

ayout

– Creating instances

#Platform independent install

>ls tcServer-6.0.20

instance1 instance3 instance2 tcserver-ctl sh tcserver-ctl bat tcserver ctl.sh tcserver ctl.bat

tcserver-instance.sh tcserver-instance.bat tomcat-6.0.18.A tomcat-6.0.19.A t t 6 0 20 A tomcat-6.0.20.A tijars

(30)

tc Server

• Folder Layout

o de

ayout

– Controlling run time instances

#Platform independent install

>ls tcServer-6.0.20

instance1 instance3 instance2 tcserver-ctl sh tcserver-ctl bat tcserver ctl.sh tcserver ctl.bat

tcserver-instance.sh tcserver-instance.bat tomcat-6.0.18.A tomcat-6.0.19.A t t 6 0 20 A tomcat-6.0.20.A tijars

(31)

tc Server

• Folder Layout

o de

ayout

(32)

Summary

• Large scale deployments are possible

a ge sca e dep oy e ts a e poss b e

• Can be very large

– Our customers have thousands of managed instances

• Tomcat doesn't provide the infrastructure

Tomcat doesn t provide the infrastructure

– Provides flexibility no other container does

– Automate your own environment

(33)

tc Server

• Summary

Su

a y

– Script based so it can be automated

– Unix looks like Windows

E t f i d i il

• Except wrapper.conf cause windows is evil • But wrapper.conf is file based, not registry

– Upgrade/downgrade/copy

• Everything you need

– Useful for both developers and operations

• I create instances to test different configurations I create instances to test different configurations • Always have a record of my tested configs

(34)

SpringOne Americas 2009

www.springone2gx.com

Americas 2009

• Premier Java Event of 2009

• Keynote by Rod Johnson, Adrian Colyer • Technical Sessions Case Studies Best

Americas 2009

• Technical Sessions, Case Studies, Best

Practices, Hands-on Code Examples, Cutting-Edge Tools

• Session covering:

• Spring technologies • Groovy & Grails

• Hyperic Management Tools

• Apache Projects like Tomcat, httpd and ActiveMQ

References

Related documents

These designations include CPA (Certified Public Accountant), CFP (Certified Financial Planner), PFS (Personal Financial Specialist), CGMA (Chartered Global

[r]

When we abstract from the potential impact of predictable data revisions on test behavior, and compare MSE-F and MSE-t(S dd ) to asymptotic critical values simulated as in Clark

The Modified Principal Component Analysis technique shall take care of issues such as problem arising from the reconstruction of the face images using their corresponding

It is well settled that compassionate appointment is not a matter of right, but must be governed by the terms on which the State lays down the policy of offering

In short, we ask whether broad and abstract foreign policy postures, coupled with vari- ables standard in models of political choice (economic evaluations and partisanship),

Since the main way for families to enhance their material well-being is by allocating more of their time to paid employment which means invariably less home time spent with

Another approach to improve the standard mortgage choice set and to reduce enforcement costs over time, would be to build in banking agency supervision as well as periodic required