Tomcat

Tomcat is an Open Source, Java based, Web Application Server.
We can deploy only the WAR files.
In the Tomcat Server we are not able to deploy EAR Files.

War files -----------------Tomcat
War & Ear -------------- Jboss / Wildfly

Application Servers
  • Tomcat --------------------------------------------------------> Apache
  • Jboss / Wildfly   ----------------------->RedHat---------> IBM
  • Webspere Application Server  (WAS)-------------------> IBM
  • Weblogic  --------------------------------> BEA------------> Oracle

Directory Structure
  • bin   
    • sh startup.sh
    • startup.bat
    • .
    • shutdown.sh
    • shutdown.bat
    • .
    • catalina.sh   ------------------   We can starting & stoping the tomcat server
    • catalina.bat
    • .
    • version.sh
    • version.bat
  • conf
    • Servers.xml
    • Tomcat-Users.xml
  • lib
    • jar files

  • webapps
    • Whatever we are goint to store web application.
    • That application are stored in here.

  • work
    • After deploying out application.
    • Application it may generate some files those files are stored in here.

  • logs
    • Catalina.out ----------------- if tomcat is not working here i we need to check.

  • temp
    • .
Installation:

yum install java-1.8.0-openjdk
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.78/bin/apache-tomcat-9.0.78.zip
unzip apache-tomcat-9.0.78.zip










whereis java ------------------ it will display manual pages and binary files
which java  ---------------------binary files only

Check Tomcat Service Running 0r not?
  • ps -ef | grep tomcat
On which port it is running?
  • netstat -tunlap
  •         http://35.154.237.145:8080
  •         yum install net-tools -y
How to access Manager App?
  • Tomcat HD
    • Webapps
      • manager
        • META-INF
          • context.xml
How to access Host-Manager App?
  • Tomcat HD
    • Webapps
      • host-manager
        • META-INF
          • context.xml
          • <!-- Valve -->
How to creata a users in Tomcat Server?
  • Tomcat HD
    • conf
    • tomcat-users.xml
  • <user username="Ramadevi" password="Ramadevi@09" roles="manager-gui,"/>
  • <user username="Ramadevi" password="Ramadevi@09" roles="manager-gui, admin-gui">

How to change the port number in Tomcat Server?
  • Tomcat HD
    • conf
      • server.xml
  • :se nu
  • <Connector port> ( line number 69 )
  • Restart Tomcat (Stop & Start Tomcat server)
How to deploy the application in Tomcat Server?  (War file is available in Laptop)
  • Manager app
    • Deploy  (War file to deploy)          
How to deploy the application in Tomcat Server?  (War file is available in Server)
  • Manager app
    • Deploy
      • Deploy directory (or) WAR file located on server
      • Context path: /RRTechnologies-------------------(we can give custom context path also.)
      • WAR (or) Directory path:      /temp/maven-web-application.war
    • cp maven-web-application.war   /temp/              
How to access that application ?
  • http://ip_address:8080   (Tomcat Server URL)
    • Each application have context path---------> unique for each application.
    • http://ip_address:8080/context path
    • http://ip_address:8080/maven-web-application       
      • (context path= War applicatoin file name )
Hot fixes (Or) Hot Deployments for UI code?

Directly goto that application and fixes that problem with help of developer.
Goto applicatoin (In Linux)

Hot fixes (Or) Hot Deployments for Backend code?

Once hot fixes are done 
Goto tomcat server press the Reload Button

Tomcat Performance Tuning?
                        (or)
How to increase the Heap size in Tomcat?
  • Goto <Apache_Tomcat_Home_Dir>/bin
  • Createa a file name setenv.sh
  • Add below lines.
    • export CATALINA_OPTS="CATALINA_OPTS -Xms512m"
    • export CATALINA_OPTS="CATALINA_OPTS -Xmx8192m"
    • export CATALINA_OPTS="CATALINA_OPTS -XX:MaxPermSize=256m"
    • chmod u+x setenv.sh
    • StartTomcat
    • Before you start tomcat check in "Catalina.out"
  • Note: The default -Xmx value is 64MB
After restart Tomcat, whether it is reflection or not.
Go to catalina.out (logs directory) and check it.

Web Servers:

Types of Web Servers:
  • Apache HTTP Server
  • Nginx  (Engine -x)

  • Oracle Iplanet
  • IIS
  • IHS (IBM HTTP Server)
What is the Differ B/w Web Server & Application Server? 

     Web Severs:
  • In Web Servers we can deploy Static Content( html,css, js, Images..,).
     Application Server:
  • In Application Servres we can deploy (Business Logic) backend code and Static Content.
    • War files.
    • Ear files.

Web Server we can used as a Loadbalaning Server.                (round robin algaorithm)




Install Web Server:
  • sudo su -
  • yum install httpd -y                           (httpd package name)
  • Once you install httpd  it is going to create a server called as httpd.service.   
  • (Service name = httpd.service)
  • it is going to create a one user called as apache (User name  = apache )  System user
    • service httpd status
    • service httpd start
How to access httpd servie from your browser?

ip_address:80

Where the artifatcs (or) pakages are saved ?
  • tomcat   
    • webapps (For deploy applicatoins)
  • Web Server
    • /var/www/html/     (For deploy applicatoins)
What is the default file in Web Server?
  • index.htm
  • vi index.html
    • RRTechnologies.html
    • chmod  -R 755 .jpg



https://dlcdn.apache.org/tomcat/tomcat-10/v10.1.7/bin/apache-tomcat-10.1.7.zip
https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.39/bin/apache-tomcat-9.0.39.zip

Comments

Popular posts from this blog

AWS

Linux

kubernetes