Sunday, October 19, 2014

How to solve HTTP Error 503. The service is unavailable in IIS

I am getting "Service Unavailable" error while loading IIS, port 80 is listening fine from locally and public.

Open inetmgr
Double click "application pools" from lest side
Right click and start the "DefaultAppPool"

I got my application is working fine

Saturday, September 6, 2014

Nginx as a load balancer

How to configure Nginx as a Load balancer

sudo apt-get install nginx

nano /etc/nginx/sites-available/default

First we need to include the upstream module which looks like this:

upstream backend  {

We should then reference the module further on in the configuration:

 server {
  location / {
    proxy_pass  http://backend;

sudo service nginx restart

Wednesday, August 27, 2014

How to install memcahe on a cpanel server

For CentOS 6 64 bit,

# rpm -Uvh epel-release-6-7.noarch.rpm
yum install memcached
vi /etc/sysconfig/memcached
# Running on Port 11211

# Start as memcached daemon

# Set max simultaneous connections to 1024

# Set Memory size to 2048 - 4GB(4096)

#Set server IP address

chkconfig --levels 235 memcached on
/etc/init.d/memcached start

Then, install PHP memcache

pecl install memcache
service httpd restart

Monday, August 25, 2014

Install and configure Postgresql in Centos

How to install and configure Postgresql in Centos

yum install postgresql postgresql-server
chkconfig postgresql on
service postgresql initdb
service postgresql start

Now Postgresql has been installed in your box.

From Windows client i need to connect with this postgresql server. For that i download and install  pgAdminIII

Before getting connect, we have to allow remote clients to get connection in the server

Login to the postgresql box
su - postgres
vi /var/lib/pgsql/data/postgresql.conf
Change the line "listen_address='localhost'" to listen_address='*'
Uncomment port 5432 

Also we have to mention the client IP to allow/trust in postgresql server

vi  /var/lib/pgsql/data/pg_hba.conf  
host all all md5
host all all md5

Restart the service.

Now i can connect to postgresql server from the windows client using the pgAdmin tool 

Thursday, August 14, 2014

Resolving alfresco to port 80

I need to change the default port of alfresco (http://ip:8080/share) to listen on port 80(http://ip/share)
My alfresco verion is 3.4 community edition
OS is windows 2008 R2

We need to edit two configuration files for listening alfresco from port 8080 to 80.

1. tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml
    Change all ports from 8080 to the desired port
    Save file

2. tomcat/conf/server.xml
    Find the line having ajp
    Change the connector port from 8080 to 80
     Save file

Restart alfresco service.

Try to access http://ip/share
Login with your credentials.

Thursday, July 3, 2014

task blocked for more than 120 seconds.

When running some high workloads on UEK kernels on systems with a lot of memory you might see the following errors in /var/log/messages:

INFO: task bonnie++:31785 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
bonnie++      D ffff810009004420     0 31785  11051               11096 (NOTLB)
ffff81021c771aa8 0000000000000082 ffff81103e62ccc0 ffffffff88031cb3
ffff810ac94cd6c0 0000000000000007 ffff810220347820 ffffffff80310b60
00016803dfd77991 00000000001312ee ffff810220347a08 0000000000000001
Call Trace:
[<ffffffff88031cb3>] :jbd:do_get_write_access+0x4f9/0x530
[<ffffffff800ce675>] zone_statistics+0x3e/0x6d
[<ffffffff88032002>] :jbd:start_this_handle+0x2e5/0x36c
[<ffffffff800a28b4>] autoremove_wake_function+0x0/0x2e
[<ffffffff88032152>] :jbd:journal_start+0xc9/0x100
[<ffffffff88050362>] :ext3:ext3_write_begin+0x9a/0x1cc
[<ffffffff8000fda3>] generic_file_buffered_write+0x14b/0x675
[<ffffffff80016679>] __generic_file_aio_write_nolock+0x369/0x3b6
[<ffffffff80021850>] generic_file_aio_write+0x65/0xc1
[<ffffffff8804c1b6>] :ext3:ext3_file_write+0x16/0x91
[<ffffffff800182df>] do_sync_write+0xc7/0x104
[<ffffffff800a28b4>] autoremove_wake_function+0x0/0x2e
[<ffffffff80062ff0>] thread_return+0x62/0xfe
[<ffffffff80016a81>] vfs_write+0xce/0x174
[<ffffffff80017339>] sys_write+0x45/0x6e
[<ffffffff8005d28d>] tracesys+0xd5/0xe0

This is a know bug. By default Linux uses up to 40% of the available memory for file system caching. After this mark has been reached the file system flushes all outstanding data to disk causing all following IOs going synchronous. For flushing out this data to disk this there is a time limit of 120 seconds by default. In the case here the IO subsystem is not fast enough to flush the data withing 120 seconds. This especially happens on systems with a lof of memory.
The problem is solved in later kernels and there is not “fix” from Oracle. I fixed this by lowering the mark for flushing the cache from 40% to 10% by setting “vm.dirty_ratio=10″ in /etc/sysctl.conf. This setting does not influence overall database performance since you hopefully use Direct IO and bypass the file system cache completely.

Saturday, June 21, 2014

Error while installing rpm elfutils-libelf-devel package

[root@shivin RPMs]# rpm -ivh elfutils-libelf-devel-0.137-3.el5.x86_64.rpm
warning: elfutils-libelf-devel-0.137-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
error: Failed dependencies:
        elfutils-libelf-devel-static-x86_64 = 0.137-3.el5 is needed by elfutils-libelf-devel-0.137-3.el5.x86_64
[root@shivin RPMs]# rpm -ivh elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm
warning: elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
error: Failed dependencies:
        elfutils-libelf-devel-x86_64 = 0.137-3.el5 is needed by elfutils-libelf-devel-static-0.137-3.el5.x86_64

Some packages need to be installed together because they depend on each other.

[root@shivinl RPMs]# rpm -ivh elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm elfutils-libelf-devel-0.137-3.el5.x86_64.rpm
warning: elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:elfutils-libelf-devel  ########################################### [ 50%]
   2:elfutils-libelf-devel-s########################################### [100%]
[root@shivin RPMs]#

Wednesday, May 14, 2014

PHP5-fpm error log


This is the error I am getting

[13-May-2014 09:50:53] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-May-2014 09:51:01] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-May-2014 09:51:43] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
[13-May-2014 09:57:37] WARNING: [pool www] server reached pm.max_children setting (10), consider raising it

I am using ubuntu12.04 and nginx with php5-fpm. When load get increased in my server i am getting the following error in /var/log/php5-fpm.log


grep -r -l "pm.max_children" /etc/*
Copy the file /etc/php5/fpm/pool.d/www.conf to a safe location
Edit the following values
pm = dynamic
pm.max_children = 100
pm.start_servers = 25
pm.min_spare_servers = 10
pm.max_spare_servers = 40
pm.max_requests = 1000

/etc/init.d/php5-fpm restart
 /etc/init.d/nginx restart

This helps

Thursday, March 13, 2014

How to disable bug search without login to bugzilla

I have a bugzilla account, which only authorized users can login and add bugs. Public have no rights to post a bug, edit or comment. But public have privellage to search the bugs.

This is because end users when adding bugs they have to enable an option “Only users in all of the selected groups can view this bug” to restrict the view from public.

Solution : Login as admini user, Navigate to Administration, Parameters, User Authentication
Change the value of requirelogin to On.

Wednesday, March 12, 2014

How to change time zone in ubuntu12.04


While checking my box, i came to know that my time/date is UTC zone. I would like to change the time zone to IST.

In command prompt, i logged in as root

dpkg-reconfigure tzdata

It will ask the zone which you needed, change it.

Check the new time zone by issuing the command date, you can see the result.

Friday, March 7, 2014

Cron job to run every second

I need a Cron job to run every second

* * * * * /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 1; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 2; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 3; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 4; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 5; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 6; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 7; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 8; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 9; /mnt/scripts/ >> /dev/null 2>&1
* * * * * sleep 10; /mnt/scripts/ >> /dev/null 2>&1
like this we need to give till sleep 59

Monday, March 3, 2014

apt-get install gives 403 Forbidden on Ubuntu 12.04 LTS EC2 Instance

For some of the package installation using apt-get i am getting 403 Forbidden error.

root@ip-172-32-14-23:~# apt-get install php5-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  fontconfig-config libfontconfig1 libgd2-xpm libt1-5 libxpm4 ttf-dejavu-core
Suggested packages:
The following packages will be REMOVED:
The following NEW packages will be installed:
  fontconfig-config libfontconfig1 libgd2-xpm libt1-5 libxpm4 php5-gd ttf-dejavu-core
0 upgraded, 7 newly installed, 1 to remove and 7 not upgraded.
Need to get 169 kB/2,157 kB of archives.
After this operation, 4,277 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Err precise-updates/main fontconfig-config all 2.8.0-3ubuntu9.1
  403  Forbidden
Err precise-updates/main libfontconfig1 amd64 2.8.0-3ubuntu9.1
  403  Forbidden
Failed to fetch  403  Forbidden
Failed to fetch  403  Forbidden
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

sudo vi /etc/apt/sources.list
Remove the entries us-west-1.ec2 as prefix:
Add the following in the file

deb lucid main multiverse universe
deb lucid-security main multiverse universe
deb lucid-updates main multiverse universe

sudo apt-get upgrade
Then i done my package installation with out any error
sudo apt-get install php5-gd

Wednesday, January 8, 2014

Converting Your Private Key Using PuTTYgen

PuTTY does not natively support the private key format (.pem) generated by Amazon EC2. PuTTY has a tool named PuTTYgen, which can convert keys to the required PuTTY format (.ppk). You must convert your private key into this format (.ppk) before attempting to connect to your instance using PuTTY.

To convert your private key

    Start PuTTYgen (for example, from the Start menu, click All Programs > PuTTY > PuTTYgen).

    Under Type of key to generate, select SSH-2 RSA.

   Click Load. By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, select the option to display files of all types

    Select your .pem file and click Open. Click OK to dismiss the confirmation dialog box.

    Click Save private key to save the key in the format that PuTTY can use. PuTTYgen displays a warning about saving the key without a passphrase. Click Yes.


    A passphrase on a private key is an extra layer of protection, so even if your private key is discovered, it can't be used without the passphrase. The downside to using a passphrase is that it makes automation harder because human intervention is needed to log on to an instance, or copy files to an instance.

    Specify the same name for the key that you used for the key pair (for example, my-key-pair). PuTTY automatically adds the .ppk file extension.

Your private key is now in the correct format for use with PuTTY. You can now connect to your instance using PuTTY's SSH client.

{Content of  ~/.ssh/id_rsa can be replaced with .pem file, it works fine}