Category Archives: Linux

Single Docker wordpress Image with Apache, Php and mysql on Ubuntu platform for hosting CMS solution/blog

This is  single Docker image incorporated with Apache, Mysql, PHP and wordpress to host CMS sites or wordpress ( Not used Linked container to make it more complicated.)

However this images is not yet listed on docker.io with star but you can use the following command to search

[root@satya wordpress]# docker search docker.io/009satya/wordpress

And use the following command

[root@satya wordpress]# docker pull docker.io/009satya/wordpress

 

To download on local system. Once download you can check it with

 

[root@satya wordpress]# docker image

 

Subsequently using the following commands you can run it permanently on any Linux platform.

 

[root@satya wordpress]# docker run –name wordpressdaemonV2 –restart=always -d -p 8086:8086 <IMAGEID> /bin/sh -c “while true; do echo WORDPRESS DAEMON; sleep 1; done”

 

For future use , you can use the following command to access exisiting container i.e wordpressdaemonV2

 

[root@satya wordpress]# docker exec –it wordpressdaemonV2 /bin/bash

 

For more information, Please visit – https://hub.docker.com/r/009satya/wordpress/

 

Note – Not able to link GITHUB with DOCKER HUB hence provided Dockerfile on above link.

Advertisements

Setting up KVM On CentOS7/RHEL7.0

Raw Steps –

 

1- Checkcing if system does support Intel VT and AMD-V for Virtualization Support.

This is hardware accelerated virtualization platform to support multiple unmodified OS version to run simultaneously on x86 platform without any issue.

Checking the following parameter on system to ensure if we do have the following features avaiable for virtualization

vmx — Intel VT-x, virtualization support enabled in BIOS.
svm — AMD SVM,virtualization enabled in BIOS.
lm – Can run 64-bit machines.
aes – Applications performing encryption and decryption using the Advanced Encryption Standard on Intel and AMD cpus.
[root@ip-172-31-14-165 ~]# egrep –color -i “vmx|svm” /proc/cpuinfo

2- Installing KVM package

[root@ip-172-31-14-165 ~]# yum -y install kvm virt-manager libvirt virt-install qemu-kvm xauth

 

3- Networking –

(i) Enabling IP forwarding for ethernet.
[root@ip-172-31-14-165 ~]# echo -e “net.ipv4.ip_forward = 1\n” >> /etc/sysctl.d/99-sysctl.conf
[root@ip-172-31-14-165 ~]# sysctl -p /etc/sysctl.d/99-sysctl.conf
net.ipv4.ip_forward = 1
[root@ip-172-31-14-165 ~]#

(ii) Creating virbr0 interface

Commenting out IPADDR, NETMASK, GATEWAY & added BRIDGE element as below. you can have multiple nics, can create bond for redundency purpose. I have chosen single nic as I dont have infrastrcture available with me

