Posts Tagged ‘hp’

Preserve Session IDs of Tomcat cluster behind Apache reverse proxy / Sticky sessions with mod_proxy and Tomcat

Wednesday, February 26th, 2014

apache_and_tomcat_merged_logo_prevent_sticky_sessions
Having a combination of Apache webservice Reverse Proxy to redirect invisibly traffic to a number of Tomcat server positioned in a DMZ is a classic task in big companies Corporate world.
Hence if you work for company like IBM or HP sooner or later you will need to configure Apache Webserver cluster with few running Jakarta Tomcat Application servers behind. Scenario with necessity to access a java based application via Tomcat which requires logging (authentication) relaying on establishing and keeping a session ID is probably one of the most common ones and if you do it for first time you will probably end up with Session ID issues.  Session ID issues are hard to capture at first as on first glimpse application will seem to be working but users will have to re-login all the time even though the programmers might have coded for a session to expiry in 30 minutes or so.

… I mean not having configured Session ID prevention to Tomcats will cause random authentication session expiries and users using the Tomcat app will be unable to normally access below application with authenticated credentials. The solution to these is known under term "Sticky sessions"
To configure Sticky sessions you need to already have configured Apache/s with following minimum configuration:

  • enabled mod_proxy, proxy_balancer_module, proxy_http_module and or mod_proxy_ajp (in Apache config)

  LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_http_module modules/mod_proxy_http.so

  • And configured and tested Tomcats running an Application reachable via AJP protocol

Below example assumes there is Reverse Proxy Load Balancer Apache which has to forward all traffic to 2 tomcats. The config can easily be extended for as many as necessary by adding more BalancerMembers.

In Apache webserver (apache2.conf / httpd.conf) you need to have JSESSIONID configured. These JSESSIONID is going to be appended to each client request from Reverse Proxy to each of Tomcat servers with value opened once on authentication to first Tomcat node to each of the other ones.

<Proxy balancer://mycluster>
BalancerMember ajp://10.16.166.53:11010/ route=delivery1
BalancerMember ajp://10.16.166.66:11010/ route=delivery2
</Proxy>

ProxyRequests Off
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID
ProxyPassReverse / balancer://mycluster/

The two variables route=delivery1 and route=delivery2 are routed to hosts identificators that also has to be present in Tomcat server configurations
In Tomcat App server First Node (server.xml)

<Engine name="Catalina" defaultHost="localhost" jvmRoute="delivery1">

In Tomcat App server Second Node (server.xml)

<Engine name="Catalina" defaultHost="localhost" jvmRoute="delivery2">

Once Sticky Sessions are configured it is useful to be able to track they work fine this is possible through logging each of established JESSSIONIDs, to do so add in httpd.conf

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"\"%{JSESSIONID}C\"" combined

After modifications restart Apache and Tomcat to load new configs. In Apache access.log the proof should be the proof that sessions are preserved via JSESSIONID, there should be logs like:
 

127.0.0.1 - - [18/Sep/2013:10:02:02 +0800] "POST /examples/servlets/servlet/RequestParamExample HTTP/1.1" 200 662 "http://localhost/examples/servlets/servlet/RequestParamExample" "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130807 Firefox/17.0""B80557A1D9B48EC1D73CF8C7482B7D46.server2"

127.0.0.1 - - [18/Sep/2013:10:02:06 +0800] "GET /examples/servlets/servlet/RequestInfoExample HTTP/1.1" 200 693 "http://localhost/examples/servlets/" "Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130807 Firefox/17.0""B80557A1D9B48EC1D73CF8C7482B7D46.server2"

That should solve problems with mysterious session expiries 🙂

Bulgaria Top outsource destination – 5th in the World and 2nd in Europe in list of best countries to outsource business to

Thursday, December 19th, 2013

 

why outsource in bulgaria bulgaria 5th in world and second in europe in outsourcing1

I was stunned today to find out my countryland Bulgaria is 2nd in Europe and 5th in the world in terms of most attractive outsourcing destination according to BTA (Bulgarian News Agency).
Bulgaria is ordering 5th after, India, Indonesia, Estonia and Singapore. The ranking of most attractive destination is based on factors;

  • General Competitiveness of Labor cost Worldwide
  • Eligibility of Workhand
  • Multilingual English speaking population (mainly young people)
  • Expertised highly educated people
  • Very Low Taxes (if compared to "developed" European countries)
  • Decreased transportation costs (produc transportation to Europe is generally cheap)
  • Internet bandwidth speed and high bandwidth connectiveness to worldwide Trade Markets

All this opens a big opportunity for economy development and inflush of fresh-money from outsourced jobs. Due to higher and European standard level of education in Bulgaria, the workhand pool in Bulgaria is usually more knowledgeable and better in quality if compared to rest of 3rd world countries India, Indonesia, Sinagopore etc. Bulgaria has generally good infrastructure and offers easy transportation of people and resources, something not so well developed yet in lets say India or Indonesia. Therefore opportunities for further development in Bulgaria as a leading outsource center in Europe are immerse in the coming 10 years. So far big companies who already realized the great Bulgaria potential like Comverse, HP, IBM etc. started actively hire people in Bulgaria and outsource their businesses but this mainly happens in Sofia.

bulgaria top business destionation for outsourcing 5th in world and 2nd in europe for outsourcing

The trend in long run however is that European leading companies start outsource in smaller cities and towns as well. Right now most prepared personal ready for outsourcing in Bulgaria is in field of Information Technologies, Electronics, Marketing, Transportation Equipment, Business Management, Chemical Industry, Food & Bevarage and Logistics. General outsourcing trend is more and more people working in not high qualitified labor to enter the market of out-sourcing. There are plenty of companies already in Bulgaria involved in textile (clothes) industry offering their cheap and high quality workhand to large external multinational companies like Zara, H & M , Versace etc.

Currently Bulgaria is considered the poorest countries in the European Union with the shocking minimal wage of 310 leva about (155 EUR) and avarage monthly sallary of 812 leva (406 EUR) monthly. The cheapness of Bulgaria is still unidentified gold field ignored by many Western Multinational companies. Outsourcing in Bulgaria has great advantages for European Countries based companies in terms of product logistics as product transportation cost and taxation within the European Union are very cheap if compared to rest of top non-EU outsourcing countries. Due to оbviously advantegous conditions in Bulgaria there are plenty of companies in Bulgaria already specialised in auditing outsourcing business risks and planning steps a company could partake to outsource its business in BG. Current Bulgarian government is making further attempts to relieve country's conditions to attract new business investors by 'Simplifying country's business registration and operations administration requirements and fostering better business environment' as said recently by second minister of economics Krasin Dimitrov in recent business forum "Opportunities and Challanges in Business Process Outsourcing (BPO) and Shared Service Centers (SSC) in Bulgaria"

Convert Windows / MS-DOS end of line characters (CR/LF) to UNIX (LF) with sed

Tuesday, November 29th, 2011

I guess everyone has ended up with problems into a script files written under Windows using some text editor which incorrectly placed into the end of lines Windows (rn) end of lines instead of the UNIX (r).
Those who have have already take advantage of the nice tiny utility dos2unix which is capable of convert the Windows end of lines to UNIX. However some older UNIXes, like SunOS or HP-UX does not have the dos2unix utility into the list of packages one can install or even if its possible to install dos2unix it takes quite a hassle.
In that cases its good to say convertion of end of lines can be done without using external end programs by simply using UNIX sed .
The way to remove the incorrect Windows ^M (as seen in unix text editors) is by using the sed one liner:

server# sed 's/.$//' file-with-wrong-windows-eol.txt > file-with-fixed-unix-eol.txt