Tomcat
------------
Tomcat is basically a webserver and Servlet system,
Apache Tomcat offers HTTP protocol, which means the user can connect with the server from anywhere by the URL provided and can access the Java application.
1. Difference between Apache and Tomcat
Tomcat provides dynamic content by employing Java-based logic, while the Apache web server's primary purpose is to simply serve up static content such as HTML, images, audio and text
2. What is the default port and How To We Can Change Tomcat Default Port?
8080 is the default HTTP port that Tomcat attempts to bind to at startup.
To change this, we need to change port in $ TOMCAT_HOME /conf/server.xml, in that we can search 8080 and after getting below statement
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
3. What Is Jasper?
Jasper is a Tomcat JSP engine. It parses JSP files to compile them into JAVA code as servlets
At runtime, Jasper allows to automatically detect JSP file changes and recompile them
4. Explain How Servlet Life Cycles?
Tom-cat receives a request from a client through one of its connectors
For processing, this request Tomcat maps this request to appropriate servlet.
Once the request has been directed to the appropriate servlet, Tomcat verifies that servlet class has been loaded.
If it is not than Tomcat wraps the servlet into Java Bytecode, that is executable by the JVM and forms an instance of the servlet
Tomcat initiates the servlet by calling its init The servlet contains code that is able to screen Tomcat configuration files and act accordingly, as well as declare any resources it might require
Once the servlet has been started, Tomcat can call the servlet’s service method to proceed the request
Tomcat and the servlet can co-ordinate or communicate through the use of listener classes during the servlet’s lifecycle, which tracks the servlet for a variety of state changes.
To remove the servlet, Tomcat calls the servlets destroy method.
5. What is the name of inbuilt Web Container in Tomcat?
The name of the inbuilt Web Container in Tomcat is Catalina which is present in the bin directory.
Catalina is used for loading all the requests related to HTTP and can instantiate the objects of GET () and POST () methods.
6. What are the types of batch file with the help of which we can Start and Stop Apache Tomcat Server?
Startup.bat
Shutdown.bat
7. What Are The Connectors Used In Tomcat?
HTTP Connectors: It has many attributes that can be changed to determine exactly how it works and access functions such as redirects and proxy forwarding
AJP Connectors: It works in the same manner as HTTP connectors, but they practice the AJP protocol in place of HTTP. AJP connectors are commonly implemented in Tomcat through the plug-in technology mod_jk.
8. What is the deployment process of web application using WAR file?
There is a Web apps directory in Tomcat under which all the web components JSP, Servlets, HTML are placed.
Hereby putting all the files into a single folder we can compress the files into a single unit which has .WAR extension.
Now we can easily deploy the web application by putting the WAR file in the Web apps directory.
And when the server starts it extracts all the web components.
# Why do we require Apache Tomcat?
It is required to run Java Web Applications on the host and server-based systems. It also helps to run JSP and Servlets.
#Disaster Recovery:
--------------------
Backups
mirrored backups:
# LVM
-------
fdisk /dev/sdb
pvcreate /dev/sdb1
pvcreate /dev/sdc2
vgcreate vgname /dev/sdb1 /dev/sdc2
lvcreate -L size -n lvname vgname
pvcreate /dev/sdb2
vgextend vgname /dev/sdb2
lvextend -L3T /dev/vg00/sales-lv
resize2fs /dev/mapper/vg_cloud-LogVol00
lvreduce -L -2T vg00/sales-lv
Raid
========
0 - STriping, divide data into blocks, or stripes, and spread them across multiple physical disks
1 - maintains a complete copy of the data on a second, separate physical drive
2 - 2 spreads both data and parity information across multiple physical disks
3 -
10 - Rai1 and 0