Tuesday, December 27, 2011

Install Apache mod_proxy_balancer

Install Apache mod_proxy_balancer

#cd /u01/source
#tar xvzf httpd-2.2.21.tar.gz
#cd httpd-2.2.21
#./configure --prefix=/u01/apache --enable-so

#make
#make install

cd httpd-2.2.21/modules/metadata
#/u01/apache/bin/apxs -a -i -c mod_headers.c

cd httpd-2.2.21/modules/proxy
#/u01/apache/bin/apxs -a -i -c mod_proxy.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_ajp.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_balancer.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_connect.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_http.c

if error when start apache, solve with running below
#/u01/apache/bin/apxs -a -i -c mod_proxy.c proxy_util.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_ajp.c proxy_util.c ajp_utils.c ajp_header.c ajp_msg.c ajp_link.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_balancer.c proxy_util.c


#cd /u01/apache/conf
#echo "Include conf/proxy-pass.conf" >> httpd.conf

#vi proxy-pass.conf

Header add Set-Cookie "ROUTEID=%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

BalancerMember http://localhost:6001 route=node1
BalancerMember http://localhost:6002 route=node2
ProxySet stickysession=ROUTEID


ProxyPass /context balancer://cluster/context
ProxyPassReverse /context balancer://cluster2/context

--start apache
#/u01/apache/bin/apachectl start

--stop apache
#/u01/apache/bin/apachectl stop

Wednesday, October 19, 2011

Apache as Load Balancer for Weblogic Server

1. gzip -d httpd*.tar.gz
2. tar -xvf httpd*.tar
3. ./configure --prefix=/u01/apache --enable-module=so --enable-rule=SHARED_CORE
4. make
5. make install
6. copy mod_wl.so to $apache_home/modules
7. vi $apache_home/conf/httpd.conf

8. add line to httpd.conf
-------
LoadModule weblogic_module modules/mod_wl.so
-------
Include conf/weblogic.conf
9. create file weblogic.conf


SetHandler weblogic-handler
weblogicCluster 192.168.10.1:7002,192.168.10.2:7002


10. start httpd
$apache_home/bin/apachectl start
11. check apache running
ps -ef | grep httpd

Wednesday, August 24, 2011

Search largest directory or file size

Here is command to seach largest directory size or file size in linux

Go to directory that want to search, here i try with root directory

[root@localhost /]# pwd
/

Run below command to sarch as tree

du -a | sort -nr | head -10



[root@localhost /]# du -a | sort -nr | head
4895036 .
2534040 ./u01
2491840 ./u01/app
2491824 ./u01/app/Middleware
1974680 ./usr
1178384 ./usr/share
944184 ./u01/app/Middleware/wls1033_generic.jar
691292 ./u01/app/Middleware/wlserver_10.3
663968 ./u01/app/Middleware/wlserver_10.3/server
481796 ./u01/app/Middleware/wlserver_10.3/server/lib


Run below command to search parent directory only

du -sm * | sort -nr | head

[root@localhost /]# du -sm * | sort -nr | head

2475 u01
1929 usr
129 lib
109 etc
58 var
37 sbin
21 lib64
9 bin
7 boot
6 root



Sunday, July 3, 2011

Make local yum repository

- run mount command to mount repo file :
ex: mount -t iso9660 -o loop /dev/hdc /u02
- go to yum repo directory
cd /etc/yum.repos.d
- make file local.repo in this directory
insert below script in local.repo
[localrepo]
name=My local repo
baseurl=file:///u02/Server
enabled=1
gpgcheck=0
#gpgkey=file:///path/to/you/RPM-GPG-KEY
- run df -h to check the repo file already mounted

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 3.8G 1.8G 1.9G 50% /
tmpfs 494M 0 494M 0% /dev/shm
/dev/hdc 2.9G 2.9G 0 100% /u02



Saturday, January 1, 2011

Extend swap space on linux

Actually, yes. You can supplement your swap partition with a swap file. It goes something like this:

First, create a large empty file:
Code:
sudo dd if=/dev/zero of=/swap_file bs=1M count=1000
Replace 1000 with the size of the swap file desired, in MB. You can also put the swap_file in a different location if desired.


Next, we'll secure the swapspace, so ordinary users cannot read the contents (potential security breach):
Code:
sudo chown root:root /swap_file
sudo chmod 600 /swap_file
Then, turn it into swap space:

Code:
sudo mkswap /swap_file
Next, turn it on:
Code:
sudo swapon /swap_file

To make it turn on at every bootup, open up /etc/fstab:
Code:
sudo gedit /etc/fstab
Add this line to the end of the file:
Code:
/swap_file none swap sw 0 0
__________________