Thursday, September 12, 2013
Thursday, August 8, 2013
Weblogic Cluster constraints
It specifies that deployments targeted to a cluster succeed only if all servers in the cluster are running.
By default, cluster constraints are disabled and deployment is attempted only on the servers that are reachable at the time of deployment from the Administration Server. Any servers that have been shut down or are temporarily partitioned from the Administration Server will retrieve the deployment during server startup .
We can enable or disable from weblogic admin console.
Enabling Cluster Constrains
Click on Domain name -->select the "Enable Cluster Constraints" check box--> save the changes .
Disabling Cluster Constrains
Click on Domain name -->uncheck the "Enable Cluster Constraints" --> save the changes .
Cluster constrains can also set through application by adding below parameter to weblogic.xml file.
<session-descriptor>
<persistent-store-type>replicated_if_clustered</persistent-store-type>
</session-descriptor>
By default, cluster constraints are disabled and deployment is attempted only on the servers that are reachable at the time of deployment from the Administration Server. Any servers that have been shut down or are temporarily partitioned from the Administration Server will retrieve the deployment during server startup .
Enabling Cluster Constrains
Click on Domain name -->select the "Enable Cluster Constraints" check box--> save the changes .
Disabling Cluster Constrains
Click on Domain name -->uncheck the "Enable Cluster Constraints" --> save the changes .
Cluster constrains can also set through application by adding below parameter to weblogic.xml file.
<session-descriptor>
<persistent-store-type>replicated_if_clustered</persistent-store-type>
</session-descriptor>
Weblogic Datasources
There are 3 types of data sources in 10.3.5
- Generic data source
- Grid Link datasource
- Mutli datasource
Datasource: contains pool of database connections that are created when
datasource instance is created i.e.
A JDBC data source is an object bound to the JNDI tree that
provides database connectivity through a pool of JDBC connections. Applications
can look up a data source on the JNDI tree and then borrow a database
connection from a data source.
- When it is deployed or targeted
- Server start-up
Multi Datasource: Abstraction around data source to provide load balancing or
failover for datasource which are part of Multi Datasource
We can create the datasource as follows
- By Admin Console
- By WLST Script
- By Programmatically using JMX API (by Developer)
System v/s Application JDBC Module – JDBC Modules created by Administrator
using Console or WLST are called as System
JDBC module where as JDBC
module created by developer using WebLogic Workshop, other IDE (Integrated
Development Environment) or XML editor are called as Application JDBC Module.
<jdbc-system-resource>
<name>JDBC Data Source-test</name>
<target>weblogiccluster</target>
<descriptor-file-name>jdbc/JDBC_Data_Source-test-0556-jdbc.xml</descriptor-file-name>
</jdbc-system-resource>
Note:If we
create the data source related
xml file will be created in conf/jdbc folder .Xml file contains the all information like
connection pools,username, passwords and targets .... etc.
Grid Link datasource
A single GridLink data source provides connectivity between
WebLogic Server and an Oracle Database service targeted to an Oracle RAC
cluster. It uses the Oracle Notification Service (ONS) to adaptively respond to
state changes in an Oracle RAC instance
A GridLink data source includes the features of generic data
sources plus the following support for Oracle RAC:
- "Fast Connection
Failover"
- "Runtime Connection Load Balancing"
- "Graceful Handling for Oracle RAC Outages"
- "XA Affinity"
- "SCAN Addresses"
- "Secure Communication using Oracle Wallet."
Starting Weblogic managed server without node manager
We can
start Weblogic managed server instance using the startManagedWebLogic
Windows
: startManagedWebLogic.cmd
Solaris/Linex
: startManagedWebLogic.sh
Syntax
to start the managed server is "startManagedWebLogic.cmd server_name
admin_url"
server_name is the name of the Managed Server
admin_url is the url used to access the Administration Server for the domain.
server_name is the name of the Managed Server
admin_url is the url used to access the Administration Server for the domain.
startManagedWebLogic.cmd
command collects the managed server name and internally call the "startWebLogic.cmd"
to start the managed server.
startManagedWebLogic present in Domain home bin folder
%DOMAIN_HOME%\bin\
startManagedWebLogic.cmd
$DOMAIN_HOME/bin/startManagedWebLogic.shNote:
- If we do not mention boot.properties it will ask the Admin server username and password.
- If we mention the boot.properties script don't ask the Admin server username and password.
Disadvantage: Server will shut down if we press CTL + C , So we need to start the process as nohub.
Tuesday, August 6, 2013
Script to know the process id with KEY Name
PROCESS_NAME="Process_name"
PROCESS_ID=`ps -ef | grep -w $PROCESS_NAME | grep -v grep |
awk '{print $2}'`
echo $PROCESS_ID
if test "${PROCESS_ID}" != ""
then
echo "Process is already running"
else
echo "Process
is not running"
fi
Note: If multiple
processes are running with same KEY name, PROCESS_ID will contain the all
process ids.
Ex: 1243 34343 7384 9099 4334
This Script will be
useful in cronjob configuration to check any previous process is running before
start the new process.
We can configure the process name for cronjob process with –Dapp
Key
Ex: java –Dapp=Process_name
–jar /data/Weblogic/test.jar
Monday, August 5, 2013
Weblogic Start up arguments
Enabling gc logs to weblogic managed server
- -Xloggc:/data/Weblogic/logs/gc.log
Jsp Scriptlet to display the application server name in web page.
<%= System.getProperty("weblogic.Name") %>
Using this tag in jsp page we can get the Weblogic server
name in webpage .
Data source password change with out restart the web logic server
After we update system resources such as JDBC data sources,
JMS modules, and diagnostic modules, we can redeploy them.
To update an
application:
In the left pane of the Administration Console, select the
domain that contains the system resources we want to redeploy.
In the right pane, click Control.
Click System Resources.
Select the check box next to the name of the system
resources you want to redeploy.
Click Redeploy to redeploy the resources.
Click Yes to confirm our decision.
Thursday, August 1, 2013
Solaris Commands
- uname -a
- To know the server information like operating system,servername,osversion
- uptime
- show how long the system has been up
- last reboot
- Display the server reboot information including last reboot time
ls Commands
- ls (Display the list of file)
- ls |head (Display the first 10 files in the folder)
- ls | head -n (Display the first "n" number of files)
- ls |tail (Display the last 10 files in a folder)
- ls |tail -n (Display the last "n" numbers of files)
- ls -a (Display the hidden files and normal fiels.Hidden files begin with a ".", i.e. ".htaccess" files.
- ls -l|grep '^d' :To Display only Directories
- ls -l |wc -l To know the count of the files in a directory
- ls -lrt | grep -v "distribute*" | xargs zip logs_1.zip $*
- ls d -1 $PWD/* > /tmp/ans/temp.txt
- ls -f -1 $PWD/* > /tmp/ans/temp.txt
- ls -l test.sh |cut -f18 -d' ' : To know the time stamp of the current file
- sed '3d' fileName.txt (Remove the 3rd line)
- sed '7,9d' filename.txt (Remove the interval between lines 7 and 9)
grep Commands
- grep -n "1311179383812" file.txt (To find the line number of a word in file)
- grep -w -c \"text\" file name (To find the count of the word in file)
- jps -l (To Know the process id and arguments of java process)
Find Commands
- find . -type f -exec grep -l "string" {} +
- Find the file names which contains the string in current and sub folders.
- find . -name '*.jsp' -exec touch {} \;
- Find the jsp file names and update the time stamp of the jsp files.
- touch -t 200908201024 touch.txt
- To change the time stamp of the file to our choice
To know the cpu utilization in local zone
ZONEID NPROC SWAP RSS MEMORY TIME CPU ZONE
2 57 4160M 3857M 1.5% 10:06:52 0.3% tst-server
Change file or Directory ownership
chown (change ownership command change the ownership of the file or directory)
chown user2 temp.txt : It changes the ownership of the temp.txt file to user2
chown -R java_user * :It changes the all files , directories and sub directories ownership to java_user
- netstat -an |grep -i "LISTEN"
- To know the list of listen ports in a machine
- netstat -a |grep 7001
- To know whether port 7001 is listen or not
- showrev -p
- To know the applied patched in solaris
- showrev -a | grep "126546-05"
Patch: IDR151577-01 Obsoletes: Requires: 126546-05 Incompatibles: 126546-06 Packages: SUNWbash
- wget Commad
Usage: wget http://ramaprasad434.blogspot.in/2013/07/solaris-commands.html
Making weblogic server as load balancing webserver
Making weblogic server as load balancing webserver
we can use the weblogic server as webserver by deploying a web application in weblogic server .
web application weblogic.xml and web.xml files should contains the below mentioned tags .
weblogic server details need to be mention in WebLogicCluster parameter
<init-param>
<param-name>WebLogicCluster</param-name>
<param-value>localhost:7003|localhost:7005</param-value>
</init-param>
For example if you have one standalone server and two servers in a cluster and Deployed the web application in standalone managed server .
If the request comes to stand alone server it will send the request to the clustered servers.
weblogic.servlet.proxy.HttpClusterServlet servlet class is responsible to serve the requests.
web.xml
------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>HttpClusterServlet</servlet-name>
<servlet-class>weblogic.servlet.proxy.HttpClusterServlet</servlet-class>
<init-param>
<param-name>WebLogicCluster</param-name>
<param-value>localhost:7003|localhost:7005</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>HttpClusterServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HttpClusterServlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HttpClusterServlet</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HttpClusterServlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>
weblogic.xml file
------------------
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
<weblogic-web-app>
<context-root>/</context-root>
</weblogic-web-app>
Cron Tab
Cron is a UNIX, Solaris
utility that allows tasks to be automatically run in the background at regular
intervals by the cron daemon. These tasks are often termed as cron jobs in
UNIX, Solaris. Crontab (CRON TABle) is a
file which contains the schedule of cron entries to be run and at specified
times.
1. Crontab Restrictions
You can execute crontab if
your name appears in the file /usr/lib/cron/cron.allow. If that file does not
exist, you can use crontab if your name does
not appear in the file /usr/lib/cron/cron.deny.
If only cron.deny exists and
is empty, all users can use crontab. If neither file exists, only the root user
can use crontab. The allow/deny files consist of one user name per line.
2. Crontab Commands
export EDITOR=vi ;To specify
a editor to open crontab file.
crontab -e Edit your crontab file, or create one if it
doesn’t already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your
crontab file. (This option is only available on a few systems.)
3. Crontab file
Crontab syntax:
A crontab file has five fields for specifying day, date and time followed by the command to be run at that interval.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
Example:
0 6 * * 1 cd
/data/test; ksh
test.sh
1>>/logs/Test.log
2>>/logs/TestError.log
Here cron job will run every Monday 6 AM
- Fist 0 indicates the min
- second "6" indicates the hour 6
- last "1" indicates the Moday
Here cron job will run every Monday 6 AM
- Test.log contians the normal SOP statements
- TestError.log Contains the error and stack statements
Weblogic Terminology
- Domain:
is a logically related group of WebLogic Server resources .A domain is an interrelated set
of WebLogic Server resources that are managed as a unit.
- Administration
Server: The server instance which
configures, manages, and monitors all other server instances and resources
in the domain. An Administration Server is a WebLogic Server instance that
maintains configuration data for a domain.
- Managed
Server: is a WebLogic Server instance
that runs deployed applications.
- When
a Managed Server starts up, it connects to the domain's Administration
Server to synchronize its configuration document with the document that
the Administration Server maintains.You can start a Managed Server even if
the Administration Server is not running. In
this case, the Managed Server uses a local copy of the domain’s
configuration files for its starting configuration and then periodically
attempts to connect with the Administration Server. When it does connect,
it synchronizes its configuration state with that of the
Administration Server.
- If a Managed Server cannot
connect to the Administration Server during start up, it can retrieve its
configuration by reading its locally cached configuration data from the
config directory.
- A
Managed Server that starts in this way is running in Managed Server
Independence (MSI) mode. By
default, MSI mode is enabled.
- All
Managed Servers in a cluster must reside in the same domain; you cannot
split a cluster over multiple domains.
- All Managed Servers in a domain
must run the same version of the WebLogic Server software. The
Administration Server may run either the same version as the Managed
Servers in the domain, or a later service pack.
- Each
Managed Server maintains a copy of the domain’s configuration files. This
copy is read-only and can be updated only as part of a change management
process.
- When the Administration Server
starts up, it saves a JAR file named config-booted.jar that contains the
configuration files. When you make changes to the configuration files, the
old files are saved in the configArchive directory under the domain directory,
in a JAR file with a sequentially-numbered name like config-1.jar.
- Configuration
changes that can take effect without a server restart are sometimes
referred to as dynamic
changes.
Ex: if you change a
Managed Server’s Listen Port value, the new port will not be used until the
next time you start the Managed Server. The updated value is stored in
config.xml, but the run time value is not affected.
- configuration
changes that require a server restart are sometimes referred to as non-dynamic changes
- We
can't start the server when it is in ADMIN mode, we can Resume the
server to start.
- We
can Shutdown the server which is in ADMIN Mode.
- The
Administration Console is a browser-based Web
application that allows you to configure and monitor your WebLogic Server
domain, server instances, and running applications and their associated
resources. You can also use the Administration Console to create new
server instances and clusters and tune application descriptors
Types of HTTP Session Replication
Types of HTTP Session Replication
There are five different
implementations of session persistence:
Memory (single-server, non-replicated): When you use memory-based storage, all session
information is stored in memory and is lost when you stop and restart WebLogic
Server.
File system persistence: Session information is stored in a file under the
PersistentStoreDir specified.
JDBC persistence: Session information is stored in a database table.
Cookie-based session persistence: Session information is stored in a cookie.
In-memory replication (across a cluster): Session data is copied from one server instance to
another into memory.
Thread Dump Taking Procedure
Taking Thread Dump:
1)
Syntax:
kill -3 <ProcessID>
The Output of the Thread
Dump will be generated in the Server STDOUT fie
2) Simplest option to take
Thread Dump is:
Login to AdminConsole—>Server
—> Monitoring —> Threads
3) Through WLST you need to
write the WLST script like “AdminThreadDump.py”
In this case you will see
the Thread Dumps on the Same Shell prompt….
Not need to look into the
Server STDOUT
connect('weblogic','weblogic','t3://localhost:7001')
cd ('Servers')
ls()
cd ('AdminServer')
ls()
threadDump()
cd('..')
cd('ManagedServerOne')
threadDump()
Now open a command Shell and
then run the “setWLSEnv.sh”
then run the WLST script
like:
java weblogic.WLST
AdminThreadDump.py
or
java weblogic.WLST
/opt/bea/MyScripts/AdminThreadDump.py
Creating jar file with Manifest file
Command to create the jar file by including the Manifest file.
jar cvfm ramprasad.jar Manifest.txt .
Note:Jar with in the jar will not work.
jar cvfm ramprasad.jar Manifest.txt .
Note:Jar with in the jar will not work.
SQL Queries
Not like qurery
select Colum1 from tablename where Colum1 = 'ramprasad' and Colum2 not like '%Prasad%'
Append two columns data
select (Colum1 ||':' ||Colum2 ) from TableName
Ex: Colum1 = Ram and Colum2 =prasad
Result:Ram:prasad
select SYSTIMESTAMP from dual
select row1 from Table1 where row1 NOT IN (select row1 Table2 where row2= 'Test');
Here row1 present in two tables(Table1 & Table2).Query will show the all the records in Table1 except the record present in Table2
select Colum1 from tablename where Colum1 = 'ramprasad' and Colum2 not like '%Prasad%'
select (Colum1 ||':' ||Colum2 ) from TableName
Ex: Colum1 = Ram and Colum2 =prasad
Result:Ram:prasad
- To Know the time stamp of the Oracle Database.
- To Know the time stamp of the Database.
select SYSTIMESTAMP from dual
- Query Which displays all the records expect the records in other table
select row1 from Table1 where row1 NOT IN (select row1 Table2 where row2= 'Test');
Here row1 present in two tables(Table1 & Table2).Query will show the all the records in Table1 except the record present in Table2
Different Types of Deployments in weblogic
Stage mode
The Administration Server copies the archive files from their source location to a location on each of the targeted Managed Servers that deploy the archive. For example, if you deploy a J2EE Application to three servers in a cluster, the Administration Server copies the application archive files to each of the three servers. Each server then deploys the J2EE Application using its local copy of the archive files.
Stage mode is the default mode when deploying to more than one WebLogic Server instance.
Nostage mode
The Administration Server does not copy the archive files from their source location. Instead, each targeted server must access the archive files from a single source directory for deployment. For example, if you deploy a J2EE Application to three servers in a cluster, each server must be able to access the same application archive files (from a shared or network-mounted directory) to deploy the application.
Nostage mode is the default mode when deploying only to the Administration Server (for example, in a single-server domain). You can also select nostage mode if you run a cluster of server instances on the same machine.
External_stage mode
External_stage mode is similar to stage mode, in that the deployment files must reside locally to each targeted server. However, the Administration Server does not automatically copy the deployment files to targeted servers in external_stage mode; instead, you must manually copy the files, or use a third-party application to copy the files for you.
Weblogic supports following type of deployment unit
a) EAR file (Enterprise Archive)
b) WAR file (Web Archive)
c) JAR files, EJB (Enterprise Java Beans)
d) RAR (Resource Adapter/Connector )
e) Web Services (WAR/JAR)
f) J2EE Library
g) CAR (Client Application Archive)
Tools used to deploy/configure applications
1) weblogic.Deployer – command line interface
2) Administration Console – Web based interface
3) WLST(WebLogic Scripting Tool) – command line tool to automate deployment configuration and operation
4) Tool for developers (wldeploy, weblogic.PlanGenerator, API, autodeploy)
Refer the links
➤ How to deploy applications with wldeploy
The Administration Server copies the archive files from their source location to a location on each of the targeted Managed Servers that deploy the archive. For example, if you deploy a J2EE Application to three servers in a cluster, the Administration Server copies the application archive files to each of the three servers. Each server then deploys the J2EE Application using its local copy of the archive files.
Stage mode is the default mode when deploying to more than one WebLogic Server instance.
Nostage mode
The Administration Server does not copy the archive files from their source location. Instead, each targeted server must access the archive files from a single source directory for deployment. For example, if you deploy a J2EE Application to three servers in a cluster, each server must be able to access the same application archive files (from a shared or network-mounted directory) to deploy the application.
Nostage mode is the default mode when deploying only to the Administration Server (for example, in a single-server domain). You can also select nostage mode if you run a cluster of server instances on the same machine.
External_stage mode
External_stage mode is similar to stage mode, in that the deployment files must reside locally to each targeted server. However, the Administration Server does not automatically copy the deployment files to targeted servers in external_stage mode; instead, you must manually copy the files, or use a third-party application to copy the files for you.
Weblogic supports following type of deployment unit
a) EAR file (Enterprise Archive)
b) WAR file (Web Archive)
c) JAR files, EJB (Enterprise Java Beans)
d) RAR (Resource Adapter/Connector )
e) Web Services (WAR/JAR)
f) J2EE Library
g) CAR (Client Application Archive)
Tools used to deploy/configure applications
1) weblogic.Deployer – command line interface
2) Administration Console – Web based interface
3) WLST(WebLogic Scripting Tool) – command line tool to automate deployment configuration and operation
4) Tool for developers (wldeploy, weblogic.PlanGenerator, API, autodeploy)
Refer the links
➤ How to deploy applications with wldeploy
Mailx Command
Mailx Command to send the files from solaris box
For Single file
Ex:uuencode Diff.text Diff.text |mailx -s " Difference" ramprasad@gmail.com
For multiple Files :
( uuencode Diff.txt Diff.txt ; uuencode Diff.txt Diff.txt ) | mailx -s " Difference" ramaprasad@gmail.com
Use -r option to add the sender mail id for mailx command.
echo "Send from example" | mailx -s "Send from example subject" -r "from@example.com" ramprasad@gmail.com
Use -r option to add the sender mail id for mailx command.
echo "Send from example" | mailx -s "Send from example subject" -r "from@example.com" ramprasad@gmail.com
Subscribe to:
Posts (Atom)