UpComings…

June 10th, 2009

XML-RPC protocol set up:

a. Client-side setup

b.  Server-side setup

c. Auto Reply over filters in Gmail

Extremely  sorry guys  for not posting since long time..lots of pending posts..Right now I have very tight schedule. Will come back soon.

XML-RPC Protocol set-Up using java : System + Software requirements

June 10th, 2009

System requirement:

1. Window XP, Vista, 2007/ Any Linux

2. firewall control access on server as well as on client, i.e. You need admin access.

Software requirements:

1. Check whether you have Java on your both nodes, server as well as on client. Get the most updated one if you don’t have java, though any version above 1.4 is fine.To download plz visit : http://java.com/en/download/index.jsp

2. Download XML-RPC  :http://www.apache.org/dyn/closer.cgi/ws/xmlrpc/
Download only these files:
a. apache-xmlrpc-current-bin.tar.gz

b. apache-xmlrpc-current-src.tar.gz

3. Just unzip them i.e. for linux run “gunzip apache-xmlrpc-current-bin.tar.gz” and “gunzip apache-xmlrpc-current-src.tar.gz” in konsole/Terminal. If you are Windows user, then plz use archive manager for the same.

4. Go to $XML-RPC_HOME/apache-xmlrpc-$VERSION/lib
NOTE: $XML-RPC_HOME is the directory where you have put apache-xmlrpc files. Here $VERSION tells the version of xml-rpc code.  $VERSION apache-xmlrpc-3+ is suggested.

5. See if you have following:
a. commons-codec-X.jar i.e. commons-codec-1.3.jar

b. commons-httpclient-X.jar i.e. commons-httpclient-3.0.jar

c. commons-logging-X.jar i.e. commons-logging-1.1.jar

d. wc-commons-util-X.jar i.e. wc-commons-util-1.0.2.jar

e. xmlrpc-client-X.jar i.e. xmlrpc-client-3.1.2.jar

f. xmlrpc-common-X.jar i.e. xmlrpc-common-3.1.2.jar

g. xmlrpc-server-X.jar i.e. xmlrpc-server-3.1.2.jar

6. If you see any of them is missing then go to http://www.findjar.com/jar/

7. Search for the missing jar and download it and put back into the “$XML-RPC_HOME/apache-xmlrpc-$VERSION/lib” directory.

Now our software requirement is fulfilled.

Mysql Master Database Replication

May 26th, 2009

1. T ake dump of the master DB to whom you want to replicate . Plz note that if you are using mysqldump command then It should be like “mysqldump -u$USER -p$PASSWORD $DATABASENAME  –master-data>$FILETOSTORETHEDUMP” .DONOT FORGET TO INCLUDE “–master-data” otherwise replication won’t happen.

2.Transfer the dump file to the the slave server and give permission to the mysql to access this file.

3. Comment all the crontab job or all existing tasks which is using mysql on slave.

4. Open konsole on slave

5. mysql -u$USER -p$PASSWORD (open mysql on slave)

6. stop slave; (run this command into mysql  prompt)

7. Open the my.cnf file on slave(usually location is: /etc/my.cnf)

8. add the required DB /DB-tables (e.g. replicate-wild-do-table=$DATABASENAME.%)

9. Change/Add the Master-credentials

like : master-host=Master-IP-Address
master-user=$MASTER_MYSQL_USER_ID
master-password=$MASTER_MYSQL_PASSWORD

10. go to the Mysql Prompt on Slave again

11. start slave;

12. show slave status\G;(check what is the master-IP showing. It should be the old one)

13. reset slave;

14. again open new terminal on slave.

15. /etc/init.d/mysql restart

16. Go to again mysql prompt.

17. Drop the database which you want to replacate here but aleardy exists.

18. Create database $DATABASENAME;

19. stop slave;

19. source the dump file now using source command

20. start slave; (now your replication should work )

21. come out of mysql prompt and enable all the commented and stop jobs which depend over  mysql on slave node.

Njoy the replication now :)

Thunderbird with Lighting 0.9 on ubuntu Bug Fix

May 25th, 2009

If you have install Thunderbird Lightning Extension version 0.9 and can’t create new calendar, events or tasks, all buttons are disabled. That means this add-On extension been broken with Thunderbird.
Problem observed mostly with ubuntu Hardy(8.04) version.

Steps to get it done:
The fix for this bug is to install libstdc++5:
1. sudo aptitude install libstdc++5
2. Download lighting0.9 from https://addons.mozilla.org/en-US/thunderbird/downloads/latest/2313/platform:2/addon-2313-latest.xpi
3. Install the same using Tools->add-Ons in Thunderbird.
4. Restart the Thunderbird
Then Lightening should work fine with Thunderbird.

Instruction for MySql 5.x to MySql 5.y Upgrade On REHL

May 25th, 2009

Though following instructions are given for REHL4 but It should work for any REHL-version . Just you need to check compatible REHL-packages

