Monitor Threads and Performance of MySQL Database using “MyTop”

Filed Under (Cpanel, DirectAdmin, Linux Tips, MySQL) by Milind on 12-01-2012

Database plays a very important part in any CMS or website as it stores the complete data but this database sometime becomes headache. Your website start running slow and when you contact your hosting company you get reply “You need to optimize your database” OR sometime for hosting company also its very hard to explain high resource usage by MySQL Database as usually System Admins are depended on “top” command which doesn’t provide accurate information.

MyTop is a console based utility which helps user to monitor the threads and performance of MySQL Database Server. This utility is easy to install and useful for Database Administrators, Server Administrators. In this article I will explain how to install and use MyTop.

1) Download: Download latest version of myTop from http://jeremy.zawodny.com/mysql/mytop/ using command wget

root@server [~]# wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz

mtop1 300x44 Monitor Threads and Performance of MySQL Database using MyTop

2) Extract and go to mytop directory

root@server [~]# tar -zxvf mytop-1.6.tar.gz
root@server [~]# cd mytop-1.6
root@server [~/mytop-1.6]

mtop2 300x239 Monitor Threads and Performance of MySQL Database using MyTop

3) Installation of MyTop: Copy and Paste following commands to install MyTOP on your Server

root@server [~/mytop-1.6]# perl Makefile.PL
root@server [~/mytop-1.6]# make
root@server [~/mytop-1.6]# make test
root@server [~/mytop-1.6]# make install

mtop3 300x113 Monitor Threads and Performance of MySQL Database using MyTop

4) Configure MyTop: To get results from MyTop you have user various command-line arguments like username, password, hostname (you can check all options using command “man mytop”)etc. everytime OR you can setup a config file and mention everything in that.
Create and open file “~/.mytop” (copy and paste name as written) using your favraite editor and then copy paste following conent

user=[database user]
pass=[password of the user]
host=[IP or hostname of the host]
db=[database name]
delay=5
port=[Port Number]
socket=
batchmode=0
header=1
color=1
idle=1

Make sure it should look like:

mtop4 300x161 Monitor Threads and Performance of MySQL Database using MyTop

5) Checking Mysql Usage: You can check the MySQL usage using command “mytop

root@server [~]# mytop

Which will show output like below

mtop5 300x56 Monitor Threads and Performance of MySQL Database using MyTop

*** Problem: When you execute mytop you will get error “Error in option spec: “long|!”

root@server [~/mytop-1.6]# mytop
Error in option spec: “long|!”
root@server [~/mytop-1.6]#

mtop6 300x42 Monitor Threads and Performance of MySQL Database using MyTop

To fix this error you have to edit mytop script. To find the exact path of mytop script use command “which

root@server [~]# which mytop
/usr/local/bin/mytop
root@server [~]#

Now edit “/usr/local/bin/mytop” using any editor like vi, nano etc. and change

“long|!” => \$config{long_nums},

TO:

“long|long_nums|l!” => \$config{long_nums},

Save and Exit and you will able to run mytop without any problem.

Install and Configure CSF on a VPS (Part-II)

Filed Under (Cpanel, DirectAdmin, Linux Tips, Plesk For Linux) by Milind on 30-12-2011

In previous Article I have explain how to enable Firewall modules on Virtuozzo or OpenVZ based node. Today I am going to explain how to install and configure CSF Firewall on a VPS.

ConfigServer Security and Firewall (CSF) is a free product developed by “ConfigServer Services” and this Firewall is successfully tested on following Operating System

RedHat v7.3, v8.0, v9.0
RedHat Enterprise v3, v4, v5 (32/64 bit)
CentOS v3, v4, v5 (32/64 bit)
Fedora Core v1 to v12(32/64 bit)
*Ubuntu v6.06 LTS, v8.10, v9.10
*Debian v3.1, v4.0, v5.0
*Mandriva 2009
*Gentoo
*openSUSE v10, v11
*Slackware v12.2
* may require custom regex patterns for some functions

Installation of CSF

Before installation of CSF make sure you have Perl 5.8.8 and perl-libwww-perl (Perl Module) is installed on your Server. If they are not installed you can install it using YUM.

yum install perl perl-libwww-perl

Now copy and paste Following Commands After “#” to install CSF on a VPS

To Download CSF:- # wget http://www.configserver.com/free/csf.tgz
Extract zip:- # tar -xzvf csf.tgz
Go to CSF Directory:- # cd csf
Install CSF:- # ./install.sh

Configuration of CSF

To Configure CSF (Basic Configuration) open/Edit CSF Configuration File at /etc/csf/csf.conf file and make following changes

1) Disable Testing Mode

Change
TESTING = "1"
to
TESTING = "0"

2) Enable incoming and outgoing Ports.

Search for “TCP_IN” and add following ports for respective control panels

Cpanel = "20,21,22,25,26,53,80,110,143,443,465,993,995,2082,2083,2086,2087,2095,2096"
Plesk = "20,21,22,25,53,80,110,143,443,465,993,995,8443,8880"
DirectAdmin = "20,21,22,25,53,80,110,143,443,2222"

Search for “TCP_OUT” and add following Ports

Cpanel = "21,22,25,26,27,37,43,53,80,110,113,443,465,873,2089"
Plesk =  "20,21,22,25,53,37,43,80,113,443,465,873,5443"

Search “UDP_IN

Cpanel = "20,21,53,953"
Plesk =  "37,53,873"
DirectAdmin = "21,53,873"

Search “UDP_OUT

Cpanel = "20,21,53,113,123,873,953"
Plesk = "53,873"

**I have used Default port for CSF Configuration and if you have any customized OR additional Port, you can add it in CSF Configuration.

Save and Exit the file. Now you can restart the Firewall using command “csf -r

Follow US

Enter your email address:


I'm listed in Technology

Sponsors

Advertisement

Become Fan

tag cloud