Sunday, June 24, 2012

Installation & Configuration of "High Availability Cluster (Heartbeat)" In RHEL 6

Installation & Configuration of "High Availability Cluster (Heartbeat)" on RHEL 6
Node names are, station1 & station2
Give below command to set the host name on both Linux machines.
“hostname station1”
IP Address of “station1” is 192.168.1.1
“hostname station2”
IP Address is “station2” is 192.168.1.2
Edit “/etc/sysconfig/network” file & change the HOSTNAME to “station1 & station2”
Note:
- “uname -a” command should return “station1” & “station2” names respectively after rebooting both
machines.
- No need to mention VIP (Virtual IP) anywhere in Linux Network & Host configuration. Heartbeat will
manage the VIP during “fail over” process in between “station1 & station2”
Now, We are going to install “hearbeat”.
Step:1
yum install heartbeat
Total download size: 420 k
Installing:
heartbeat
i686
Installing for dependencies:
heartbeat-libs
i686
3.0.4-1.el6
3.0.4-1.el6
epel
epel
Show dependencies
Installing : heartbeat-3.0.4-1.el6.i686
Installing : heartbeat-libs-3.0.4-1.el6.i686
Installing : heartbeat-devel-3.0.4-1.el6.i686
Step:2
Install below RPM's if you find "dependency problem".
cluster-glue-libs-1.0.5-2.el6.i686.rpm
cluster-glue-1.0.5-2.el6.i686.rpm
resource-agents-3.9.2-7.el6.i686.rpm
Visit : http://www.linux-ha.org/wiki/Downloads to download necessary packages.
Step:3
161 k
260 k
Copy “hearbeat configuration” files from below location.
cp /usr/share/doc/heartbeat-3.0.4/authkeys /etc/ha.d/
cp /usr/share/doc/heartbeat-3.0.4/ha.cf /etc/ha.d/
cp /usr/share/doc/heartbeat-3.0.4/haresources /etc/ha.d/
Step:4
Now, We need to modify “/etc/ha.d/” directory files as given below. It is better to “comment” all existing
lines prior to apply below configuration on both servers.
1) In “ha.cf”, write below contents;
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
bcast eth0
Udpport 694
auto_failback on
node station1
node station2
#Your log file generator path#
#Keep alive the connection for 2 seconds#
#Heartbeat will consider local node dead after 30 seconds#
#Maximum seconds to wait for dead signal of dead node#
#Broadcast the message about the dead node from this interface# Change your
interface accordingly.
#Broadcast UDP Port#
#The Dead node will take the charge again#
#node1#
#node2#
2) In “haresources”, write below contents;
station1 192.168.1.4 httpd
#Must be same on both nodes#
3) In “authkeys”, write below contents;
auth 2
2 sha1 test-ha
Step:5
We will use “Apache” HTTPD Service to test our configuration.
Open “/etc/httpd/conf/httpd.conf” file & modify below line.
Listen 192.168.1.4:80
#192.168.1.4 is a VIP & Apache will listen port 80#
Save & Exit
Step:6
Finally, Start “heartbeat” service on “station1”, then on “station2”. No need to start HTTPD Service as
“Heartbeat” is responsible to bring it up.
/etc/init.d/heartbeat start
Step:7
Create sample “index” file on Apache “DocumentRoot” as per your need.
In your browser, type “192.168.1.4” ip address,which will give you “station1” index file.
Here, “station1” is a primary node, so heartbeat will show it's index page only.
Now, stop “heartbeat” on “station1”. After few seconds, type “192.168.1.4” ip address again, which will
show you index page of “station2”.
Step:8
Enable “heartbeat” service during startup. No need to enable “httpd” on both nodes.
chkconfig heartbeat on
chkconfig httpd off
You will find “heartbeat logs” in “/var/log/ha-log” file.


Check This Diagram..

http://www.4shared.com/photo/jPawdOoQ/Screenshot_from_2012-06-24_125.html


Thursday, June 14, 2012

Linux FileSystems Ext2 vs Ext3 vs Ext4

Linux File Systems: Ext2 vs Ext3 vs Ext4


ext2, ext3 and ext4 are all filesystems created for Linux. This article explains the following:
  • High level difference between these filesystems.
  • How to create these filesystems.
  • How to convert from one filesystem type to another.
Ext2
  • Ext2 stands for second extended file system.
  • It was introduced in 1993. Developed by Rémy Card.
  • This was developed to overcome the limitation of the original ext file system.
  • Ext2 does not have journaling feature.
  • On flash drives, usb drives, ext2 is recommended, as it doesn’t need to do the over head of journaling.
  • Maximum individual file size can be from 16 GB to 2 TB
  • Overall ext2 file system size can be from 2 TB to 32 TB