[root@ip-172-31-14-165 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=”eth0″
ONBOOT=”yes”
#IPADDR=”172.31.14.165″
#NETMASK=”255.255.255.0″
#GATEWAY=”172.31.14.161″
BRIDGE=virbr0
[root@ip-172-31-14-165 ~]#
(iii) Creating BRIDGE INTERFACE virbr0 to enabling communciation of guest VMs to Hypervhost KVM. it would be NAT communicatation

[root@ip-172-31-14-165 ~]# cat /etc/sysconfig/network-scripts/ifcfg-virbr0
DEVICE=”virbr0″
TYPE=BRIDGE
ONBOOT=yes
BOOTPROTO=static
IPADDR=”172.31.14.165″
NETMASK=”255.255.255.0″
GATEWAY=”172.31.14.161″
4- check if kernal has loaded KVM module
[root@ip-172-31-14-165 ~]# lsmod | grep -i kvm
[root@ip-172-31-14-165 ~]# modprobe kvm
[root@ip-172-31-14-165 ~]# lsmod | grep -i kvm
kvm                   461126  0
[root@ip-172-31-14-165 ~]#

5- You can use the following command to check if bridge interface is enabled.

[root@ip-172-31-14-165 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
[root@ip-172-31-14-165 ~]#
6- checking the KVM virtual list –

1- You might get the following issue. Enable libvirtd services and rest would be ok.

[root@ip-172-31-14-165 yum.repos.d]# virsh -c qemu:///system list
error: failed to connect to the hypervisor
error: Failed to connect socket to ‘/var/run/libvirt/libvirt-sock’: No such file or directory
[root@ip-172-31-14-165 yum.repos.d]# systemctl enable libvirtd
[root@ip-172-31-14-165 yum.repos.d]# systemctl start libvirtd
[root@ip-172-31-14-165 yum.repos.d]# virsh -c qemu:///system list
Id    Name                           State
—————————————————-

[root@ip-172-31-14-165 yum.repos.d]#

7 – checking what OS variant is supported on KVM. if this command does not work by any reason,you could use ‘osinfo-query os’ and it provides the list of template KVM support to host as virtual machine
[root@ip-172-31-14-165 ~]#virt-install –os-variant=list
[root@ip-172-31-7-80 ~]# osinfo-query os

Short ID             | Name                                               | Version  | ID
———————-+—————————————————-+———-+—————————————–
altlinux1.0          | Mandrake RE Spring 2001                            | 1.0      | http://altlinux.org/altlinux/1.0
altlinux2.0          | ALT Linux 2.0                                      | 2.0      | http://altlinux.org/altlinux/2.0

 

————————————————————————————-
8- Creating Virtual Machine –

[root@ip-172-31-7-80 ~]# virt-install –connect qemu:///system -n satyawin8 -r 2048 –vcpus=2 –disk path=/var/lib/libvirt/images/vmwin8.img,size=20 –graphics vnc,listen=0.0.0.0 –noautoconsole –os-type windows –os-variant win8 –accelerate –network=bridge:virbr0 –hvm –cdrom /var/X19-12345.iso
Starting install…
Allocating ‘vmwin.img’ | 20 GB 00:00:00
Creating domain… | 0 B 00:00:00

Domain installation still in progress. Waiting for installation to complete.

 

 

OVIRT is comming soon 🙂

Linux – RHEL unattended installation step by step with PXE boot

***Prerequisite***
########################################

  • DHCPD install & running
  • TFTP install & running
  • HTTPD install & running ( Though NFS & FTP will also work but I prefer HTTPD over these)

NoteI am not covering how to install DHCPD/TFTP(xinet.d) & HTTPD installation.

#######################################

***Configuration***

The following is DHCPD.CONF file based on the requirement.

  • I will use 192.168.10.0/24 subnet assigned to auto-kickstart deployment on multiple server.
  • DHCPD/TFTPD/HTTPD are placed on same system in order to better sync
  • next-server is TFTP IP address while in ourcase this is same as DHCP/HTTPD
  • Though you can also configure one by one by mapping hw address of machine where you want to deploy like

#host esxi5first {
#        hardware ethernet 00:0C:29:90:B1:B2;
#        fixed-address 192.168.10.221;
#        option host-name “esxifirst”;
#        filename “pxelinux.0”;
#        next-server 192.168.10.200;
#}

but in this case you need to remove the following lines for subnet section ( i. e subnet 192.168.10.0 netmask 255.255.255.0 {)

filename “pxelinux.0”;
next-server 192.168.10.200;
#########################################################
DHCPD.CONF
#########################################################
[root@rhel1 pxelinux.cfg]# cat /etc/dhcp/dhcpd.conf
ddns-update-style ad-hoc;
allow booting;
allow bootp;
#gPXE options
option space gpxe;
option gpxe-encap-opts code 175 = encapsulate gpxe;
option gpxe.bus-id code 177 = string;
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.220 192.168.10.254;
default-lease-time 3600;
max-lease-time 4800;
option routers 192.168.10.200;
option domain-name-servers 192.168.10.200;
option subnet-mask 255.255.255.0;
option ntp-servers 192.168.10.200;
filename “pxelinux.0”;
next-server 192.168.10.200;

}
[root@rhel1 pxelinux.cfg]#
##############################################################
TFTPD SETUP

  •  Create /tftpboot directory & create folder images/rhel6
  •  Copy menu.c32 & pxelinux.0 from /usr/local/syslinux to /tftpboot
  • Copy initrd.img & vmlinuz from mounted RHEL DVD images directory to /tftp/images/rhel6
  • Create a directory named ‘pxelinux.cfg’

##############################################################
[root@rhel1 pxelinux.cfg]# tree -AF /tftpboot/

/tftpboot/

├── images/

│   └── rhel6/

│       ├── initrd.img

│       └── vmlinuz

├── menu.c32

├── pxelinux.0

└── pxelinux.cfg/

└── default
#################################################
Default file content under /tftpboot/pxelinux.cfg/default

  • Create a file named ‘default’ with the following content ks=http://192.168.10.200/rh.cfg is web server ( httpd address) where kickstart file (rh.cfg) is kept.
  • This kickstart file also read the content (RPM) of RHEL DVD in order to install the same. Syntax is configured on rh.cfg file as url –url http://192.168.10.200/rhel

######################################################
[root@rhel1 html]# cat /tftpboot/pxelinux.cfg/default
default menu.c322
prompt 0
timeout 300
MENU TITLE ******* PXE BOOT MENU ********
LABEL RHEL6.0 x64
MENU LABEL RHEL6.0 x64
KERNEL images/rhel6/vmlinuz
append vga=normal initrd=images/rhel6/initrd.img ramdisk_size=1024 ksdevice=eth1 ks=http://192.168.10.200/rh.cfg
#####################################################
Kickstart file rh.cfg
You can modified as per your requirement, you can add %post section, modified %package as well.This is unattended installation
####################################################
# This is an installation not an upgrade
install
url –url http://192.168.10.200/rhel
lang en_US
autostep –autoscreenshot
text
keyboard us
#xconfig –defaultdesktop kde –resolution 640×480 –depth 8
network –device eth0 –bootproto dhcp –onboot=on
rootpw –iscrypted $1$tihTg7ne$hohhkj87hGGddg9B4WkXV1
authconfig –useshadow –enablemd5
selinux –disabled
timezone America/New_York
firewall –disabled
firstboot –disable
# Reboot after installation
reboot
bootloader
reboot
clearpart –all –initlabel
# define partitions
part /boot –fstype ext3 –size=512
part /opt –fstype ext3 –size=5000 –grow
part /usr –fstype ext3 –size=5000
part /tmp –fstype ext3 –size=7500
part /var –fstype ext3 –size=7500
part /home –fstype ext3 –size=2500
part swap –size=2048
part / –fstype ext3 –size=2048
part /usr/local –fstype ext3 –size=1000
########################################################

To rule out NFS Client hanged state on NFS Server and Client Architecture Setup

Abstracts –   We are in process of setting up NFS Server & Client architecture in order to provide high availability to websites running on Web Cluster. We have identical servers placed on cluster with identical data individually installed on each and every server so that if any node on the cluster goes down, there should be minimal downtime for the sites.

We have guest column features enabled on website in order to provide  services to guest to write contents for the website. The biggest challenge was to share disk so that the content can be fully available to shared location NOT on individual server’s disk in order to read and write simultaneously.

To overcome this situation we came through NFS sharing so that shared resource can be shared among all the cluster nodes and if somehow the NFS servers goes down the content posted on shared disk will not shown but rest of sites will work fine. However there could be few minutes downtime but that is better than running sites on standalone server which can cause downtime of more than 8 hours.

After implementation we observes that during NFS servers goes down we are getting hanged status of NFS client not serving the purpose we owned NFS for our architecture. The load got increase on NFS client and error occurred STALE NFS client due to modification time mismatched on NFS server and client. Website stop working.

During observation we thought if we can write any daemon which enquire per second basis NFS server from NFS client, if NFS service is listening on the port specified on NFS server.

If this does not get any reply it will simply umount the NFS shared disk on NFS client so that only NFS part get impacted and rest of the sites run fine without any load causing issue on server.

Architectural Setup

Apache-cluster

Let me explain the steps by step here for NFS Server and client architecture

1 – Since we don’t have NFS storage so we have configure Apache Server 1 as a NFS server and Apache Server 2 for NFS Client

2 –  We have exported a separate partition on Apache Server 1 and shared the same on Apache Server 2.

3 – We have configured the following script as a daemon on Apache Server 2 (NFS client) to check if NFS server is still alive if this does not find the NFS server alive. It makes NFS client to umount the shared folder on Apache server 2 by escaping NFS client goes to hanged state/Load increase and makes rest of content served from individual disk installed on client.

4 – Script is here

#!/bin/bash

NC=`which nc`

IPADDRESS=”x.x.x.x”

NFSPORT=2049

if [ `$NC -z  $IPADDRESS $NFSPORT | grep nfs | wc -l` = 0 ]

then

echo “$IPADDRESS server is reboot/shutdown or nfs service interrupt/stopped”

/bin/umount -f /nfsdata

fi

RCA on High CPU Utilization in Linux Box

High CPU utilization is the most common phenomenon in servers whether it is Dev or Stage or even in Production. Most of the time support & development guys break their heads to know what actually cause this high CPU utilization. They usually play the blame games and ball jumps from one’s court to other. All happens due to lack of clarity on how to read the CPU utilization in a server. This is big topic which is quite difficult to brief in a short blog, but I’ve tried to make this simple, informative and explanatory as much as possible.

 

[root@xxx.yyy.zzz ~]# mpstat -P ALL

Linux 2.6.18-194.32.1.el5 (xxx.yyy.zzz.com)    12/19/2011

07:14:44 AM  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s

07:14:44 AM  all   46.44    0.00    0.30    1.91    0.02    0.06    0.00   51.27    222.41

07:14:44 AM    0   40.54    0.01    0.55    4.80    0.04    0.11    0.00   53.96    179.90

07:14:44 AM    1   49.56    0.01    0.21    0.59    0.01    0.04    0.00   49.60     14.16

07:14:44 AM    2   49.22    0.00    0.14    0.33    0.01    0.04    0.00   50.26     28.34

It is perfectly okay to have a system with less percent idle (may be zero), so long as the average runnable queue for the CPU is less than (2 x number of CPUs).

But the xxx.yyy.zzz.com (192.168.0.1) has CPU bottleneck –

[root@xxx.yyy.zzz ~]# vmstat 1 10

procs ———–memory———- —swap– —–io—- –system– —–cpu——

r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st

11  1    104  48696 2060588 539632    0    0    59    73    0    0 46  0 51  2  0

13  1    104  48696 2060588 539684    0    0     0     0  110  430 100  0  0  0  0

22  1    104  48432 2060592 539680    0    0     4     0  123  440 100  0  0  0  0

15  1    104  48440 2060592 539684    0    0     0     8  107  450 100  0  0  0  0

16  1    104  48440 2060604 539672    0    0     8    80  125  485 100  0  0  0  0

15  1    104  48440 2060612 539688    0    0     8     0  110  448 100  0  0  0  0

15  1    104  48424 2060620 539680    0    0     8     0  107  524 100  0  0  0  0

19  1    104  48424 2060628 539696    0    0     8     0  264  552 100  0  0  0  0

17  1    104  48424 2060636 539688    0    0     8    16  111  442 100  0  0  0  0

15  1    104  48440 2060652 539680    0    0     8    16  163  516 100  0  0  0  0

 

As the metric that identifies a CPU over utilization (not bottleneck) is the run queue (r value) which exceeds the number of CPUs on the server (should be <6)

[root@xxx.yyy.zzz ~]# top

top – 07:38:07 up 317 days, 18:22,  3 users,  load average: 12.57, 11.99, 11.76

Tasks: 139 total,   4 running, 134 sleeping,   0 stopped,   1 zombie

Cpu0  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu1  :100.0%us,  0.0%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Cpu2  : 99.7%us,  0.3%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

Mem:   8175240k total,  8126656k used,    48584k free,  2059612k buffers

Swap:  4192956k total,      104k used,  4192852k free,   539912k cached

 

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND

23506 root      19   0 3193m 2.4g  12m S 299.1 31.2  25257:21 /opt/jdk1.6.0_23/bin/java -server -Xms2048m -Xmx2048m -XX:MaxPermSize=512m -Dfile.encoding=UTF-8

3465 root      15   0 17532 1292 1044 S  0.3  0.0 171:13.34 /usr/lib/vmware-tools/sbin64/vmware-guestd –background /var/run/vmware-guestd.pid

The above output clearly indicates that due to java process the all CPUs are running in full capacity (i.e. 100%) and user (us) usage is maximum.

General Misconceptions

CPU Utilization is reaching 100%, then CPU bottleneck exists.

  1. If the CPU utilization is not increasing with the load then application is working well
  2. If average CPU utilization is less, then the chance of CPU bottleneck is less.

Reality

CPU utilization is 100% means CPU is utilization is optimal, until and unless the CPU runqueue values (per vmstat) exceeds the number of processors on the server (cpu_count), there is no CPU (i.e. Infra) bottleneck.

  1. Average CPU utilization is very less (may be 15%), that doesn’t mean application is working fine, because possibly one CPU alone is overloaded (hence, average is coming less). This indicates a possible CPU issue.

There could be any possible cause for causing the high CPU utilization.

Next Tuning Steps

Thread Dump Analysis

    • When to use – If CPU is under or over utilized and the response time of site is increasing.
    • To find the lock contentions and deadlocks in threads.
  1. ThreadsPerchild directive in Apache httpd.conf file
    • the number of requests that can be handled concurrently by the HTTP server is less or more.
  2. Tuning
    1. Thread Pool
      1. Increase thread pool size until there is no further improvement in CPU utilization.
      2. JVM
        1. JVM tuning includes both heap and stack tuning. [ How to doc – WIP ]
        2. Monitor the GC activity using –Xverbosegc.
        3. DB Pool
          1. Increase DB pool size until there is no further improvement in database machine CPU utilization.
  3. Run Profiler tool
    1. Tune most frequently executed methods
    2. Tune hot methods where most of the time is spent
  4. Database
    1. Tune SQLs / Database instance
    2. Create missing indexes
    3. DB Connection issue like listener or too many open DB connections or SQL queries taking too much time

Further Example

Vmstat show %system CPU usage is high.

# vmstat 2

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
1  0      0 191420   8688  35780    0    0     0     0 1006   31  1  4 96  0  0
1  0      0 124468   9208  98020    0    0 15626  2074 1195  188  0 76  0 24  0
0  1      0 110716   9316 110996    0    0  3268  4144 1366   84  0 94  0  7  0
0  3      0  97048   9416 122272    0    0  2818 11855 1314  109  1 80  0 20  0
0  4      0  80476   9544 137888    0    0  3908  2786 1272  172  0 54  0 46  0

Let’s run mpstat to show more detailed CPU usage,it showed CPU was busy with interruptions.

# mpstat 2

Linux 2.6.18-92.el5 (centos-ks)         01/14/2010

02:03:50 AM  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
02:04:04 AM  all    1.33    0.00   41.78    0.00    0.44    3.56    0.00   52.89   1015.56
02:04:06 AM  all    0.00    0.00    8.04   38.69   29.65   23.62    0.00    0.00   1326.63
02:04:08 AM  all    0.00    0.00    8.70   30.43   27.54   28.50    0.00    4.83   1327.54
02:04:10 AM  all    0.00    0.00    5.47   46.77   27.36   20.40    0.00    0.00   1280.10

Use sar to find out which interrupt number was culprit.

# sar -I XALL 2 10

02:07:10 AM      INTR    intr/s

02:07:12 AM         0    992.57

02:07:12 AM         1      0.00

02:07:12 AM         2      0.00

02:07:12 AM         3      0.00

02:07:12 AM         4      0.00

02:07:12 AM         5      0.00

02:07:12 AM         6      0.00

02:07:12 AM         7      0.00

02:07:12 AM         8      0.00

02:07:12 AM         9    350.50

See which interrupts cause the prob – # cat /proc/interrupts

Conclusion: It’s actually a network NIC issue, it cause some problem during transmits or receives the frame.

Compiling “heartheat-2.0.2-1.src.com” to create RPM for 64-bits Linux System.

NoteI would like to express my gratitude to one of  my best friend Pramod Kumar for his help towards compiling and creating signature heartbeat RPM for CentOS 5.5 OS.

1 – First download the heartbeat-2.0.2 (Production release) source RPM.

2 –Run the following command to prepare the source rpm from tar.gz

rpm -ivh  heartbeat-2.0.2-1.src.rpmar

 Note – you might face the following prerequisite install these

——————————————————————————————————————————–

error: Failed build dependencies:

glib-devel is needed by heartbeat-2.0.2-1.x86_64

libnet is needed by heartbeat-2.0.2-1.x86_64

——————————————————————————————————————————–

3-  Installing the prerequisite – there may be other way around to installing, I am following up with  Yum method.

yum install glib-devel libnet

Loading “downloadonly” plugin

Loading “installonlyn” plugin

Setting up Install Process

Setting up repositories

core                                                                 [1/2]

core                      100% |=========================| 1.1 kB    00:00

extras                                                               [2/2]

extras                    100% |=========================| 1.1 kB    00:00

Reading repository metadata in from local files

Parsing package install arguments

Resolving Dependencies

Populating transaction set with selected packages. Please wait.

—> Downloading header for libnet10 to pack into transaction set.

libnet10-1.0.2a-10.fc5.x8 100% |=========================| 5.6 kB    00:01

—> Package libnet10.x86_64 0:1.0.2a-10.fc5 set to be updated

—> Downloading header for glib-devel to pack into transaction set.

glib-devel-1.2.10-18.2.2. 100% |=========================| 7.3 kB    00:00

—> Package glib-devel.x86_64 1:1.2.10-18.2.2 set to be updated

Running transaction check

 

Dependencies Resolved

 

=============================================================================

Package                 Arch       Version          Repository        Size

=============================================================================

Installing:

glib-devel              x86_64     1:1.2.10-18.2.2  core               38 k

libnet10                x86_64     1.0.2a-10.fc5    extras             51 k

 

Transaction Summary

=============================================================================

Install      2 Package(s)

Update       0 Package(s)

Remove       0 Package(s)

Total download size: 89 k

Is this ok [y/N]: y

Downloading Packages:

(1/2): libnet10-1.0.2a-10 100% |=========================|  51 kB    00:01

(2/2): glib-devel-1.2.10- 100% |=========================|  38 kB    00:00

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: glib-devel                   ######################### [1/2]

Installing: libnet10                     ######################### [2/2]

 

Installed: glib-devel.x86_64 1:1.2.10-18.2.2 libnet10.x86_64 0:1.0.2a-10.fc5

Complete!

[root@centos5.5 SOURCES]#

———————————————————————————————————————————

4-  Installing source rpm again after prerqusite match

 

rpm -ivh  heartbeat-2.0.2-1.src.rpm

:heartbeat              ########################################### [100%]

[root@centos5.5 SRPMS]#

5-  Run the tree command show the following structure, where the SOURCE RPM will create compressed file inside the /usr/src/redhat/Source directory and SPEC file inside the SPECS like heartbeat.spec

[root@centos5.5 redhat]# tree

|– BUILD

|– RPMS

|   |– noarch

|   `– x86_64

|– SOURCES

 `– heartbeat-2.0.2.tar.gz

|– SPECS

|   `– heartbeat.spec

`– SRPMS

`– heartbeat-2.0.2-1.src.rpm

7 directories, 3 files

[root@centos5.5 redhat]#

6 – Modify the spec file as per your requirement. Like modify the version as

Release:        2.0.2.signature

7 – Uncompress /usr/src/redhat/SOURCE/heartbeat-2.0.2.tar.gz

cd /usr/src/redhat/SOURCES/heartbeat-2.0.2

 8  – Open configure file i.e vi configure

Replace the following for avoid Werror which interrupt warning as error and does not compile. Remove the Werror from the following string under configure file

 

if test “${enable_fatal_warnings}” = yes && cc_supports_flag -Werror ; then

echo “Enabling Fatal Warnings (-Werror) on this platform”

FATAL_WARNINGS=”-Werror”

fi

 

with

 

if test “${enable_fatal_warnings}” = yes && cc_supports_flag -Werror ; then

echo “Enabling Fatal Warnings (-Werror) on this platform”

FATAL_WARNINGS=””

fi

 

(ii) if test X”$CURSESLIBS” != X”” &&  cc_supports_flag -Wcast-qual

&& cc_supports_flag -Werror; then

echo “$as_me:$LINENO: checking whether printw() requires argument of “const char *”” >&5

echo $ECHO_N “checking whether printw() requires argument of “const char *”… $ECHO_C” >&6

ac_save_LIBS=$LIBS

LIBS=”$CURSESLIBS  $LIBS”

ac_save_CFLAGS=$CFLAGS

CFLAGS=”-Wcast-qual -Werror”

cat >conftest.$ac_ext <<_ACEOF

/* confdefs.h.  */

 

With

 

if test X”$CURSESLIBS” != X”” &&  cc_supports_flag -Wcast-qual

&& cc_supports_flag -Werror; then

echo “$as_me:$LINENO: checking whether printw() requires argument of “const char *”” >&5

echo $ECHO_N “checking whether printw() requires argument of “const char *”… $ECHO_C” >&6

ac_save_LIBS=$LIBS

LIBS=”$CURSESLIBS  $LIBS”

ac_save_CFLAGS=$CFLAGS

CFLAGS=”-Wcast-qual”

cat >conftest.$ac_ext <<_ACEOF

/* confdefs.h.  */

 

9 – Delete /usr/src/Redhat/Source/heartbeat-2.0.2.tar.gz  and compress the /usr/src/redhat/SOURCES/heartbeat-2.0.2

tar –cf  heartbeat-2.0.2.tar.gz  heartbeat-2.0.2

10 – run the following command to build the rpm

rpmbuild -bb SPECS/heartbeat.spec

It may complain with the following error ( Fix the prerequisite)

 Making all in libltdl

/bin/sh: line 0: cd: libltdl: No such file or directory

make: *** [all-recursive] Error 1

error: Bad exit status from /var/tmp/rpm-tmp.71649 (%build)

RPM build errors:

Bad exit status from /var/tmp/rpm-tmp.71649 (%build)

11- installing libltdl

[root@centos5.5 SOURCES]# yum install libtool-ltdl-devel libtool-ltdl

Loading “downloadonly” plugin

Loading “installonlyn” plugin

Setting up Install Process

Setting up repositories

core                                                                 [1/2]

extras                                                               [2/2]

Reading repository metadata in from local files

Parsing package install arguments

Resolving Dependencies

Populating transaction set with selected packages. Please wait.

—> Downloading header for libtool-ltdl to pack into transaction set.

libtool-ltdl-1.5.22-2.2.i 100% |=========================|  15 kB    00:00

—> Package libtool-ltdl.i386 0:1.5.22-2.2 set to be updated

—> Downloading header for libtool-ltdl-devel to pack into transaction set.

libtool-ltdl-devel-1.5.22 100% |=========================|  13 kB    00:00

—> Package libtool-ltdl-devel.x86_64 0:1.5.22-2.2 set to be updated

Running transaction check

 

Dependencies Resolved

 

=============================================================================

Package                 Arch       Version          Repository        Size

=============================================================================

Installing:

libtool-ltdl            i386       1.5.22-2.2       core               36 k

libtool-ltdl-devel      x86_64     1.5.22-2.2       core               31 k

 

Transaction Summary

=============================================================================

Install      2 Package(s)

Update       0 Package(s)

Remove       0 Package(s)

Total download size: 67 k

Is this ok [y/N]: y

Downloading Packages:

(1/2): libtool-ltdl-1.5.2 100% |=========================|  36 kB    00:01

(2/2): libtool-ltdl-devel 100% |=========================|  31 kB    00:00

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: libtool-ltdl                 ######################### [1/2]

Installing: libtool-ltdl-devel           ######################### [2/2]

 

Installed: libtool-ltdl.i386 0:1.5.22-2.2 libtool-ltdl-devel.x86_64 0:1.5.22-2.2

Complete!

[root@centos5.5 SOURCES]#

12 – run the rpmbuild command again to build the rpm.

[root@centos5.5 SOURCES]# rpmbuild -bb /usr/src/redhat/SPECS/heartbeat.spec

Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1

Requires: /bin/sh /usr/bin/python heartbeat-pils = 2.0.2-2.Signature libbz2.so.1()(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libcurl.so.3()(64bit) libdl.so.2()(64bit) libglib-2.0.so.0()(64bit) libltdl.so.3()(64bit) libpils.so.1()(64bit) librt.so.1()(64bit) libssl.so.6()(64bit) libstonith.so.1()(64bit) libuuid.so.1()(64bit) libxml2.so.2()(64bit) libz.so.1()(64bit) telnet

Processing files: heartbeat-pils-2.0.2-2.Signature

Provides: generic.so()(64bit) libpils.so.1()(64bit)

Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1

Requires: libbz2.so.1()(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libdl.so.2()(64bit) libglib-2.0.so.0()(64bit) libltdl.so.3()(64bit) librt.so.1()(64bit) libuuid.so.1()(64bit) libz.so.1()(64bit)

Processing files: heartbeat-debuginfo-2.0.2-2.Signature

Provides: apcmaster.so.debug()(64bit) apcsmart.so.debug()(64bit) baytech.so.debug()(64bit) bcast.so.debug()(64bit) bz2.so.debug()(64bit) crc.so.debug()(64bit) cyclades.so.debug()(64bit) drac3.so.debug()(64bit) external.so.debug()(64bit) generic.so.debug()(64bit) heartbeat.so.debug()(64bit) ibmhmc.so.debug()(64bit) libapphb.so.0.0.0.debug()(64bit) libccmclient.so.1.0.0.debug()(64bit) libcib.so.0.0.0.debug()(64bit) libclm.so.1.0.0.debug()(64bit) libcrmcommon.so.0.0.0.debug()(64bit) libhbclient.so.1.0.0.debug()(64bit) liblrm.so.0.0.0.debug()(64bit) libpengine.so.0.0.0.debug()(64bit) libpils.so.1.0.0.debug()(64bit) libplumb.so.1.0.0.debug()(64bit) libplumbgpl.so.1.0.0.debug()(64bit) librecoverymgr.so.1.0.0.debug()(64bit) libstonith.so.1.0.0.debug()(64bit) libstonithd.so.0.0.0.debug()(64bit) lsb.so.debug()(64bit) mcast.so.debug()(64bit) md5.so.debug()(64bit) meatware.so.debug()(64bit) null.so.debug()(64bit) nw_rpc100s.so.debug()(64bit) ocf.so.debug()(64bit) ping.so.debug()(64bit) ping_group.so.debug()(64bit) rcd_serial.so.debug()(64bit) recmgr.so.debug()(64bit) rps10.so.debug()(64bit) serial.so.debug()(64bit) sha1.so.debug()(64bit) ssh.so.debug()(64bit) stonith.so.debug()(64bit) suicide.so.debug()(64bit) test.so.debug()(64bit) ucast.so.debug()(64bit) wti_nps.so.debug()(64bit) zlib.so.debug()(64bit)

Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1

Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/heartbeat-2.0.2-build

Wrote:/usr/src/redhat/RPMS/x86_64/heartbeat-2.0.2-2.Signature.x86_64.rpm

Wrote:/usr/src/redhat/RPMS/x86_64/heartbeat-ldirectord-2.0. 2.Signature.x86_64.rpm 

Wrote:/usr/src/redhat/RPMS/x86_64/heartbeat-stonith-2.0.2-2.Signature.x86_64.rpm

Wrote: /usr/src/redhat/RPMS/x86_64/heartbeat-pils-2.0.2-2.Signature.x86_64.rpm

Wrote:/usr/src/redhat/RPMS/x86_64/heartbeat-debuginfo-2.0.2-2.Signature.x86_64.rpm

Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.48338

+ umask 022

+ cd /usr/src/redhat/BUILD

+ cd heartbeat-2.0.2

+ ‘[‘ -n /var/tmp/heartbeat-2.0.2-build -a /var/tmp/heartbeat-2.0.2-build ‘!=’ / ‘]’

+ rm -rf /var/tmp/heartbeat-2.0.2-build

+ rm -rf /usr/src/redhat/BUILD/heartbeat-2.0.2

+ exit 0

[root@centos5.5 redhat]#

Note –  Heartbeat & LVS rpm are build.

[root@centos5.5 SOURCES]# ls -trl ../RPMS/x86_64/

total 19016

-rw-r–r– 1 root root   40943 Nov 18 18:58 heartbeat-ldirectord-2.0.2-2.Signature.x86_64.rpm

-rw-r–r– 1 root root 9053786 Nov 18 18:58 heartbeat-2.0.2-2.Signature.x86_64.rpm

-rw-r–r– 1 root root 1274315 Nov 18 18:58 heartbeat-stonith-2.0.2-2.Signature.x86_64.rpm

-rw-r–r– 1 root root  123031 Nov 18 18:58 heartbeat-pils-2.0.2-2.Signature.x86_64.rpm

-rw-r–r– 1 root root 8926329 Nov 18 18:58 heartbeat-debuginfo-2.0.2-2.Signature.x86_64.rpm

[root@centos5.5 SOURCES]#

 

How to compare processes/threads on system with sar ‘plist-sz’ output from apache prospective

Here are the steps of step to identified and compare/check  processes/threads on system with sar ‘plist.sz’ details and ps -eLf

1-         sar output –
uspvldmzlx25:~# sar -q | tail -30
07:20:02 AM         6       309      0.61      0.91      0.95
07:22:01 AM         0       292      0.82      0.99      0.98
07:24:01 AM         0       288      0.86      1.01      0.99
07:26:01 AM         0       285      1.24      1.15      1.04
07:28:01 AM         0       284      0.86      1.07      1.02
07:30:02 AM         5       293      0.64      0.95      0.98
07:32:01 AM         0       288      0.86      1.03      1.01
07:34:01 AM         1       290      1.01      1.00      1.00
07:36:01 AM         1       286      1.39      1.15      1.05
07:38:01 AM         0       289      1.24      1.19      1.07
07:40:01 AM         5       294      2.09      1.59      1.23
07:42:01 AM         0       285      1.49      1.68      1.32
07:44:01 AM         0       289      0.94      1.39      1.25
07:46:01 AM         0       295      2.08      1.69      1.37
2 –   Processes/Threads
test5:~# ps -eLf | wc -l
311
test5:~#
Note – If you compare the IInd column ( plist-sz)  of sar –q command it will show the same or near by value of ‘ps –eLf’
So its clear now that sar –q shown the process/thread , it will help us to analyze apache server max client issue if occurs any point of time.