1.   first login with your credentials on the machine, on which you intend to perform Mysql upgrade.

Then type  the following command:
$ su
(If you don’t have super user credentials, please contact administration).

2. Get  Newer version of MySql  packages  to your home:
http://dev.mysql.com/downloads/  e.g MySQL5.1.
# ll -h /$MYSQL_HOME/MySQL5.y
e.g.
-rw-r–r–  1 user root 7.0M Feb  5 04:04 MySQL-client-community-5.y.rhel4.i386.rpm

-rw-r–r–  1 user root 7.7M Feb  5 04:04 MySQL-devel-community-5.y.rhel4.i386.rpm

-rw-r–r–  1 user root  18M Feb  5 04:04 MySQL-server-community-5.y.rhel4.i386.rpm

-rw-r–r–  1 user root 1.7M Feb  5 04:04 MySQL-shared-community-5.y.rhel4.i386.rpm

-rw-r–r–  1 user root 5.0M Feb  5 04:04 MySQL-shared-compat-5.1.30-0.rhel4.i386.rpm

-rw-r–r–  1 user root  12M Feb  5 04:04 MySQL-test-community-5.1.30-0.rhel4.i386.rpm

(Verify if they are correct)

Note: Currently I am taking simple example to upgrade Mysql 5.0.x to 5.1.x. You just focus on type of abover mentioned six files. They should be there.

3. Ensure that all services attached to your mysql are not active for the given machine.

4. Ensure that the port on which the service is running is blocked by firewall.

5. # rpm -qa | grep -i mysql
MySQL-server-standard-5.x.rhel4

MySQL-client-standard-5.x.rhel4

MySQL-shared-compat-5.x.rhel4

MySQL-devel-standard-5.x.rhel4

mysql-connector-odbc-3.51.14-0 (Please neglect the java connector driver)

(Following are the MySql 5.x packages. We must uninstall all of the above packages  except  java connector driver)

6. Shutdown MySql instances running:

#/etc/init.d/mysql stop

(do a ps -ef | grep mysql to check if  instances are running on other(non default) port.  If they are shut them down ).

Also, DONOT do a “kill -9 <mysql-pid>“  to stop any of the instance.

7. Remove packages :

(DONOT remove  mysql-connector)

#rpm -e –nodeps MySQL-devel-standard-5.x.rhel4

#rpm -e –nodeps MySQL-shared-compat-5.x.rhel4

#rpm -e –nodeps MySQL-client-standard-5.x.rhel4

#rpm -e –nodeps MySQL-server-standard-5.x.rhel4

8. Install new mysql packages:

#cd /root/MySQL5.y

#rpm -ivh  MySQL-client-community-5.y.rhel4.i386.rpm
#rpm -ivh MySQL-server-community-5.y.rhel4.i386.rpm
#rpm -ivh MySQL-shared-compat-5.y.rhel4.i386.rpm
#rpm -ivh MySQL-devel-community-5.y.rhel4.i386.rpm

Generally,  no problem is encountered while package addition.
However, at a times, readline package incompatibility might make package installation to fail.

Run the following command:

# rpm -qa | grep -i readline
e.g.
readline-4.3-11.99_2.el4.at

readline-devel-4.3-11.99_2.el4.at

Ensure that you have correct version of readline package installed.

9.  login to mysql prompt :

1. #mysql -u#USER -p#PASSWORD

then type following command (If you have any replication on)

mysql>  check slave status \G
Ideally, you must  NOT SEE any error in the list.
Also, verify that  replication is running by checking if “Relay_Log_Pos: ” value is changing, each time  you hit the command “mysql>check slave status \G”

10.  Start services which were shutdown.

11. Unblock the port, if applicable.
Verify if  the system is stable, if the service is has started serving requests.

12. Enable  all the services which run over mysql .

Easy way to file transfer over network

May 25th, 2009

When you have to transfer a large amount of data from one computer to another use two basic tools that are on most linux machines ( works on windows with cygwin ) tar and netcat (nc). You don’t need any samba, http, ftp, rsync…
Here it goes:
On the receiving end:
$ nc -l -p 1234 | tar -x

This will make a tcp server listening on port 1234 and pass any received data to tar

On the sending end:
$ tar -c FolderToTransfer | nc receivershost 1234

This will create tar file on the fly and pass it to the server.

To enable compression use( only for slow networks, since it consumes a lot of CPU ): tar -xz and tar -cz

Swap-space & File-Based Swap Space Vs Partitioned-Based Swap Space

May 25th, 2009

a. Swap space is not required to have twice the size of RAM.
Recommendation for RHEL 5 :
Swap space == Equal RAM size (if RAM <= 8GB)
Swap space == 0.50 times the size of RAM (if RAM > 8GB)

b. File based swap-space is as good as partitioned-based swap-space.
depending upon process we can add and reduce swap space using File based swap space but in case of partitioned based swap space if you need to adjust swap space then you have to format whole disk.

