Monthly Archives: June 2015

Innodb recovery

We were getting below error on checking

#  /etc/init.d/mysqld status

ERROR! MySQL is running but PID file could not be found

On trying to restart were getting below error

root@alpha [~]# /scripts/restartsrv_mysql
Waiting for “mysql” to restart …………
…failed.

Service Error
The “mysql” service failed to start.

Startup Log
Starting MySQL………… SUCCESS!

Log Messages
150627 23:53:37 mysqld_safe mysqld restarted
150627 23:53:37 mysqld_safe Number of processes running now: 0
150627 23:53:37 mysqld_safe mysqld restarted
150627 23:53:37 mysqld_safe mysqld restarted
150627 23:53:37 mysqld_safe Number of processes running now: 1
150627 23:53:37 mysqld_safe mysqld process hanging, pid 16496 – killed
150627 23:53:37 mysqld_safe mysqld process hanging, pid 16501 – killed
150627 23:53:37 mysqld_safe Number of processes running now: 2
/usr/sbin/mysqld[0x84cbc2]
/usr/sbin/mysqld[0x857c7a]
/usr/sbin/mysqld[0x91b362]
/usr/sbin/mysqld[0x9267d2]
/usr/sbin/mysqld[0x85942b]
/usr/sbin/mysqld[0x858f82]
150627 23:53:36 mysqld_safe mysqld restarted

mysql has failed. Contact your system administrator if the service does not automagically recover.

The error was due to corruption in innodb in server

We found the below fix successful to fix this issue

Open the mysql configuration file  my.cnf which is in

root@alpha [~]# vi /etc/my.cnf

Add below entry in it

[mysqld]
innodb_force_recovery = 4

 

ow restart Mysql using below command in cpanel server

 

root@alpha [~]# /scripts/restartsrv_mysql

Waiting for “mysql” to restart ……waiting for “mysql” to initialize ……
…finished.

Service Status
mysql (/usr/sbin/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/usr/lib64/mysql/plugin –user=mysql –log-error=/var/lib/mysql/alpha.redlogic.com.err –open-files-limit=100000 –pid-file=/var/lib/mysql/alpha.redlogic.com.pid) is running as mysql with PID 28440 (pidfile check method).

Startup Log
Starting MySQL.. SUCCESS!

Log Messages
150628  0:03:54 [Note] /usr/sbin/mysqld: ready for connections.
150628 00:03:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150628 00:03:53 mysqld_safe mysqld from pid file /var/lib/mysql/alpha.redlogic.com.pid ended
150628  0:03:53 [Note] /usr/sbin/mysqld: Shutdown complete
150628  0:03:52 [Warning] /usr/sbin/mysqld: Forcing close of thread 119  user: ‘eximstats’
150628  0:03:50 [Note] /usr/sbin/mysqld: Normal shutdown
150627 23:56:34 [Note] /usr/sbin/mysqld: ready for connections.
150627 23:56:33 mysqld_safe mysqld from pid file /var/lib/mysql/alpha.redlogic.com.pid ended
150627 23:56:33 [Note] /usr/sbin/mysqld: Shutdown complete
150627 23:56:29 [Warning] /usr/sbin/mysqld: Forcing close of thread 1  user: ‘eximstats’
150627 23:56:29 [Warning] /usr/sbin/mysqld: Forcing close of thread 5  user: ”
150627 23:56:27 [Note] /usr/sbin/mysqld: Normal shutdown

mysql restarted successfully.

root@alpha [~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.42-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> quit
Bye
root@alpha [~]#

Mysql was up and running now

 

lvremove to remove logical volume from LVG

How to create spare Logical volume partition in linux server

We had a default install of

 

Screenshot from 2015-06-25 22:06:22

[root@SRV-01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_srv01-lv_root
50G 2.6G 45G 6% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 477M 67M 385M 15% /boot
/dev/mapper/vg_srv01-lv_home
860G 72M 816G 1% /home

As KVM virtualization need spare LVM to create vps on we had to free /home partition which has no data in it

So the process starts

#Using vgdisplay check the VG present

[root@SRV-01 ~]# vgdisplay
— Volume group —
VG Name vg_srv01
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 931.02 GiB
PE Size 4.00 MiB
Total PE 238341
Alloc PE / Size 238341 / 931.02 GiB
Free PE / Size 0 / 0
VG UUID tBHSEL-UIHM-OMbu-9KWk-ZTW9-97j5-UzwQDl
#lvscan to check the LVM name

[root@SRV-01 ~]# lvscan
ACTIVE ‘/dev/vg_srv01/lv_root’ [50.00 GiB] inherit
ACTIVE ‘/dev/vg_srv01/lv_home’ [873.17 GiB] inherit
ACTIVE ‘/dev/vg_srv01/lv_swap’ [7.85 GiB] inherit

Before removing the Logical volume partition need to unmount it  else you get below error

[root@SRV-01 ~]# lvremove /dev/vg_srv01/lv_home
Logical volume vg_srv01/lv_home contains a filesystem in use.

 

So unmounted /home which has  /dev/vg_srv01/lv_home

[root@SRV-01 ~]# umount /home/

 

Now removed the logical volume using lvremove

[root@SRV-01 ~]# lvremove /dev/vg_srv01/lv_home
Do you really want to remove active logical volume lv_home? [y/n]: y
Logical volume “lv_home” successfully removed

Now /home  alias  /dev/vg_srv01/lv_home is free to create  VM on it

[root@SRV-01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_srv01-lv_root
50G 2.6G 45G 6% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 477M 67M 385M 15% /boot

Error from MySQL query: DBD::mysql::db do failed: Can’t find any matching row in the user table

Have you been getting below error

“Error from MySQL query: DBD::mysql::db do failed: Can’t find any matching row in the user table”

To fix this issue follow below method,

Please remove the following entry from /etc/my.cnf and then restart MySQL:

skip-name-resolve
Screenshot - Monday 22 June 2015 - 12:20:11  IST
The restart mysql using /scripts/restartsrv_mysql
This fixes the issue

upcp cpanel error

While running a upcp –force in cPanel server got below error
[2015-06-20 13:48:48 -0400] see http://go.cpanel.net/rpmcheckfailed for more information
[2015-06-20 13:48:48 -0400] The Administrator will be notified to review this output when this script completes
=> Log closed Sat Jun 20 13:48:48 2015
[2015-06-20 13:49:13 -0400] 17% complete
[2015-06-20 13:49:13 -0400] E Running `/usr/local/cpanel/scripts/updatenow –upcp –log=/var/cpanel/updatelogs/update.1434820770.log` failed, exited with code 1 (signal = 0)
=> Log closed Sat Jun 20 13:49:24 2015

Screenshot - Saturday 20 June 2015 - 11:42:31  IST

The issue is due to duplicate rpm in server

cPanel has a auto script to fix this issue

You need to use command /scripts/autorepair fix_duplicate_cpanel_rpms to remove duplicate rpm in server

root@server1 [/usr/local/apache]# /scripts/autorepair fix_duplicate_cpanel_rpms

This fixed the issue for me and now upcp is working fine.