HostwareSupport-Linux Hosting technical support for cPanel, Plesk, Directadmin servers

Linux Hosting technical support for cPanel, Plesk, Directadmin and No control panel servers offers and listing
http://hostwaresupport.com/

Oct 28, 2010

How to read your VPS's /proc/user_beancounters in details

If you are having trouble running or installing applications on your VPS, one good way to find the source of the problem is to use the special file /proc/user_beancounters which shows the resource control information about running virtual environments.

To view /proc/user_beancounters on your VPS, login to your VPS via SSH.
In the SSH Terminal you will type:

cat /proc/user_beancounters

Then hit Enter.

After you hit Enter, you should see something that looks similar to the following:



That is your /proc/user_beancounters file.

If you look at the top line where you see uid to the left of it, that line is the field that displays the numeric identifier of the Virtual Environment.

The field held shows the current counter for the Virtual Environment (resource "usage").
The field maxheld shows the counter's maximum for the lifetime of the Virtual Environment. The lifetime of the Virtual Environment is usually just the time between the start and stop of your VPS.
The barrier and limit fields are resource control settings. For some parameters only one of them may be used, for others, both. These fields may display resource limits or guarantees, and the exact meaning of them is parameter-specific.
The field failcnt shows the number of refused "resource allocations" for the lifetime of the Virtual Environment. Failcnt counter is increased only for accounting parameters.The field failcnt is the field you will be looking at for errors.

If you look at the example above, you will see that the parameter kmemsize has a failcnt of 129. That is because in this example, the VPS did not have enough memory available to install an application. Therefore, the failcnt counter recorded the 129 memory failures, next to the parameter kmemsize in it's /proc/user_beancounters file. We know the problem was memory since the failcnt next to kmemsize increased after trying to install the application.

In this article, we will concentrate on the following parameters:

* kmemsize
This is the parameter that shows the size of unswappable memory, allocated by the operating system kernel. If the failcnt value increases on this parameter, most likely there is not a sufficient amount of memory available to run the application.
* lockedpages
This is process pages not allowed to be swapped out. The size of these pages is also accounted into kmemsize. Note that typical server applications like Web, FTP, and mail servers do not use memory locking features. If the failcnt value increases on this parameter, most likely there is not a sufficient amount of memory available to run the application.
* privvmpages
This is the memory allocation limit. This parameter allows controlling the amount of memory allocated by applications. If the failcnt value increases on this parameter, most likely there is not a sufficient amount of memory available to run the application.
* shmpages
This is the total size of the shared memory (IPC, shared anonymous mappings and tmpfs objects). These pages are also accounted into privvmpages. Its configuration affects functionality and resource shortage reaction of the applications in the given Virtual Environments only. Again, If the failcnt value increases on this parameter, most likely there is not a sufficient amount of memory available to run the application.
* physpages
This is the total number of RAM pages used by processes in this virtual environment. Unlike other accounting methods, the sum of physpages usage for all Virtual Environments yields to the total number of pages used in the system by all Virtual Environments. This is currently an accounting-only parameter. It does not set any limits or barriers. If the failcnt value increases on this parameter, most likely there is not a sufficient amount of memory available to run the application.
* vmguarpages
This parameter controls how much memory is available to the Virtual Environment. The vmguarpages parameter does not have its own accounting. The current amount of allocated memory is accounted into another parameter (privvmpages). If the failcnt value increases on this parameter, most likely there is not a sufficient amount of memory available to run the application.
* oomguarpages
This is the guaranteed amount of memory in case the memory is "over-booked" (out-of-memory kill guarantee). The failcnt counter of oomguarpages parameter increases when a process in this Virtual Environment is killed because of an out-of-memory situation, but not when the barrier is reached. Again, If the failcnt value increases on this parameter, most likely there is not a sufficient amount of memory available to run the application.
* numfile
This is the number of "files" in use, including real files, sockets and pipes. The configuration of this parameter affects functionality and resource shortage reaction of applications in the given Virtual Environment only. If the failcnt value increases on this parameter, you are trying to have too many files open at once.

