Thursday 18 February 2016

TOMCAT INSTALLATION (version 8.0.24)

TOMCAT INSTALLATION (version 8.0.24)

Step 1: Verify Java version

For the installation of Tomcat version 8.0.24, we need that java version 1.0.8_* version.

Check the version of java in the base machine using the below

sample output :

[root@sandy ~]# java -version

java version "1.6.0_22"

OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.41.1.10.4.el6-x86_64)

OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

step 2: Download Tomcat 8.0.24 version from the internet or using wget command

[root@sandy ~]#wget http://www.us.apache.org/dist/tomcat/tomcat-8/v8.0.24/bin/apache-tomcat-8.0.24.tar.gz    # tar xzf apache-tomcat-8.0.24.tar.gz

Step 3: Configure Environment Variables

Before starting Tomcat, configure CATALINA_HOME environment variable in your system using following commands.

# echo "export CATALINA_HOME=\"/opt/apache-tomcat-8.0.24\"" >> ~/.bashrc

Step 4: Starting Tomcat

Tomcat is very easy to use, There are no need to compile its source. You simple extract the archive and start the tomcat server. Tomcat by default start on port 8080, So make sure no other application using the same port.

[root@sandy ~]# cd apache-tomcat-8.0.24  [root@sandy ~]# .bin/startup.sh
Step 5: Access Tomcat in Browser

Tomcat server works on port 8080 default. Access tomcat on web browser by connecting your server on port 8080.

 http://sandy.domain.com:8080 



Step 6: Setup User Accounts

Finally we need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file in your editor and paste inside <tomcat-users> </tomcat-users> tags.Delete <!-- and --> tags.. In xml the line which start from <!-- is not take in account.

<!-- user manager can access only manager section -->    <role rolename="manager-gui" />  <user username="manager" password="manager" roles="manager-gui" />  <role rolename="admin-gui" />  <user username="admin" password="_SECRET_PASSWORD_" roles="manager-gui,admin-gui" />

Step 7 : login to Host Manager


Enter the user name and password as "manager" and "manager".

Step 8 : To change the default port

we can make the tomcat to listen different port as our wish and we can create multiple tomcat which will be listen in multiple port. To change the default port in <tomcat home>/conf/server.xml

<Connector port="8080" protocol="HTTP/1.1" <!--change the port number here -->

connectionTimeout="20000"

redirectPort="8443" />


By changing the connector port number to as our wish and restart the tomcat using <tomcat-home>/bin/./shutdown.sh and <tomcat-home>/bin/./startup.sh

Install Multiple Tomcat in single server



Running Multiple Tomcat Instances on Single Machine





In this post we will see how to run multiple tomcat instances on single machine and under single user account.
We first see the  tomcat directory structure. .





here each folder uses following purpose.


bin -  It contains all binary and script files for running tomcat.


lib - contains all shared libraries used for tomcat


conf - contains configuration information like which port tomcat can bind , etc...


logs - it contain all logging details


temp - this folder tomcat used for temporary files purpose


webapps - this folder is very important. here we put all application war files.


work - If application contain any jsp then jsp is translated and converted into servlet its stores here.



In when run the tomcat its uses 5 environment variables. They are 

CATALINA_HOME, CATALINA_BASE, CATALINA_TMPDIR, JRE_HOME/JAVA_HOME, CLASSPATH


in above list CATALINA_HOME and JAVA_HOME is mandatory environment variables. all others are optional and its can be calculated using CATALINA_HOME.




CATALINA_HOME - this environment variable should point to tomcat base folder, where tomcat binary are  installed/extracted. so based on CATALINA_HOME we can get bin and lib folder


CATALINA_BASE - If we not specified then CATALINA_HOME value is set. This variable pointed to configuration and webapps folder. Based on this variable server uses conf, logs, temp, webapps, work folders.


Usual ways to run the tomcat is only set CATALINA_HOME environment variable. and run the startup.sh script file. this startup.sh file automatically calculate and assign the values of other variables what we are not set.




startup.sh file set the environment variable and  then call catalina.sh file. this files is read CATALINA_BASE value and attach conf i.e $CATALINA_BASE/conf folder and get server.xml. this file is heart of tomcat. it contains all configuration information. like which tomcat uses as shoutdown port, connector post, host name, application folder ,.. for example usually tomcat uses 8080 is a connector port, so we can access http://localhost:8080/ 


if we set the $CATALINA_BASE explicitly then tomcat uses our variable to search and get the server.xml file from our target place, what we specified in CATALINA_BASE. 


this is trick to run multiple tomcat in single machine. we don't change CATALINA_HOME value. we need to change CATALINA_BASE value before start/shutdown the tomcat.



create one folder named "tomcat-instance1" anywhere, and copy conf, temp, webapps and logs  folder from CATALINA_HOME folder and change conf/server.xml file in tomcat-instance1. we need to change 3 port shutdown port, connector port and ajp port.