Ext3
  • Ext3 stands for third extended file system.
  • It was introduced in 2001. Developed by Stephen Tweedie.
  • Starting from Linux Kernel 2.4.15 ext3 was available.
  • The main benefit of ext3 is that it allows journaling.
  • Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling.
  • Maximum individual file size can be from 16 GB to 2 TB
  • Overall ext3 file system size can be from 2 TB to 32 TB
  • There are three types of journaling available in ext3 file system.
    • Journal – Metadata and content are saved in the journal.
    • Ordered – Only metadata is saved in the journal. Metadata are journaled only after writing the content to disk. This is the default.
    • Writeback – Only metadata is saved in the journal. Metadata might be journaled either before or after the content is written to the disk.
  • You can convert a ext2 file system to ext3 file system directly (without backup/restore).
Ext4
  • Ext4 stands for fourth extended file system.
  • It was introduced in 2008.
  • Starting from Linux Kernel 2.6.19 ext4 was available.
  • Supports huge individual file size and overall file system size.
  • Maximum individual file size can be from 16 GB to 16 TB
  • Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
  • Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)
  • You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).
  • Several other new features are introduced in ext4: multiblock allocation, delayed allocation, journal checksum. fast fsck, etc. All you need to know is that these new features have improved the performance and reliability of the filesystem when compared to ext3.
  • In ext4, you also have the option of turning the journaling feature “off”.

Warning: Don’t execute any of the commands given below, if you don’t know what you are doing. You will lose your data!

Creating an ext2, or ext3, or ext4 filesystem

Once you’ve partitioned your hard disk using fdisk command, use mke2fs to create either ext2, ext3, or ext4 file system.

Create an ext2 file system:
mke2fs /dev/sda1

Create an ext3 file system:
mkfs.ext3 /dev/sda1
(or)
mke2fs –j /dev/sda1

Create an ext4 file system:
mkfs.ext4 /dev/sda1
(or)
mke2fs -t ext4 /dev/sda1

Converting ext2 to ext3

For example, if you are upgrading /dev/sda2 that is mounted as /home, from ext2 to ext3, do the following.
umount /dev/sda2
tune2fs -j /dev/sda2
mount /dev/sda2 /home

Note: You really don’t need to umount and mount it, as ext2 to ext3 conversion can happen on a live file system. But, I feel better doing the conversion offline.

Converting ext3 to ext4

If you are upgrading /dev/sda2 that is mounted as /home, from ext3 to ext4, do the following.
umount /dev/sda2
tune2fs -O extents,uninit_bg,dir_index /dev/sda2
e2fsck -pf /dev/sda2
mount /dev/sda2 /home

Again, try all of the above commands only on a test system, where you can afford to lose all your data.


What is Journaling?



Journaling is only used when writing to a disk and it acts as a sort of punch clock for all writes. This fixes the problem of disk corruption when things are written to the hard drive and then the computer crashes or power is lost. Without a journal the operating system would have no way to know if the file was completely written to disk.
With a journal the file is first written to the journal, punch-in, and then the journal writes the file to disk when ready. Once it has successfully written to the disk, it is removed from the journal, punch-out, and the operation is complete. If power is lost while being written to disk the file system can check the journal for all operations that have not yet been completed and remember where it left off.
The biggest downside to journaling is that it sacrifices some performance in exchange for stability. There is more overhead to write a file to disk but file systems get around this overhead by not writing the full file to the journal. Instead only the file metadata, inode, or disk location is recorded before actually being written to disk.

Done..

Friday, June 8, 2012

Defragment File according the file types In Microsoft windows.

The built-in disk defragmenter in Windows can’t selectively defragment individual files or folders. To do that, a cool utility named Contig is available for free from Microsoft Sysinternals team. It can defragment specified files and folders, a bunch of file types and thereby optimize disk space.
Download it from here.
Using it is simple, specify the path which contains specific files that need to be defragmented. For example, to defragment all the files in the folder named “music”, type :
contig -s d:\music\*.*
Using contig to defragment files in a specific folder
The -s parameter instructs contig to perform recursive processing of all the subdirectories present in the given path.
Once the defragmentation process is over, a summary is displayed regarding the same.
Summary of results once Contig is run
To defragment files of only a specific extension say .avi in a folder named videos, type :
contig -s d:\videos\*.avi
The above will only look for files with .avi extension and defragment them. Nice and effective.
A very useful tool that saves time and defragments particular files.
Cheers.

How To start The GUI In RHEL 6

Start The Runlevel 5 for RHEL 6/CentOS 6 Server.

Few people might have faced an issue of starting GUI on runlevel 5 on
RHEL 6/CentOS 6. When They Forgot Install or Select Desktop Installation. In case
After The installation we can start the GUI on Our RHEL Machine by Following These simple steps..

1). Install Desktop & Xorg Packages on system using following comamnd.

# yum groupinstall "Desktop" "Desktop Platform" "X Window System"

2). Add followig line in /etc/inittab file to start the X11/GUI for
switching to runlevel 5.

exec /etc/X11/prefdm -nodaemon

Done!