Wednesday, February 29, 2012

Apache Error – No space left on device: Couldn’t create accept lock

   Sometime Apache (HTTPD) service on a Server stops and while restart it shows following messages in error_logs

[Mon Jan 17 00:18:23 2011] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock Configuration Failed

  Such errors appears when you are running out of Disk Space or Quota which is assigned (which can be increased to fix the issue) OR when semaphores of the server gets full. Semaphores are often used to restrict the number of threads than can access some (physical or logical) resource.

Using the below command you can semaphores list.

root@mughil:~# ipcs -s | grep nobody

  So, In-order to clear the semaphores list. We have execute the following command.

root@mughil:~# ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem

Tuesday, February 14, 2012

How to Rebuild 3ware raid?


Rebuild Raid:

Unit  UnitType  Status         %Cmpl  Stripe  Size(GB)  Cache  AVerify  IgnECC
------------------------------------------------------------------------------
u0    RAID-5    DEGRADED       -      64K     1862.61   OFF    ON       OFF      

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     DEVICE-ERROR     u0     465.76 GB   976773168     WD-WMASY8103731
p1     OK               u0     465.76 GB   976773168     WD-WMASY8098447
p2     OK               u0     465.76 GB   976773168     WD-WMASY8101621
p3     OK               u0     465.76 GB   976773168     WD-WMASY8102807
p4     OK               u0     465.76 GB   976773168     WD-WMASY8103606
p5     NOT-PRESENT      -      -           -             -
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -
Replaced disk in p0.
//cps2> info c2

Unit  UnitType  Status         %Cmpl  Stripe  Size(GB)  Cache  AVerify  IgnECC
------------------------------------------------------------------------------
u0    RAID-5    DEGRADED       -      64K     1862.61   OFF    ON       OFF      

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               -      465.76 GB   976773168     WD-WCASY7466065
p1     OK               u0     465.76 GB   976773168     WD-WMASY8098447
p2     OK               u0     465.76 GB   976773168     WD-WMASY8101621
p3     OK               u0     465.76 GB   976773168     WD-WMASY8102807
p4     OK               u0     465.76 GB   976773168     WD-WMASY8103606
p5     NOT-PRESENT      -      -           -             -
p6     NOT-PRESENT      -      -           -             -
p7     NOT-PRESENT      -      -           -             -

Basic of 3ware Raid


Raid Fix on Linux:

[~]# ./tw_cli

Unit  UnitType  Status         %RCmpl  %V/I/M  Stripe  Size(GB)  Cache  AVrfy
------------------------------------------------------------------------------
u0    RAID-5    OK             -       -       64K     1629.74   ON     OFF

Port   Status           Unit   Size        Blocks        Serial
---------------------------------------------------------------
p0     OK               u0     233.76 GB   490234752     WD-WCANY2312070
p1     OK               u0     233.76 GB   490234752     WD-WCANY2311250
p2     DEVICE-ERROR     u0     233.76 GB   490234752     WD-WCANY1796905
p3     OK               u0     233.76 GB   490234752     WD-WCANY2265331
p4     OK               u0     233.81 GB   490350672     WD-WCAT1A636279
p5     OK               u0     233.81 GB   490350672     WD-WMAYP3458409
p6     OK               u0     233.76 GB   490234752     WD-WCANY2312032
p7     OK               u0     233.81 GB   490350672     WD-WCAT1H074670

//EDGWIN> maint remove c0 p2
Removing port /c0/p2 ... Done.

//EDGWIN> info c0

Sunday, February 12, 2012

How to install mod_evasive module for apache?


    mod_evasive is an evasive maneuvers module for Apache to provide evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is also designed to be a detection and network management tool, and can be easily configured to talk to ipchains, firewalls, routers, and etc…
    Detection is performed by creating an internal dynamic hash table of IP Addresses and URIs, and denying any single IP address from any of the following:

  • Requesting the same page more than a few times per second
  • Making more than 50 concurrent requests on the same child per second
  • Making any requests while temporarily blacklisted (on a blocking list)

Installation Procedure:

# cd /usr/local/src

# wget http://fossies.org/unix/www/apache_httpd_modules/mod_evasive_1.10.1.tar.gz

# tar -xzvf mod_evasive_1.10.1.tar.gz ; cd mod_evasive*

# apxs -cia mod_evasive20.c

  Now add the mod_evasive configuration to your Apache configuration file httpd.conf  as below

LoadModule evasive20_module /usr/lib/httpd/modules/mod_evasive20.so

 mod_evasive configuration:

<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify someone@somewhere.com
</IfModule>

# /etc/init.d/httpd restart