Oct 27, 2010

How to reset Kloxo password

How To reset the Kloxco admin password through Shell..
Try the following step it will help you..


Fist step:

Go to the Directory :

# cd /usr/local/lxlabs/kloxo/httpdocs

Then apply the command :

# lphp.exe ../bin/common/resetpassword.php master admin

(at admin you can change any name what password you need...)


You are done..Try login your kloxo..

Oct 7, 2010

Mysql-web.linux command

How to Back Up and Restore a MySQL Database..

If you're storing anything in MySQL databases that you do not want to lose, it is very important to make regular backups of your data to protect it from loss. This tutorial will show you two easy ways to backup and restore the data in your MySQL database. You can also use this process to move your data to a new web server.


Back up From the Command Line (using mysqldump)

If you have shell or telnet access to your web server, you can backup your MySQL data by using the mysqldump command. This command connects to the MySQL server and creates an SQL dump file. The dump file contains the SQL statements necessary to re-create the database. Here is the proper syntax:

# mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql]


  • [uname] Your database username
  • [pass] The password for your database (note there is no space between -p and the password)
  • [dbname] The name of your database
  • [backupfile.sql] The filename for your database backup
  • [--opt] The mysqldump option
For example, to backup a database named 'Tutorials' with the username 'root' and with no password to a file tut_backup.sql, you should accomplish this command:

# mysqldump -u root -p Tutorials > tut_backup.sql

This command will backup the 'Tutorials' database into a file called tut_backup.sql which will contain all the SQL statements needed to re-create the database.

With mysqldump command you can specify certain tables of your database you want to backup. For example, to back up only php_tutorials and asp_tutorials tables from the 'Tutorials' database accomplish the command below. Each table name has to be separated by space

# mysqldump -u root -p Tutorials php_tutorials asp_tutorials > tut_backup.sql

it is necessary to back up more that one database at once. In this case you can use the --database option followed by the list of databases you would like to backup. Each database name has to be separated by space.

mysqldump -u root -p --databases fresh_linuxweb > content_backup.sql

If you want to back up all the databases in the server at one time you should use the --all-databases option. It tells MySQL to dump all the databases it has in storage.

# mysqldump -u root -p --all-dbinserver > alldb_backup.sql

The mysqldump command has also some other useful options:

--all-drop-tables Tells MySQL to add a DROP TABLE statement before each CREATE TABLE in the dump.

--no-data: Dumps only the database structure, not the contents.

--add-locks: Adds the LOCK TABLES and UNLOCK TABLES statements you can see in the dump file.

The mysqldump command has advantages and disadvantages. The advantages of using mysqldump are that it is simple to use and it takes care of table locking issues for you. The disadvantage is that the command locks tables. If the size of your tables is very big mysqldump can lock out users for a long period of time.

Back up your MySQL Database with Compress

If your mysql database is very big, you might want to compress the output of mysqldump. Just use the mysql backup command below and pipe the output to gzip, then you will get the output as gzip file.

# mysqldump -u [uname] -p[pass] [dbname] | gzip -9 > [sqlfile.sql.gz]

If you want to extract the .gz file, use the command below:

# gunzip [backupfile.sql.gz]

Restoring your MySQL Database

Above information is we backup the Tutorials database into tut_backup.sql file. To re-create the Tutorials database you should follow two steps:

  • Create an appropriately named database on the target machine
  • Load the file using the mysql command:
# mysql -u [uname] -p[pass] [db_to_restore] < [sqlbackupfile.sql]

Have a look how you can restore your tut_backup.sql file to the Tutorials database.

# mysql -u root -p Tutorials <>

To restore compressed backup files you can do the following:

If you need to restore a database that already exists, you'll need to use mysqlimport command. The syntax for mysqlimport is as follows:

# mysqlimport -u [uname] -p[pass] [dbname] [backupfile.sql]

Backing Up and Restoring using PHPMyAdmin

