Archive for February, 2014
Wednesday, February 26th, 2014
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 🙂
Tags: AJP, apache webserver, apache2, application, authentication, combination, conf, configured, DMZ, Engine, First Node, hp, httpd, ID, Jakarta Tomcat Application, JESSIONID, JSESSIONID, localhost, need, number, proof, proxy, request, Reverse Proxy, Reverse Proxy Load Balancer Apache, run, Second Node, server, session, working, xml
Posted in Linux, System Administration, Various | 2 Comments »
Tuesday, February 25th, 2014 Last Saturday me and my wife Svetlana together with a Christian friend family (Tsvetomir and Dimitrina with their < 2 years old boy – Boris) went to a small 1 day pilgrimage trip to Ruen Monastery – (Ruenski manastery). The holy cloister is situated very near Skrino village, the birth village of greatest Bulgarian saint – saint John of Rila. The village is located about 90 km from Sofia and is very near to town of Boboshevo. To reach Ruen Monastery when coming from Sofia, the traveller has to move in direction of "Kulata / (The Tower)" and to pass the village of Djerman and Usoika. Then before entering the village of Skrino there is a 5 km steep car road leading to the monastery.
Saint John of Rila lived in Skrino until his twenties and due to Christian tradition he accepted monkhood in the nearby monastery next to Skrino and a bit later started a hermit life dwelling himself in his first hermit cave situated near Skrino. The Cave of hermit dwelling of Saint John of Rila is now situated about 200 meters from Ruen Monastery and represents a tiny cave encraved in a rock. The rock is so small that maximum of 2 people can be in cave together. It is amazing how a man could live in such a small space.
Current Ruen monastery Church is recently rebuild in 1995 and the rest of monastic buildings are completed in y. 2002, but according to history it is known a monastery was existent on same place known in medieval times under name "The Holy Father" in XV century.
Veneration to Saint John of Rila was so high in mid centuries that obviously people recognized Saint John of Rila among the greatest saints.
The nature view near monastery is breath taking .. On the road to it there is Struma river the monastery itself is situated in Vlahina mountain from it there is a sightview of part of Rila mountain.
Near the monastery buildings there are two paths one leading to the Cave of Hermitage of Saint John of Rila and another one leading to a place with a Cross visible from throughout the region.
The monastery though being among the newest rebuilded ones in Bulgaria has already 3 saint holy relics, one of which is Holy relics from Saint George the Victorious. We had the blessings by God's grace to also meet RuenAbbot Father Ioan (John). We asked the father how many monks are inhabiting the monastery just to get the humorous answer that half of the inhabitants are present (meaning currently in the monastery there are only 2 monks). Fatehr John was evidently very young kindhearted person probably in his 30s. He was quite hospitable and invited us for tea and cookies in the small monastic dining room. We had quite a few spiritual talks and spoke on hardship of being a monk in nowadays confused world.
We were send with the Father's blessings and a gift – an icon of saint John of Rila and a book with the history of the monastery from ancient times to now – the book included also the Testament of Saint John of Rila
On our way back before entering Boboshevo we stopped to see and pray near an ancient Church from the 5th century consecrated under saint Theodor (Stratilat) – a Christian martyr saint from the 4th century who lived near Black Sea.
The Church is an unique Cultural monument as it contains wall patings probably dating back to at least 10th century or even earlier.
Thanks God the weather was quite warm for the Winter season leaving impression Spring has come 🙂
Tags: birth, blessings, breath, Bulgarian, cave, cloister, Current Ruen, day, direction, due, earth, Heaven, hermit life, history, Holy, holy relics, John of Rila, Last Saturday, relics, Rila, road, rock, Ruen Monastery, Ruen Monastery Ruenski, saint, Saint John of Rila, traveller, trip, village
Posted in Christianity, Everyday Life, Various | No Comments »
Monday, February 24th, 2014 I just learned about cool VIM option from a collegue:
:colorscheme evening
What it does it makes configurations in vim edit look brighter like you seen in below screenshots.
– Before :colorscheme evening vim command
– After :colorscheme evening
The option is really useful as often editing a config in vim on a random server is too dark and in order to read the config you have to strain your eyes in long term leading to eye damage.
Any other useful vim options, you use daily?
Tags: command, config, damage, editing, eye, look, option, order, read, server, tip, use, vim
Posted in Everyday Life, System Administration, Various | No Comments »
Tuesday, February 18th, 2014 Some time ago I blogged about how to make your sysadmin more enjoyable with figlet and toilet console ASCII art text generators
Besides toilet and figlet another cool entertainment proggie is cowsay. On my home Linux router I use cowsay together with a tiny shell script to generate me a random Cow Ascii Art fun picture each time I login to my Linux. cowrand is set to run for my user through ~/.bashrc.
In the spirit of ascii art fun arts today I've stumbled on another cool and uselesss few kilobytes program called "SL". SL is very simple all it does is it cheers up you by displaying a an animated train going through the screen once you type by mistake "sl" instead of ls (list command).
To enjoy it on debian based distributions install it with apt:
# apt-get install --yes sl
SL 's name is a playful joke itself as well it stands for Steam Locomotive.
To get some more ASCII art fun, try telnetting to towel.blinkenlights.nl – There is a synthesised ASCII Art text version video of Star Wars – Episode IV
# telnet towel.blinkenlights.nl
If you know other cool ASCII art animation scripts / ASCII art games or anything related to ASCII art for Linux / Windows, please drop me a comment.
Tags: animation, Ascii, bashrc, cheer, cool, Cow Ascii Art, figlet, fun, Linux, linux windows, run, scripts, simple, SL, toilet, train, version, video
Posted in Curious Facts, Entertainment, Everyday Life, Games Linux, System Administration | 1 Comment »
Monday, February 17th, 2014 I'm using Mozilla Thunderbird over the last 5 years in my life. Just now in my new job place in Hewlett Packard, in order to have well functional mail (with exchange server) – I started using Microsoft Outlook.
Logically a little while after I started my work I have to update my Outlook E-mail signature to reflect my contact details (job position title, email, stand-alone / mobile phone, office address etc.). As of moment of writting I'm using Microsoft Outlook 14.0.6123.5001 (32 bit) part of Microsoft Office Professional Plus 2010.
Its a kind of irony that I had to use Microsoft products after all these years trying my best to avoid using Microsoft technologies but heh, this is life … Though this article will be a bit trivial I decided to blog it because already I had to change email signature for a 3rd time over the last 3 months and every now and then after a month time I tend to forget how I did it last time.
Here is how I changed Email Signature in Outlook:
1. Click on "New-Email" (located below File menu)
2. Click on "Insert" (menu tab)
3. Click on "Signature"
4. Click on "New" button
As you see Outlook is written in very intelligent manner 🙂
It is possible to have more than one signature and change them every now and then (I guess that's made for Schizophrenic people who like changing their signature a couple of times a day accepting different personalities 🙂 🙂 🙂
For already existing signatures just edit the old one – click on Edit Signature
http://www.clarion.edu/273437/
Perform steps 1-4 in ('Create Signatures') except click "Rename button instead of 'New' and begin typing new name.
Perform steps 1-4 in ('Create Signatures') except click 'Delete" button instead of 'New'.
Highlight signature name you wish to modify under
-
"Select Signature to Edit" then modify signature.
-
Click "Save" button to save any signature changes made.
Tags: bit, Click, Click Save, contact, Delete Signatures, Edit Signature, email, hewlett packard, How to, last, last time, Microsoft Outlook, Modify Signatures, mozilla thunderbird, New, Rename, Rename Signatures, signatures, time, update, www
Posted in Everyday Life, Outlook, Various, Windows | No Comments »
Friday, February 14th, 2014 Lets say you're an admin involved in webhosting and due to a programmer's mistake, you end up with directory full with files with extension in upper cases but for actual version of website (all pictures are red only in lower cases), hence would like to transform these to lower cases.
To give an example, to illustrate what I mean, lets say you have in a directory files like;
filename.JPG, picture.PNG, new-picture.GIF
and you would like all files to be renamed to lower extension characters, i.e.:
filename.jpg, picture.png, new-picture.gif.
# find . -name '*.*' -exec sh -c 'a=$(echo {} | sed -r "s/([^.]*)\$/\L\1/"); [ "$a" != "{}" ] && mv "{}" "$a" ' \;
That's all enjoy 🙂
Tags: admin, directory, due, echo, end, JPG, Linux, Linux Rename, mistake, mv, picture, png, Rename
Posted in Linux, System Administration, Various | No Comments »
Thursday, February 13th, 2014
Many Linux servers these days are using LVM (Logical Volume Manager) in order to allow disk drives and partitions to be easily managed (shrinked / resized). It is interesting fact LVM is successor of HP-UX's volume manager. LVM can be considered as a thin software layer on top of the hard disks and partitions, which creates an abstraction of continuity and ease-of-use for managing hard drive replacement, re-partitioning, and backup.
LVM is commonly used for the following purposes:
- Managing large hard disk farms by allowing disks to be added and replaced without downtimes and services disruption (useful whenever hot-swapping is needed)
- On small systems (like a desktop at home), instead of having to estimate at installation time how big a partition might need to be in the future.
– LVM lets file systems to be easily resized later as needed. - Performing consistent backups by taking snapshots of the logical volumes.
- Creating single logical volumens of multiple physical volumes or entire hard disks (somewhat similar to RAID-0), ability to do dynamic volume resizing (in LVM partitions are volumes).
So if you're sysadmin it is quite likely that some LVM volume starts being filled up (because of bad initial planning), so the customer asks you to resize a LVM (volume), here is how to do it:
1. Check whether LVM configured on server has free disk space that can be relocated
First lets list all LVM configured volumes on server:
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "web_log" using metadata type lvm2
Found volume group "web_all" using metadata type lvm2
Found volume group "rootvg" using metadata type lvm2
vgscan – scan all disks for volume groups and rebuild caches
Then lets display the volume group information.
This is done with vgdisplay cmd
# vgdisplay
--- Volume group ---
VG Name rootvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 13
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 11
Open LV 11
Max PV 0
Cur PV 1
Act PV 1
VG Size 136.56 GB
PE Size 8.00 MB
Total PE 17480
Alloc PE / Size 7329 / 57.26 GB
Free PE / Size 10151 / 79.30 GB
VG UUID 27z2w0-Ku0H-y6M0-QFCR-3Rp6-c1HX-OTinzn
[root@lupus ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 3 0 wz–n- 695.44G 0
[root@lupus ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 VolGroup00 lvm2 a– 695.44G 0
Important line from above command output is (Free PE / Size 10151 / 79.30 GB). Indicating that server's LVM had 79.30 GB Free which can be used to extend any of the server LVM existing volumes.
Here are one of servers managed by me existing volumes:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-root
5.0G 301M 4.4G 7% /
udev 18G 144K 18G 1% /dev
tmpfs 42G 0 42G 0% /dev/shm
/dev/cciss/c0d0p1 122M 28M 88M 24% /boot
/dev/mapper/rootvg-home
512M 268M 219M 56% /home
/dev/mapper/rootvg-opt
2.5G 484M 1.9G 21% /opt
/dev/mapper/rootvg-Tivoli
3.0G 895M 2.0G 32% /opt/Tivoli
/dev/mapper/rootvg-uc4
3.0G 289M 2.6G 11% /opt/uc4
/dev/mapper/rootvg-sysadm
3.0G 69M 2.8G 3% /sysadm
/dev/mapper/rootvg-tmp
1.3G 35M 1.2G 3% /tmp
/dev/mapper/rootvg-usr
4.0G 1.2G 2.6G 32% /usr
/dev/mapper/rootvg-var
5.0G 500M 4.2G 11% /var
/dev/mapper/rootvg-webservices
9.9G 4.0G 5.9G 41% /webservices
For instance lets say the task is to extend LVM (volume) partition:
/dev/mapper/rootvg-webservices
9.9G 4.0G 5.9G 41% /webservices
Lets say we want to extend /dev/mapper/rootvg/rootvg-webserices with 20 Gygabytes:
# lvextend -L20G /dev/mapper/rootvg-webservices
Then we we would like to add some extra 10GB:
# lvextend -L10G /dev/mapper/rootvg-webservices
In order to add all available LVM free space to a volume use:
# lvextend -l +100%FREE /dev/mapper/rootvg-webservices
Whether you had to do it on Linux with kernel 2.4.x and ext2 / ext3 FS:
# umount /dev/mapper/rootvg-webservices
# resize2fs /dev/mapper/rootvg-webservices
# mount /dev/mapper/rootvg /webservices
To resize ext4 filesystem with LVM above umount / resize2fs and mount commands can be safely skipped.
On other file systems to raise the size of the filesystem there are different tools to use also on some umount and mount is not necessary example for dynamicly resizable filesystem is reiserfs (though I don't recommend this FS to anyone as the creator of ReiserFS killed his family – moreover my personal experience with ReiserFS in past was quite bitter – I lost personal data because of ReiserFS break ups).
Here is how to dynamicly resize FS after lvextend on Reiserfs filesystem:
# resize_reiserfs -f /dev/myvg/homevol
XFS also supports resize of filesystem with no need to re-mount on server with XFS LVM resize after lvextend run:
# xfs_growfs /webservices
Tags: check, disk space, Display, filesystem, Filesystem Size Used Avail Use Mounted, FS, hard disks, howto, information, kernel 2, linux?, Logical Volume Manager, LVM, mapper, metadata, Metadata Areas, mount dev, partition, partitions, resize, server, servers, top, type
Posted in Linux, System Administration | No Comments »
Wednesday, February 12th, 2014 I WORK FOR MONEY IF YOU WANT LOYALTY – HIRE A DOG!
I was told about those picture few months ago by a friend (Ivan Pushkaroff – Pushi) while we were drinking beer together in (Delfincheto – a pub more known among people under the name "Ribkata (The Fish)" – A Metal Music pub in Studentski Grad (Sofia's Student City). By the way if you're in Sofia and near "Studentski Grad" be sure to drop by there – they serve great and always fresh fish also for ex-metal heads for me it is always nice to get some memories about "the good old metal years"
when I tried to complain how difficult it is for me on my job place. I'm a quite sensitive person and a perfectionist and always try to do a great job. Often however there are many obstacles to do your job in right way (as you depend on so many bureaucracy and external people that even if you do your best someone else can mix it up and screw all your effort by not doing his part of the job. The failure of project or Task due to inadeaquacy of someone else involved to do his job right can leave you with a feeling that you have failed even though it is completely not your fault. As these days I'm quite stressed on my job and I have to work on a lot of badly designed projects (and improperly) assigned tasks – yes in big companies it is like these "the right hand doesn't know what the left one is doing". I remembered my dear friend advice to not take it seriously or personally and decided to put these funny picture in hope that these will help me and others to deal with situation of hardships in job in a humorous way After all I'm just a mercenary and I'm doing my best right now in my job at HP … I work for money if they expect higher degree of loyalty let them hire a dog 🙂
Tags: dear friend, drinking beer, effort, feeling, fish, hardships, job, left, lot, money, picture, place, right, screw, situation, someone
Posted in Curious Facts, Entertainment, Everyday Life | No Comments »
Wednesday, February 5th, 2014 Last Saturday evening I and my future wife Svetlana went to get train tickets (Sofia Dobrich), cause next week me and Svetlana will be travelling to Dobrich. Afterwards we went to Russian Church in center of Sofia – St. Nicolas for the evening service and confessed. The evening service was led by Archimandrite Philip who is currently Russian Church's prior.
At the end of Church service there was an oilment, as always being on a Russian Holy Liturgy is astonishing experience. On Sunday morning 2nd February we were in Russian Church again for the Russian Liturgy and we took the holy sacraments as it is proper (according to Orthodox Church tradition the marrying couple should confess and receive the sacraments before marrying in Church). After Church service we went to Church crypt to venerate holy relics of Archimandrate Seraphim Sobolev. A big thing is happening in my life nowdays as I will have marriage this week on Friday 7-th of February:)
We prepared so far almost everything for marriage. My parents helped with finding a marriage resturant and finding musicians for post marriage restaurant celebration. We also travelled to Asenovgrad to look for Svetlana's wedding dress and we got one I bough a marriage suit 2 weeks back and we ordered a marriage rings. There is already agreement with a priest father Vasilij – who will merry us in Church St. Trinity this Friday. Father Vasilij serves in Church "Dormition of Virgin Mary" in Kavarna . We choose father Vasilij to make the Marriage vows for the reason he is nativily Russian speaking (like Svetlana) plus the father is a good example of a true Christian priest. Today the parents of Svetlana (mama Vera and papa Alexander) arrived in the airport in Varna for the marriage (thanks God they had safe flight). Sunday night I send Svetlana to Train Station here in Sofia to make latest preparations for marriage. I will be travelling to Dobrich on Wednesday night 1 day before marriage. The rest of things happening around are not so interesting. In y job in HP work is complicated as usual. On my job I'm learning HPSM (HP Service Manager) and how to open new Changes in system and that's mostly my life these days. When I have time I'm playing OpenTyrian and a couple of nice arcade games on my ZTE Android mobile phone and reading some saint livings on mobile.
Tags: arcade games, Archimandrite Philip, Asenovgrad, bride dress, center, couple, Dormition, end, Evening, experience, February, future, games, last, last days, life, look, make, musicians, nowdays, Russian, russian church, Russian Holy Liturgy, sacraments, svetlana, thing, today, Wednesday, week
Posted in Christianity, Everyday Life, Various | No Comments »
Tuesday, February 4th, 2014 For my daily system administration job I have to login to many SuSE Linux servers and do various configugration edits.
The systems are configured in different ways and the only text editors available across all servers I can use are VI and VIM (VI Improved).
As I usually had to edit configuration files and scripts and I'm on SSH color terminal its rather annoying that on some of the servers opening a file with VIM is not displayed with SYNTAX HIGHLIGHTING. Not having syntax highlighting is ugly and makes editting ugly and unreadable.
Thus it is useful to enable VI syntax highlighting straight into the file being editted. I suspect many novice sysadmins might not know how to turn syntax highlighting in vi so here is how.
Turn Syntax Highlighting in VIM
1. Open file with vim lets say Apache configuration
# vim /etc/apache2/apache2.conf
2. Press (Esc) Escape and ":" from kbd and then type in syntax on
:syntax on
To Turn On / Off VI Syntax Highlighting permanent add ":syntax on"
into ~/.vimrc
~/.vimrc file is red automatically on VIM start, so right after :syntax on is appended in it on relaunch vim will start showing colorfully.
Enjoy ! 🙂
Tags: code, conf, configuration files, configured, editor, editting, file, howto, indent, Press Esc Escape, servers, syntax, sysadmins, system administration, text editors, turn, Turn Syntax Highlighting, vim, www
Posted in Everyday Life, System Administration, Various | 1 Comment »