shutdown port - this port is used for shutdown the tomcat. when we call the shutdown.sh script they send signal to shutdown port. this port listen by tomcat java process. if signal is received the that process then its cleanup and exit by itself.


connector Port -This port is actual port to expose the application to outside client. 


ajp port - this port is used to apache httpd server  communicate to tomcat. this port used when we setup load balanced server.


see the sample server.xml file

.... ..d


  1. <server port="8005" shutdown="SHUTDOWN">  

  2. .....  

  3.  <connector connectiontimeout="20000" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectport="8443">  

  4.   

  5. <connector port="8009" protocol="AJP/1.3" redirectport="8443">  

  6. </connector></connector></server>  

so we change these three port to different number, because once this port is binded  then other process can't bind it again. so wee bind different port. so tomcat-instance1/conf/server.xml file i configured server port =8105, connector port = 8181, ajp port = 8109.



  1. <server port="8105" shutdown="SHUTDOWN">  

  2. .....  

  3.  <connector connectiontimeout="20000" port="8181" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectport="8443">  

  4. <connector port="8109" protocol="AJP/1.3" redirectport="8443">  

  5. </connector></connector></server>  


now we can create two script file for startup and shutdown the tomcat-instance1.
startup-instance1.sh
export CATALINA_BASE= /home/ramki/tomcat-instance1
cd $CATALINA_HOME/bin
./startup.sh





shutdown-instance1.sh

export CATALINA_BASE= /home/ramki/tomcat-instance1

cd $CATALINA_HOME/bin

./shutdown.sh



here we explicitly set the CATALINA_BASE variable and point to new tomcat-instance1
the we go to CATALINA_HOME/bin folder because all binary for running tomcat is still present in CATALINA_HOME folder then startup/shutdown the script.


Based on above technique we can create many instance folder and change conf/server.xml file port values and run that instance with own newly created script files.













Wednesday 17 February 2016

Datastage jobs Import/Export

Difference between Jobs with and without executable:

  1. Export job designs with executable:Both the ‘design time’ information (what you see in the Designer) and the ‘runtime code’ are exported. This way it can be imported into another environment and (ideally) be ready to run without any further steps. Of course, this assumes the new environment is equivalent to the old one, especially if true C++ compiled code is involved. You might use this if you only have a C++ compiler in the Dev environment, for instance, but don’t want to pay for licenses to run it on all boxes.
2. Export job designs without executable: Design time without run time. First thing you would need to do post-import would be a compile. Mostly for heterogeneous environments, I would imagine. Note that this is the only option available for exports in XML format.

ISX vs DSX

.isx archived file of .dsx
DataStage export generates “.dsx”. Information Server Manager export generates “.isx”
Isx is in binary form and dsx is not, so isx is more secured.
Less in size and can automate easily compared to dsx.

How to use ISTOOL for EXPORT IMPORT Information Server Components

Location of command:
Windows: IBM\InformationServer\Clients\istools\cli
Export command sample:
Example
domain name: SERVER.us.ibm.com
port no: 9080
DS Server name: SERVER
DS Project name: Test
and we want to export parallel job PxCustom.pjb which is in folder “Jobs/PX Jobs/”.
then command would be
istool export -dom SERVER.us.ibm.com:9080 -u admin -p admin -ar /test1.isx -ds ‘ “SERVER/Test/Jobs/PX Jobs/PxCustom.pjb” ‘
We export with executable using incexec because we don’t have compiler in production env.
Possible values for: Options
Long Name: Short Name: Description:
-help , -h : print command usage
-domain , -dom : Name of Information Server domain
-username , -u : Name of user account on Information Server domain
-password , -p : Password for Information Server account
-updatearchive , -up : Update any existing Package file
-datastage , -ds : DataStage Assets
Options for: -datastage
-includedependent , -incdep : Include dependent items
-nodesign , -nodes : Exclude design items
-includeexecutable , -incexec : Include executable items
-base , -base : Prefix for Paths

How to use dsexport/dsimport for EXPORT IMPORT Information Server Components

dsexport.exe /AF=authfile |
/D=domain /H=hostname [/U=username [/P=password]]
/JOB=jobname
/XML /EXT /EXEC /APPEND
project pathname1

How can I improve performance during an import into Datastage?

  • Exclude the executables from the export.
    In DataStage Designer export using the option export Jobs without executables.
  • Create an xml file instead of a dsx file.
    Executables are not included in xml files.
    (The xml option is available with dscmdexport but only with /JOB option)
  • Use the IS Manager or istool command.
You can use the istool command line interface (CLI) to export assets to an archive file. The default extension of the archivefile is .isx.
When using the istool command, if you do not use the parameter -incexe, it will not include executables.