Saturday, June 22, 2013

Running out of memory on your linux machine ?!!

Take the following stat.. where we see that only 260MB is shown free and can see also that around 29GB was cached (cached by the *NIX OSes incase that it may require in near future) and it appears that 31GB was in completely used and only 260MB seems to be free.

[root@web3 ~]# free -m

             total used free shared buffers cached

Mem:         32062 31801 260      0     486  29615

-/+ buffers/cache: 1699 30363

Swap:        4095  0    4095


But for Kernel saw it as around 30GB was in free in buffers/cache, So the kernel would decide whether if it required to flush currently inactive data off the RAM when it's required by a new process depending on the memory available.

The attempt made to keep the server still running by forcefully flushing the inactive entries off the RAM .
And also the server was accessible at that time and responding.
[root@web3 ~]# echo 3 > /proc/sys/vm/drop_caches; sync 
As this is a non-destructive operation, and the option 3 will only free things that are completely unused like pagecache, dentries and inodes.

After this... Here's what the current memory utilization on the server is:


[wiz@web3 ~]$ free -m


            total       used       free     shared    buffers     cached

Mem:         32062        872      31189          0        133         55

-/+ buffers/cache:        684      31377

Swap:         4095          0       4095

[wiz@web3 ~]$ uptime

06:30:14 up 21 days,  6:42,  2 users,  load average: 0.00, 0.01, 0.00
HTH

Learn and Share The Knowledge


Open 7z files

Hello..

You may come across a .7z file as its got a higher compression rate and used more widely now a days..

You may not find this pre-installed while on your ubuntu machine you would have to install this package provided by the synaptic package manager or by the cli as follows..

sudo apt-get install p7zip-full
usage: p7zip-full file-name.7z

Or visit their site http://www.7-zip.org/ to download

Mysql Error, service refusing to start


Here is a scenario where the mysql service was refusing to start and the site was reported as down as a result.. not a good sight.. when you were not the person who is maintaining it and the client runs to you for quick help.

Read on to checkout what took it to get it back running..

[root@WEB2 ~]# /etc/init.d/mysqld start

MySQL Daemon failed to start.

Starting mysqld: [FAILED]

Reading through some of mysql logs.. It was evident from the below logs whats is going on when the service was tried to start:

130113 11:26:47 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql130113 11:26:47 [ERROR] Error message file '/usr/share/mysql/english/errmsg.sys' had only 481 error messages,

but it should contain at least 641 error messages.

Check that the above file is the right version for this program!

/usr/libexec/mysqld: Unknown error 1146

130113 11:26:47 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

130113 11:26:47 InnoDB: Initializing buffer pool, size = 8.0M

130113 11:26:47 InnoDB: Completed initialization of buffer pool

130113 11:26:47 InnoDB: Started; log sequence number 0 43655

130113 11:26:47 [ERROR] Aborting

130113 11:26:47 InnoDB: Starting shutdown...

Check if really there are mysql versions/dependencies installed on your mysql server:
 
[wiz@WEB2 run]$ sudo yum list installed | grep mysql

libdbi-dbd-mysql.x86_64 0.8.1a-1.2.2 installed

mysql.i386 5.0.95-3.el5 installed

mysql.x86_64 5.1.58-jason.1 installed

mysql-connector-odbc.x86_64 3.51.26r1127-2.el5 installed

mysql-server.x86_64 5.1.58-jason.1 installed

mysqlclient15.x86_64 5.0.91-1.jason.1 installed

php53-mysql.x86_64 5.3.3-13.el5_8 installed 
 
 
  
[wiz@WEB2 run]$ arch

x86_64

The person (possibly the client) installed two versions of the software..

It was evident that there are two versions of mysql present on the machine after the yum update on the machine.

Due to which the mysql startup script is unable to start as it was terminating startup sequence..

The FIX

What you need to do to fix this issue..  Replace the file '/usr/share/mysql/english/errmsg.sys' with the same file from mysql.5.1.58 version and ensure it has only single version of mysql architecture installed.

HTH.

Intro to the Blog,

Hello World..!

Welcome to my blog ..  you will come across articles, notes written by a Lazy Engineer in Process on various aspects of technology.

Learn and Share The Knowledge