howto create GFS on DRBD network disk mirroring


This howto will cover how to create a DRBD disk set with GFS concurrent disk access setup.


DRBD disk mirroring benefit as a shared SAN disk to archive higher service resilience with low cost hardware component. Alternately, it may be configured for backup purpose with it’s flexibility.


1. RedHat Cluster Suit and GFS packages


2. drbd83 package

yum install drbd83

3. Create a partition on both node with using same size, we use [sda5] for this show case.
Continue reading “howto create GFS on DRBD network disk mirroring”

PHP sample: howto distinct the subarray value

The Code

$myvars = array(
"myvar1" => array("stock" => "C", "mykey" => "1", "name" => "apple"),
"myvar2" => array("stock" => "D", "mykey" => "1", "name" => "apple"),
"myvar3" => array("stock" => "E", "mykey" => "1", "name" => "apple"),
"myvar4" => array("stock" => "F", "mykey" => "1", "name" => "apple"),
"myvar5" => array("stock" => "G", "mykey" => "2", "name" => "orange"),
"myvar6" => array("stock" => "H", "mykey" => "2", "name" => "orange"),
"myvar7" => array("stock" => "I", "mykey" => "2", "name" => "orange"),
"myvar8" => array("stock" => "J", "mykey" => "2", "name" => "orange"),

$_myvars = array();
foreach($myvars as $myvar)
if ( !in_array($myvar['mykey'], $_myvars) )
echo $myvar['mykey'] . "\n" . $myvar['name'] . "\n";  
$_myvars[] = $myvar['mykey'];

The Result

1 apple 2 orange

Openldap recovery howto

If you are experiencing LDAP errors or startup without error but no ldap port (389|636) is listening for service and you have tried restarting the LDAP server by running /etc/init.d/ldap restart, then you should try running the following recovery procedure:

Typical corruption

1. Stop the LDAP server:

/etc/init.d/ldap stop

2. Run the daemon manually with debug flag

/usr/sbin/slapd -u ldap -h ldap:// -d 256

If the database is corrupted, it may stop at database initiation.
Continue reading “Openldap recovery howto”

Apache Web Load Balancing howto

Setup Overview

A apache load balancer setup for redirect incoming request to two underlying web server,


The apache load balancer instance running on RedHat Cluster floating IP or you can activate it on either one server using IP alias without using Cluster Suit.

Load balancer setup

Parameters Value Description
ProxyPass balancer://<NAME>/ Define your cluster name
stickysession BALANCEID | PHPSESSIONID | JSESSIONID Define your preferred session sticky method,
BALANCEID likely by source IP

PHP|JSESSIONID require to add extra session header on the node member web server

nofailover On | Off If your web servers do not support session replication, turn this flag on in order to NOT failovering the current session to other member while the node is failed.
route node name
lbmethod byrequests | bytraffic | bybusyness
ProxyPreserveHost On | Off While application using mod_rewrite for friendly URL and it rely on the REQUEST_URI , set this On to preserve the URL request header to

Continue reading “Apache Web Load Balancing howto”

howto reinstall GRUB in rescue mode while using lvm / mdadm

This article is how to activate LVM and mdadm software raid in rescue and reinstall GRUB boot loader, since the boot CD will not do this job for you. By following the steps, you may able to do system recovery or disk operation.

RedHat 5.x

Activate the RAID

mkdir /etc/mdadm
mdadm --examine --scan > /etc/mdadm/mdadm.conf
mdadm -A --scan

Continue reading “howto reinstall GRUB in rescue mode while using lvm / mdadm”

Enlarge linux software mirror raid 1 howto


A linux box running on a software raid 1 mirror harddisk (120GB), recently the server is running out of disk space. A new pair of harddisk with larger capacity (500GB) is going to replace the existing pair.

Current disk layout

100MB md0:/dev/sda1, /dev/sda2
111GB md1:/dev/sdb1, /dev/sdb2

/boot /dev/md0
VolGroup00 /dev/md1
– LogVol00 swap
– LogVol01 /

Synchronize the data to new harddisk

  1. Shutdown the box
  2. remove sdb from the box
  3. replace with the new 500GB disk

Continue reading “Enlarge linux software mirror raid 1 howto”