Friday, October 26, 2012

How to enable Innodb storage engine ?

What is a storage Engine?

Data in MySQL is stored in files (or memory) using a variety of different techniques. Each of these techniques employ different storage mechanisms, indexing facilities, locking levels and ultimately provide a range of different functions and capabilities. By choosing a different technique you can gain additional speed or functionality benefits that will improve the overall functionality of your application.

You can configure the mysql database to use Innodb Storage engine . Just follow following simple steps for this.

1) Open your file /etc/my.cnf.

2) Comment the line
skip-inndob

3)Add:
default-table-type=innodb

4)Now save the file and restart the mysql service on the server.

5) Now check if the engine has changed with the command:

[root@server~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.92-community MySQL Community Edition (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> show engines;
+————+———+—————————————————————-+
| Engine | Support | Comment |
+————+———+—————————————————————-+
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys |
| BerkeleyDB | NO | Supports transactions and page-level locking |

This should now change the storage engine for mysql on the server

cPanel pid file exists

cPanel pid file exists

In Some occations restarting cpanel service from Terminal/Shell using command “service cpanel restart” if you are getting “cpsrvd dead but pid file exists”, then let us know what should be done to resolve the issue.

ERROR:
root@server[#]/etc/init.d/cpanel status
cpsrvd dead but pid file exists
entropychat (pid 7397) is running…
melange is stopped
stunnel (pid 7523) is running…
interchange is stopped
qrunner is stopped

SOLUTION:
please check whether “cpsrvd” is running or not, using following command.

root@server[#]ps aux|grep cpsrvd
root 25755 0.0 1.3 12664 7072 pts/0 S 04:31 0:00 cpsrvd – waiting for connections
root 30218 0.0 0.1 3012 724 pts/0 S+ 04:37 0:00 grep cpsrvd

If cpsrvd is running on the server then Iptables must be blocking the port cpanel currently running on and hence we need to disable the Default firewall of the Linux i.e., iptables.

But it is strongly recommended that firewall like CSF should be installed on the server to block “Failed Login Attempts”.

Follow these steps :

root@server[#]service iptables stop
root@server[#]/usr/local/cpanel/cpsrvd
root@server[#] /etc/init.d/cpanel restart
root@server[#]/etc/init.d/cpanel status

If still the issue persist, edit the cpanel deamon file :

root@server[#]vi /etc/init.d/cpanel change

change “status cpsrvd” to “status cpsrvd-ssl” and save the changes.

root@server[#]/etc/init.d/cpanel restart
root@server[#]/etc/init.d/cpanel status

This will resolve the issue.

Configure Cluster & Synchronize in cPanel

Configure Cluster & Synchronize

==========================================>
Login to WHM >> Main >> Cluster/Remote Access >> Configure Cluster

•Click “Enable DNS Clustering”
•Click “Change”
•Click “Return to Cluster Status”

WHM >> Main >> Cluster/Remote Access >> Configure Cluster

1. Add a new server to the cluster
2. Configure

————————->
Remote cPanel & WHM DNS host: nameserver
Remote server username: root
Remote server access hash:

DNS Role : Synchronize changes
————————->

/scripts/dnscluster syncall –full
==========================================>

Reference : http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/ConfigureCluster

Monday, October 22, 2012

How to fix cPanel tailwatchd errors

How to fix cPanel tailwatchd errors

Run the following commands first.

/usr/local/cpanel/bin/checkperlmodules –full
/usr/local/cpanel/libexec/tailwatchd –restart
/scripts/cleanmd5
/etc/init.d/cpanel restart

After that run the below scripts.
———–
/scripts/restartsrv chkservd
/scripts/upcp –force

Converting table to InnoDB

Converting table to InnoDB

Converting table to InnoDB: “The used table type doesn’t support FULLTEXT indexes”

Somtimes you may want to change the Mysql table from MyISAM to InnoDB engine to setup foreign keys, to use row level locks, improve performace etc.

The conversion of the MyISAM table to InnoDB is easy however, if the table is setup with “FULLTEXT indexes”, it cannot be converted as this feature is not supported in InnoDB.

If a table is setup with “FULLTEXT indexes”, the conversion of table to InnoDB will result in “The used table type doesn’t support FULLTEXT indexes” error message.

mysql> ALTER TABLE test ENGINE=InnoDB;
ERROR 1214: The used table type doesn’t support FULLTEXT indexes
The solution is to remove “FULLTEXT indexes” from the table before converting to InnoDB. To check if the table is setup with FULLTEXT indexes, execute:

mysql> show create table test;
————————
| Table | Create Table
————————
| test | CREATE TABLE `test` (
`col_name` varchar(10) DEFAULT NULL,
FULLTEXT KEY `keyname` (`col_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
If FULLTEXT is setup, the output of the above command will display a line as follows:
FULLTEXT KEY `keyname` (`col_name`)

Now, remove “FULLTEXT” indexes from the table:

mysql> ALTER TABLE test DROP INDEX keyname;

Now, this table can be converted to InnoDB using the following command:

mysql> ALTER TABLE test ENGINE=InnoDB;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0

How to Install & compile Zend Guard Loader

How to Install & compile Zend Guard Loader

The Zend Guard Loader runs PHP scripts that are encoded with Zend Guard. The Zend Guard Loader is a PHP extension that runs outputs created by Zend Guard, which provides an easy way to encode, obfuscate and license PHP code via an Eclipse-based interface or from the command line.

The Guard Loader extension must be installed on each Web server that runs files that were encoded with, or use, Zend Guard licenses.
Note:

You can also use the Zend Optimizer that also includes the Guard Loader extension for code written in PHP 5.2. The Zend Optimizer is available as a free download from PHP Web Application Server – PHP Development tools – PHP Training – Zend.com.

The Zend Guard Loader translates encoded files to a format that can be parsed by the Zend Engine. This runtime process uses the Zend engine as a trigger to start the Zend Guard Loader component. Zend Guard is a separate product available from Zend that provides an easy way to encode, obfuscate and license PHP code via an Eclipse-based interface or from the command line. To view the API, click Zend Guard Loader.

To install it you need to follow the below mentioned steps:

# wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
# tar -zxvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
# cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/local/lib/php

Now after that open php.ini file and put a

zend_optimizer.optimization_level=15
zend_extension=/usr/local/lib/php/ZendGuardLoader.so
restart apache
php -v to check it will show as

# php -v
PHP 5.3.15 (cgi-fcgi) (built: Sep 17 2012 04:07:04)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

Shell Fork Bomb Protection

Shell Fork Bomb Protection

This feature will prevent users with terminal access (SSH or Telnet) from using up the system’s resources and potentially crashing your web server via a malicious attack known as a fork bomb.
Fork bombs work by starting a cascade of small processes that duplicate themselves until the server’s resources are depleted. WHM includes this feature to protect your server against fork bombs.

To enable or disable shell fork bomb protection:

Click Enable Protection or Disable Protection.

After you have enabled shell fork bomb protection, the following limits are available to better protect the server:

Limit Option Description
200000 -c Limits the maximum size of core files created.
200000 -d Limits the maximum size of a process’s data segment.
200000 -m Limits the maximum resident set size.
100           -n Limits the maximum number of open-file descriptors.
8192       -s Limits the maximum stack size.
35          -u Limits the maximum number of processes available to a single user.
200000 -v Limits the maximum amount of virtual memory available for the process.

Note: The “u” option limits bash shell users (default for cPanel users) to 35 processes each.