It is assumed that you have phpMyAdmin installed since a lot of web service providers use it. To backup your MySQL database using PHPMyAdmin just follow a couple of steps:

  • Open phpMyAdmin.
  • Select your database by clicking the database name in the list on the left of the screen.
  • Click the Export link. This should bring up a new screen that says View dump of database (or something similar).
  • In the Export area, click the Select All link to choose all of the tables in your database.
  • In the SQL options area, click the right options.
  • Click on the Save as file option and the corresponding compression option and then click the 'Go' button. A dialog box should appear prompting you to save the file locally.

Restoring your database is easy as well as backing it up. Make the following:

  • Open phpMyAdmin.
  • Create an appropriately named database and select it by clicking the database name in the list on the left of the screen. If you would like to rewrite the backup over an existing database then click on the database name, select all the check boxes next to the table names and select Drop to delete all existing tables in the database.
  • Click the SQL link. This should bring up a new screen where you can either type in SQL commands, or upload your SQL file.
  • Use the browse button to find the database file.
  • Click Go button. This will upload the backup, execute the SQL commands and re-create your database.
============================================================================


Sep 30, 2010

Mysql Help : Table Maintenance and Repair How to

mysqlcheck – a table maintenance and repair program

mysqlcheck must be used when the mysqld server is running, whereas myisamchk (similar in function to mysqlcheck) should be used when it is not. The benefit of using mysqlcheck is that you do not have to stop the mysql server to check or repair your tables.

mysqlcheck uses the SQL statements like CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE depend on the mysqlcheck options.

There are three general ways to invoke mysqlcheck:

#mysqlcheck [options] db_name [tables]
#mysqlcheck [options] –databases DB1 [DB2 DB3...]
#mysqlcheck [options] –all-databases

If you do not name any tables or use the –databases or –all-databases option, entire databases are checked.

mysqlcheck Option Reference:

–analyze, -a
Analyze the tables

–all-databases, -A
Check all tables in all databases. This is the same as using the
–databases option and naming all the databases on the command line

–check, -c
Check the tables for errors.

–check-only-changed, -C
Check only tables that have changed since the last check or that
have not been closed properly

–quick, -q
If you are using this option to check tables, it prevents the check
from scanning the rows to check for incorrect links. This is the
fastest check method.

If you are using this option to repair tables, it tries to repair
only the index tree. This is the fastest repair method

–fast, -F
Check only tables that have not been closed properly

–extended, -e
If you are using this option to check tables, it ensures that they
are 100% consistent but takes a long time

If you are using this option to repair tables, it runs an extended
repair that may not only take a long time to execute, but may
produce a lot of garbage rows also!

–optimize, -o
Optimize the tables

–force, -f
Continue even if an SQL error occurs

–repair, -r
Perform a repair that can fix almost anything except unique keys
that are not unique.

–auto-repair
If a checked table is corrupted, automatically fix it. Any necessary repairs are done after all tables have been checked

Sep 25, 2010

Mysql dump error Re: ERROR 1044 (42000): Access denied for user

Mysql dump error Re: ERROR 1044 (42000): Access denied for user

When i tried to create the backup .sql file of database through shell with mysqldump command i got the following error:

Mysqldump error:
Re: ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'name'

This error mean that the problem with lock table into the database of that user so simply fetch the following command to resolve.
the issue..
# mysqldump --skip-lock-tables -u mysqluser -p password mysqldbname > mysqlfile.sql

After issue this command it will ask you the password, so provide there mysql Database password there after it will take minimum 30 min to create databse.sql file ( it's depend on database size..)

Note: make sure that at which directory you fired this command .sql file location should be the same

Sep 21, 2010

Spamd Failed error message in Cpanel.

Server experienced server overload problem. I restarted server, but after that after each 5 minutes i receiving error message:

spamd failed @ Sat sep 22 8:10:28 2010. A restart was attempted automagically.
Service Check Method: [check command]

Cmd Service Check Raw Output: Spamd is not running
-----------------------------------------------------------------------------------------------------------------------------------------------

You can simply use command
# /scripts/upcp --force

# /etc/init.d/cpanel restart

after that you can check the spamd status.. and everything should be fine for you..
following to check if spamd is running & restart:

# /scripts/restartsrv_spamd --status

# /scripts/restartsrv_spamd

It will work for you..! :-)

