Shashikant shah

Monday, 21 January 2013

PSI PROBE Configuration



PSI PROBE Configuration

It provides all of its features through a web-accessible interface that becomes available simply by deploying it to your server. These features include:

  • Requests: Monitor traffic in real-time, even on a per-application basis.
  • Sessions: Browse/search attributes, view last IP, expire, estimate size.
  • JSP: Browse, view source, compile.
  • Data Sources: View pool usage, execute queries.
  • Logs: View contents, download, change levels at runtime.
  • Threads: View execution stack, kill.
  • Connectors: Status, usage charts.
  • Cluster: Status, usage charts.
  • JVM: Memory usage charts, advise GC
  • Java Service Wrapper: Restart JVM.
  • System: CPU usage, memory usage, swap file usage.


# install psi probe

1.Download package :-

http://code.google.com/p/psi-probe/downloads/detail?name=probe-2.3.2.zip&can=2&q=

# unzip probe-2.3.2.zip

2.add some line:-

# cd /usr/tomcat-7/conf/

# vim tomcat-users.xml

<tomcat-users>
<role rolename=”manager”/>
<role rolename=”admin”/>
<role rolename=”role1”/>
<role rolename=”tomcat”/>
<user username=”both” password=”tomcat” roles=”tomcat,role1”/>
<user username=”tomcat” password=”tomcat” roles=”tomcat”/>
<user username=”admin” password=”admin” roles=”admin,manager”/>
<user username=”role1” password=”tomcat” roles=”role1”/>
</tomcat-users>
3.Start the tomcat :-

URL:- shashi.example.com:8080

4.Open the manager :-

http://shashi.example.com:8080/manager/html

give to user and passowrd

5.Upload probe.war using the "War file to deploy" option.
(/root/Desktop/probe.war)

6.Create setenv.sh file

# vim setenv.sh or setenv.bat

export JAVA_OPTS="-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.port=7009 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Djava.rmi.server.hostname=192.168.0.10"

# chmod 755 setenv.sh

/etc/init.d/tomcat stop

/etc/init.d/tomcat start


username :- admin
passwd :- admin
 

Saturday, 19 January 2013

Configuration of tomcat and java on CentOS-6

  Installation of JAVA. 


1.Install rpm.
# rpm -Uvh jdk-7-linux-x64.rpm

2.add at the last line.
# vi /etc/profile

export JAVA_HOME=/usr/java/default
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

                           OR

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

JAVA_HOME=/usr/java/jdk1.7.0
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export PATH
3.Update profile.
# source /etc/profile

4.Check java.
# javac - -version

INSTALL TOMCAT

1.Download links:-

wget http://ftp.riken.jp/net/apache/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.tar.gz

2.Untar apache-tomcat .

# tar zxvf apache-tomcat-7.0.16.tar.gz

3.move to apache-tomcar this location.

# mv apache-tomcat-7.0.16 /usr/tomcat-7

4.Create user for tomcat

# useradd -d /usr/tomcat tomcat

5.Give to owner ship /usr/tomcat

# chown -R tomcat. /usr/tomcat

6.Create Script for tomcat

# vim /etc/rc.d/init.d/tomcat

#!/bin/bash

# Tomcat7: Start/Stop Tomcat 7
#
# chkconfig: - 90 10
# description: Tomcat is a Java application Server.

. /etc/init.d/functions
. /etc/sysconfig/network

CATALINA_HOME=/usr/tomcat-7
TOMCAT_USER=tomcat
LOCKFILE=/var/lock/subsys/tomcat

RETVAL=0
start(){
   echo "Starting Tomcat: "
   su - $TOMCAT_USER -c "$CATALINA_HOME/bin/startup.sh"
   RETVAL=$?
   echo
   [ $RETVAL -eq 0 ] && touch $LOCKFILE
   return $RETVAL
}

stop(){
   echo "Shutting down Tomcat: "
   $CATALINA_HOME/bin/shutdown.sh
   RETVAL=$?
   echo
   [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
   return $RETVAL
}

case "$1" in
   start)
      start
      ;;
   stop)
      stop
      ;;
   restart)
      stop
      start
      ;;
   status)
      status tomcat
      ;;
   *)
      echo $"Usage: $0 {start|stop|restart|status}"
      exit 1
      ;;
esac
exit $?
# save

# chmod 755 /etc/rc.d/init.d/tomcat

# /etc/rc.d/init.d/tomcat start
(output)

Starting Tomcat:
Using CATALINA_BASE:/usr/tomcat
Using CATALINA_HOME:/usr/tomcat
Using CATALINA_TMPDIR:/usr/tomcat/temp
Using JRE_HOME:/usr/java/default
Using CLASSPATH:/usr/tomcat/bin/bootstrap.jar:/usr/tomcat/bin/tomcat-juli.jar

# chkconf - -add tomcat

# chkconf - - level 2345 tomcat on

# check tomcat

URL:- shashi.example.com:8080


@@@@ How to change port 8080 @@@@

# cd /usr/tomcat-7/conf/

# vim server.xml

find following similar statement

<!-- Define a non-SSL HTTP/1.1 Connector on port 8180 -->
 <Connector port="8080" maxHttpHeaderSize="8192"
          maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
          enableLookups="false" redirectPort="8443" acceptCount="100"
          connectionTimeout="20000" disableUploadTimeout="true" />       

                                    OR

    
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />

About Tomcat’s server.xml file cites it’s runs on port 8080. Change the Connector port=”8080″ port to any other port number.
Example:-

<Connector port="8181" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />

Above statement instruct Tomcat server runs on port 8181.

URL:-shashi.example.com:8181











You have to run two tomcat :-

# cd /usr/tomcat-1/conf
# vim server.xml
 change the port number and shutdown port number.

#cd /usr/local/tomcat-2/conf
change the port number and shutdown port number.