In the past, we have been using mod_jk as the connector to front apache http server for tomcat, it does load balance and fail-over nicely. Now apache has modules such as proxy_ajp_module and proxy_balancer_module that would serve the same purpose, but with simpler configuration. Below is the VirtualHost config in apache httpd:
NameVirtualHost *:8080
<VirtualHost *:8080>
<Location /balancer-manager>
SetHandler balancer-manager
</Location>
<Proxy balancer://ajpCluster>
BalancerMember ajp://localhost:8109 route=jvm1
BalancerMember ajp://localhost:8209 route=jvm2
</Proxy>
ProxyPass /balancer-manager !
ProxyPass / balancer://ajpCluster/ stickysession=JSESSIONID nofailover=On
</VirtualHost>
On the tomcat end there are a few things needs to be changed in server.xml:
Uncomment the section where it defines the AJP connector and change the port number:
<!– Define an AJP 1.3 Connector on port 8009 –->
<Connector port=”8109″ enableLookups=”false” redirectPort=”18443″ protocol=”AJP/1.3″ />
This part I totally forgot which took me a while to realize that I did not define the jvmRoute name in tomcat. This would be appended to the JSESSIONID cookie so it knows which tomcat to route to:
<Engine name=”Catalina” defaultHost=”localhost” jvmRoute=”jvm1">
Now when you hit http://hostname:8080/ it hits the apache httpd server and it would route you to the least loaded tomcat that is up running.
http://hostname:8080/balancer-manager
would show you the status of the load balancer and tomcat servers.
I have tested this worked well with JIRA.
Thursday, February 28, 2008
Tuesday, February 26, 2008
revert back to an old revision in subversion
Someone restructured the code and directories then committed into the repository, but it was discovered what has been done is on the wrong track. Now we want to revert back to a revision before all these bad changes. The changes were between revisions 2737 - 2738, we wanted to go back to revision 2736 to start over, issue the command:
svn merge -rHEAD:2736 .
Now we can start over from revision 2736, commit it into the repository as revision 2739, the missing files and directories would be copies from revision 2736.
svn merge -rHEAD:2736 .
Now we can start over from revision 2736, commit it into the repository as revision 2739, the missing files and directories would be copies from revision 2736.
Friday, February 15, 2008
sort process on linux by memory/cpu usage
sort by memory usage:
ps -eo pid,ppid,rss,vsize,pcpu,pmem,cmd -ww –sort=pmem
sorty by cpu usage:
ps -eo pid,ppid,rss,vsize,pcpu,pmem,cmd -ww –sort=pcpu
ps -eo pid,ppid,rss,vsize,pcpu,pmem,cmd -ww –sort=pmem
sorty by cpu usage:
ps -eo pid,ppid,rss,vsize,pcpu,pmem,cmd -ww –sort=pcpu
Thursday, February 14, 2008
response headers that prevents browser to cache JSP
// Set to expire far in the past.response.setHeader(”Expires”, “Tue, 23 May 1995 12:00:00 GMT”);
// Set standard HTTP/1.1 no-cache headers.response.setHeader(”Cache-Control”, “no-store, no-cache, must-revalidate”);
// Set IE extended HTTP/1.1 no-cache headersresponse.addHeader(”Cache-Control”, “post-check=0, pre-check=0″);
// Set standard HTTP/1.0 no-cache header.response.setHeader(”Pragma”, “no-cache”);
// Set standard HTTP/1.1 no-cache headers.response.setHeader(”Cache-Control”, “no-store, no-cache, must-revalidate”);
// Set IE extended HTTP/1.1 no-cache headersresponse.addHeader(”Cache-Control”, “post-check=0, pre-check=0″);
// Set standard HTTP/1.0 no-cache header.response.setHeader(”Pragma”, “no-cache”);
Friday, January 25, 2008
JNDI names of TransactionManager in J2EE application servers
java:comp/env/UserTransaction - Generic
java:comp/UserTransaction - Resin 2.x, Oracle OC4J (Orion), JOnAS (JOTM), BEA WebLogic
java:comp/TransactionManager - Resin 3.x, Geronimo
java:/TransactionManager - JBoss
jta/usertransaction - WebSphere (J2EE 1.2)
java:comp/UserTransaction - WebSphere (J2EE 1.3)
java:comp/UserTransaction - Resin 2.x, Oracle OC4J (Orion), JOnAS (JOTM), BEA WebLogic
java:comp/TransactionManager - Resin 3.x, Geronimo
java:/TransactionManager - JBoss
jta/usertransaction - WebSphere (J2EE 1.2)
java:comp/UserTransaction - WebSphere (J2EE 1.3)
Friday, January 18, 2008
nvidia cuda environment on fedora core
All files required can be downloaded from:http://www.nvidia.com/object/cuda_get.html#linux
You are ready to CUDA!
- change to boot into text mode before installing NVidia drivervi /etc/inittabchange: id:5:initdefault:to: id:3:initdefault:reboot (to text mode)
- install NVidia driver provided from the cuda download pagesh NVIDIA-Linux-version.-pkg1.run
- add the following into Section “Screen” of /etc/X11/xorg.confOption “SLI” “off”Option “ProbeAllGpus” “True”
- add the red part into /boot/grub/grub.confuppermem 524288kernel /vmlinuz-2.xxxxxxxx ……….. rhgb quiet vmalloc=256MBpci=nommconf
- install cuda package
- change to boot back to GUI modevi /etc/inittabchange: id:3:initdefault:to: id:5:initdefault:reboot (back to X GUI mode)
- install freegult package, it is required for cuda SDK samples:rpm -ivh freeglut-version.rpmrpm -ivh freeglut-devel-version.rpm
- add /usr/local/cuda/lib into /etc/ld.so.conf/sbin/ldconfig
- install CUDA SDK
- please make sure your SELinux setting is disabled:System -> Administration -> Security Level and Firewall -> SELinux -> SELinux Setting: Disabled
- add /usr/local/cuda/bin to your path
You are ready to CUDA!
Wednesday, January 16, 2008
remove unwanted revisions in subversion
In one of those days, people committed stuff should not be in a source code repository into the subversion repository by accident, or sometimes not being disciplined and lack of understanding in source code repository…
There’s no easy button to remove the unwanted revisions in subversion. The svndumpfilter that came with subversion distribution is the tool that is able to exclude or include revisions with filename/dirname, unfortunately if there are “copies” in revisions that refers to the stuff that you wanted to filter out, svndumpfilter would break without finishing filtering the rest of revisions.
This problem can be avoided by writing a script to utilize svndumpfilter, svnlook and etc., copy path/files that has dependcies on other revisions. There are already scripts such as svndumpfilter2 and svndumpfilter3 out there. svndumpfilter2 is a python script that eliminates the copy dependencies revisions that you wanted to filter out. You can download svndumpfilter2 from: http://tartarus.org/~simon-anonsvn/viewcvs.cgi/svn-tools/svndumpfilter2
Assuming the directories that you want to keep are trunk, branches tags:
$SVN_HOME/bin/svnadmin dump /path/to/repo ./svndumpfilter2 /path/to/repo trunk branches tags > clean.dump
$SVN_HOME/bin/svnadmin load /path/to/repo < clean.dump
Your repo is now clean without those revisions taking up your HDD space.
There’s no easy button to remove the unwanted revisions in subversion. The svndumpfilter that came with subversion distribution is the tool that is able to exclude or include revisions with filename/dirname, unfortunately if there are “copies” in revisions that refers to the stuff that you wanted to filter out, svndumpfilter would break without finishing filtering the rest of revisions.
This problem can be avoided by writing a script to utilize svndumpfilter, svnlook and etc., copy path/files that has dependcies on other revisions. There are already scripts such as svndumpfilter2 and svndumpfilter3 out there. svndumpfilter2 is a python script that eliminates the copy dependencies revisions that you wanted to filter out. You can download svndumpfilter2 from: http://tartarus.org/~simon-anonsvn/viewcvs.cgi/svn-tools/svndumpfilter2
Assuming the directories that you want to keep are trunk, branches tags:
$SVN_HOME/bin/svnadmin dump /path/to/repo ./svndumpfilter2 /path/to/repo trunk branches tags > clean.dump
$SVN_HOME/bin/svnadmin load /path/to/repo < clean.dump
Your repo is now clean without those revisions taking up your HDD space.
Subscribe to:
Posts (Atom)