Email error : 110 Can't open SMTP stream

If you are getting following error while sending emails from squirrelmail.

---------------------------------------------------------------------------
Message not sent. Server replied:

Connection timed out
110 Can't open SMTP stream.
-----------------------------------------------------------------------------

If above case if you are having shell access then login to your server with root user, then edit
config file and do the changes as given below.

Code should be edited into :

# vi /usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php

$useSendmail = false;
to:
$useSendmail = true;

restart the cpanel and exim service.

============================================================
Refresh the squirrelmail mail and check ..

Done..

Aug 3, 2010

IP Got blacklisted how to solve.. Directadmin..

IP got blacklisted in Direct Admin server...How to solve..

That means that you've had too many failed login attempts or accesses
To remove yourself from the blacklist, edit:

# /usr/local/directadmin/data/admin/ip_blacklist

and remove your IP from the list.
If you wish to ensure you never get blacklisted, you can create and add your IP to the file:

/usr/local/directadmin/data/admin/ip_whitelist

One IP per line.

The setting that controls how many attempts you get can be changed in:
Admin Level -> Admin Settings -> Blacklist IPs for excessive login attempts

don't usually recommend any value lower than 10. This is because even loading the login page counts as a failed login attempt, so if you set a low number, you'll be more likely to blacklist yourself.

Jul 26, 2010

how to optimize apache?

Apache Default connection Limit

Apache by default is limit to server not more than 256 requests per second, so you should do a litle optimization by installing a module and a few configuration of that module to make apache enable to handle more than 256 requests per second.The reason is because to be able to handle all of the request on every server without overloading or crashing server to run on every even simple servers.So if your apache wasn’t configured properly on your powerful server, then by reaching its limit on maxClients , your apache web server will go down repeatedly .follow the following solution to optimize your apache web server:

1-Compiling Apache with needed extra Module

First you must recompile apache with mpm_perfork and if you have cpanel there is an option to add mod_prefork in the easy apache update so add that.This module has been installed and tested on apache running on Centos Linux server.

2 Edit Confiugration of Apache mpm_prefork Module

After recompiling is complete you should now edit this module configuration.You have two choices, whether to create sepprated configuration file and include it in httpd.conf or edit httpd.conf directly that I myself suggest external configuration.I will train both.

2-1 Create External configration file

# nano /etc/httpd/conf/highperformance.conf

If somthing failed due to using the default highperformance.conf then create another file let say highpreformance2.conf , #

nano /usr/local/apache/conf/highpreformance2.conf

2-2 Including configration in httpd.conf

open httpd.conf

nano /usr/local/apache/conf/httpd.conf

* and add this line that contain inclusion of external config file

Include "/usr/local/apache/conf/highperformance.conf"

2-3 Or Editing httpd.conf directly

or you can also directly edit the httpd.conf instead of creation of external file and include it in httpd.conf

Include "/usr/local/apache/conf/highperformance2.conf"

* nano /usr/local/apache/conf/httpd.conf

2-3 Writing your custom prefork configration

After opening the httpd.conf or seprated configration file edit the prefork directives or if “” does not exist add the following completely to it:

ServerLimit 2000

KeepAlive On

KeepAliveTimeout 60

MaxClients 1600

MaxSpareServers 200

MinSpareServers 50

3 Prevent Apache configration from being overwritten

After that you edit apache configration “httpd.conf” directly or included seprated configration then you should run the following command to prevent any changes or overwritten that would be occure to the config with cpanel:

4 Restart Apache for the Changes Take Effect

You are done now but After all modification to apache configration for the changes take effect you need to restart apache webserver

to do so run the following command # /etc/init.d/httpd restart

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------