c. Creating the swap file on a journaled file system (e.g. ext3 ) NOT AT ALL incur a significant performance hit.
The kernel generates a map of swap offset -> disk blocks at swapon time and from then on uses that map to perform swap I/O directly against the underlying disk queue, bypassing all caching, metadata and filesystem code.

d. How to add/remove Swap file/space:
Please follow the instruction on :http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/custom-guide/s1-swap-adding.html

Mysql Update Statement Bug

May 25th, 2009

As we know the correct mysql update statement is like: update table_name set X=x, Y=y,…;

but suppose someone by mistake puts “and” operator instead of “,”  i.e:
update table_name set  X=x and Y=y; => X and Y get initialized with their previously assigned/default values(seems quite random assignments)  not with their current assigned values in the query.

Surprisingly mysql doesn’t throw error in such case.

NFS setup Minimal requirements for REHL

May 25th, 2009

Concern: Usually you find that only port 111 which is of portmapper to allocate dynamic ports to services required for NFS, and port 2049 which is of NFS are required. But if firewall is on then it consistently blocks the all dynamic port opened by portmapper, hence you need to bind static port with nfs services which is done in step 2 of server side setting and then make entries for them in iptables.

Note the step 2 of server side setting is different for FC and ubuntu.

Setting on server side:
1./etc/exports:

FODLR_TO_SHARE NFS_Client_IP_Address(rw,fsid=0,sync)
2./etc/sysconfig/nfs:

MOUNTD_PORT=892
STATD_PORT=662
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769

3./etc/sysconfig/iptables:
[0:0] -A INPUT -p udp -m udp –dport 111 -j ACCEPT
[0:0] -A INPUT -p udp -m udp –dport 2049 -j ACCEPT
[0:0] -A INPUT -p tcp -m tcp –dport 111 -j ACCEPT
[0:0] -A INPUT -p tcp -m tcp –dport 2049 -j ACCEPT
[0:0] -A INPUT -p tcp -m tcp –dport 662 -j ACCEPT
[0:0] -A INPUT -p udp -m udp –dport 662 -j ACCEPT
[0:0] -A INPUT -p tcp -m tcp –dport 892 -j ACCEPT
[0:0] -A INPUT -p udp -m udp –dport 892 -j ACCEPT
[0:0] -A INPUT -p tcp -m tcp –dport 32803 -j ACCEPT
[0:0] -A INPUT -p udp -m udp –dport 32803 -j ACCEPT
[0:0] -A INPUT -p tcp -m tcp –dport 32769 -j ACCEPT
[0:0] -A INPUT -p udp -m udp –dport 32769 -j ACCEPT

4. /etc/init.d/iptables restart
5. /etc/init.d/nfs restart
6. /etc/init.d/nfslock restart

Setting on client side:

  1. mkdir MOUNT_FOLDR
  2. service portmap restart
  3. service nfs restart
  4. mount -t nfs NFS_Server_IP_Address:FOLDR_TO_SHARE(server side)  MOUNT_FOLDR

And it works.

Wireless on ubuntu8.04

May 25th, 2009

Hardy Version of ubuntu has big problem with wireless drivers. Here the steps to make wireless working on your system:-
Open your konsole/terminal
1. echo ‘blacklist bcm43xx’ | sudo tee -a /etc/modprobe.d/blacklist
sudo apt-get install ndiswrapper-utils-1.9
mkdir ~/bcm43xx
cd ~/bcm43xx

check your Broadcom wireless version using command: lspci -n | grep ‘14e4:43′

2.  go to  here https://help.ubuntu.com/community/WifiDocs/Driver/bcm43xx/Feisty_No-Fluff#Step%202:%20Download%20and%20Extract%20Drivers

depending upon  your wireless version you need to pick step 2.

comeback here after having done with step 2

3. sudo ndiswrapper -i bcmwl5.inf
ndiswrapper -l
sudo depmod -a
sudo modprobe ndiswrapper
sudo cp /etc/network/interfaces /etc/network/interfaces.orig
echo -e ‘auto lo\niface lo inet loopback\n’ | sudo tee /etc/network/interfaces
sudo ndiswrapper -m
echo ‘ndiswrapper’ | sudo tee -a /etc/modules
echo ‘ENABLED=0′ | sudo tee -a /etc/default/wpasupplicant

4. sudo aptitude remove b43-fwcutter
5. sudo gedit /etc/init.d/wirelessfix.sh
6. Paste the followings in the opened file(wirelessfix.sh)and make sure you save it before continuing Step 7
#!/bin/bash
modprobe -r b44
modprobe -r b43
modprobe -r b43legacy
modprobe -r ssb
modprobe -r ndiswrapper
modprobe ndiswrapper
modprobe b44

7. cd /etc/init.d/ && sudo chmod 755 wirelessfix.sh
8. sudo update-rc.d wirelessfix.sh defaults
9. Restart your machine

You are done.