MyTrueHost launched Web Hosting for Indian clients just in Rs 60/Month with various payment options(netbanking, debit card, credit card,cash card or paypal).
Please Visit at https://www.mytruehost.in

DNS load balancer

Load balancing via DNS is achieved by assigning more than one IP address to the same name. For example, to balance the load on http requests for the site example.com, we would add more than one IP address, say 3, to the site. So the site can be accessed with any of the IP address.

The order in which the nameserver answers the dns query for that site is configured by setting ‘rrset-order’ in named.conf file.

For example, the configuration will return A records in round-robin order.

rrset-order {
class IN type A name “*” order cyclic;
};

Other options are,
fixed    – returns A record in the order they are defined in the zone file
random – returns A record in some random order

Here is an example of rrset-order set in cyclic way.

bash-3.00$ dig +short example.com @localhost
192.168.1.1
192.168.1.2
192.168.1.3
bash-3.00$ dig +short example.com @localhost
192.168.1.3
192.168.1.1
192.168.1.2
bash-3.00$ dig +short example.com @localhost
192.168.1.2
192.168.1.3
192.168.1.1
bash-3.00$ dig +short example.com @localhost
192.168.1.1
192.168.1.2
192.168.1.3
bash-3.00$

As you may see, the IP returned is being changed cyclically. And usually the client querying the nameserver will use only the first IP address. So by adding more than one IP address with proper TTL value, we can achieve primitive load balancing via DNS.

 

 

WhoIS Domain Name Status Codes

What does the Status of my Domain name mean ? There are 23 domain name status codes that you may come across when using WHOIS. Most of these domain name status codes are variations of a few basic states. The following is a complete list of domain name status codes along with explanations/definitions for each code. This mainly applies for .com, .org, .net, .info, .biz, and .ca domains.



DOMAIN NAME STATUS CODES FOR .COM AND .NET 
These are the 8 domain name status codes used for COM and NET domains :

ACTIVE

This is the normal state for a domain name. The domain is functional and can be renewed. Domains that are active can be used for Web sites, for email, or to register name servers. The domain will be included in the zone if the domain has been delegated to at least one name server.
REGISTRAR-HOLD

The domain has been placed on hold by the registrar and cannot be used. The domain can not be modified or deleted. The domain has been expired but can be renewed without a penalty fee. The domain will not be included in the zone.
REGISTRY-HOLD

The domain has been placed on hold by the registry and cannot be used. The domain will not be included in the zone until it’s renewed. REGISTRY HOLD status lasts for a period of 40 calendar days after the day the domain has expired.
REGISTRAR-LOCK

The registrar, often at the request of the domain registrant, has locked down the domain so that its settings cannot be modified. The domain can be renewed. The domain will be included in the zone.
REGISTRY-LOCK

The registry has locked down the domain so that its settings cannot be modified or deleted by the registrar. The domain can be renewed.
RedemptionPeriod

The domain has expired and the registry is waiting for 30 days as a precautionary measure before releasing it. The domain can not be modified or purged; it can only be restored which would require the domain owner to pay a redemption/penalty fee as well as the renewal fee to renew the domain. Any other registrar requests to modify or otherwise update the domain will be rejected.
PendingRestore

The registry sets this status after a registrar requests restoration of a domain that is in REDEMPTIONPERIOD status. The domain will be included in the zone. Registrar requests to modify or update the domain will be rejected.

The domain will be held in this status while the registry waits for the registrar to provide required restoration documentation. The domain status will be set to ACTIVE only if the registrar provides documentation to the registry within 7 calendar days to confirm the restoration request.
PendingDelete

The domain expired 75 days ago and the registry is about to erase it. The registry sets this status after a domain has been set in REDEMPTIONPERIOD status and the domain has not been restored by the registrar. A domain remains in this status for five days before it is deleted. The domain will not be included in the zone.

Once in this status all registrar requests to modify or otherwise update the domain will be rejected. Once purged, the domain will be available to the public for registration.




DOMAIN NAME STATUS CODES FOR .ORG, .BIZ, .US, .INFO, AND .NAME 

These are the 15 domain name status codes used for ORG, BIZ, US, INFO, and NAME domains:


CLIENT_DELETE_PROHIBITED

The registrar has locked the domain so that it cannot be deleted.
SERVER_DELETE_PROHIBITED

The registry has locked the domain so that it cannot be deleted.
CLIENT_HOLD

The registrar has placed the domain on hold, and it cannot be used.
SERVER_HOLD

The registry has placed the domain on hold, and it cannot be used.
CLIENT_RENEW_PROHIBITED

The registrar has locked the domain so that it cannot be renewed.
SERVER_RENEW_PROHIBITED

The registry has locked the domain so that it cannot be renewed.
CLIENT_TRANSFER_PROHIBITED

The registrar has locked the domain so that it cannot be transferred to another registrar.

SERVER_TRANSFER_PROHIBITED

The registry has locked the domain so that it cannot be transferred to another registrar.
CLIENT_UPDATE_PROHIBITED

The registrar has locked the domain to prevent its settings from being changed.
SERVER_UPDATE_PROHIBITED

The registry has locked the domain to prevent its settings from being changed.
INACTIVE

The domain cannot be used because there is a problem with the name servers that were entered for it, or name servers have not been entered.
OK

The domain is active and can be used for Web sites, for email, or to register name servers.
PENDING_DELETE

The registration for the domain is about to be deleted by the registry, as when the domain expires.

PENDING_TRANSFER

The domain is in the process of being transferred from one registrar to another. It may not be modified during this period.
PENDING_VERIFICATION

The registry is in the process of creating the domain record.

MySQL Socket Error in phpMyAdmin

While accessing phpMyAdmin, you may get the following error.

#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)

This is due to the missing socket file in the location /tmp.

The socket path which is specified in the phpMyAdmin configuration file is /tmp/mysql.sock.

$ vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php
cfg[‘Server’][‘socket’]         = ‘/tmp/mysql.sock’;

If mysql.sock is missing in /tmp, then create a link to the mysql.sock file in /var/lib/mysql.

$ ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

There is also another fix for this issue.

1. Open the phpMyadmin config file “config.inc.php”.vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

2.Locate the line:

$cfg[‘Servers’][$i][‘host’]          = ‘localhost’;

3.Replace ‘localhost’ with ‘127.0.0.1’ and save.

$cfg[‘Servers’][$i][‘host’]          = ‘127.0.0.1’;

This will also fix the issue.

 

phpMyAdmin Error: Cannot start session without errors

If we get an error given below while accessing phpMyAdmin.

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.

Inference

By looking into the error, we expect that there can be error in writing session files. Either the owner do not have ‘write’ permission or the owner is different.

Solution

Normally tmp directories are used to dump sessions. And phpMyAdmin has its own tmp folder. Check the permission and ownership of this folder. Change it to the following

Location : /var/cpanel/userhomes/cpanel-phpmyadmin

$ cd /var/cpanel/userhomes/cpanel-phpmyadmin

1) Permission of tmp must be 700

$ chmod 700 -R tmp

2) Ownership must be cpanel-phpmyadmin

$ chown cpanel-phpmyadmin: -R *

The output should look similar to as given below

$  ll /var/cpanel/userhomes/cpanel-phpmyadmin/
total 16
drwx–x–x    4 cpanel-phpmyadmin cpanel-phpmyadmin     4096 Mar 10 23:56 ./
drwx–x–x    5 root     root         4096 Mar 10 23:53 ../
drwxr-x—    2 cpanel-phpmyadmin cpanel-phpmyadmin     4096 Mar 10 23:53 mail/
drwx——    2 cpanel-phpmyadmin cpanel-phpmyadmin     4096 Mar 10 23:56 tmp/

 

PhpMyAdmin error – “The local MySQL server’s socket is not correctly configured”

First of all check whether MySQL is running or not using the following command:

ps uax | grep mysql

If MySQL is running then, find the location of the socket file created by MySQL. Most probably it will be at “/var/lib/mysql/mysql.sock“. But when PHP communicates with MySQL server in the same host, it uses a socket file and looks for it at “/tmp/mysql.sock“.

Hence to fix the issue, create a symbolic link between these two socket files using the following command.

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

This will fix the issue.

 

Warning message in PhpMyAdmin after upgrading MySQL version to 5 In cPanel server.

In cPanel server after upgrading MySQL version to 5, PhpMyAdmin shows a warning message as given below

Your PHP MySQL library version 4.1.22 differs from your MySQL server version 5.0.45

CPanel’s internal PHP is not compiled with MySQL 5. That is why you are facing this issue. In order to fix this, perform the following steps.

1) Run the script /scripts/makecpphp
2) Copy the PHP binary inside /var/cpanel/3rdparty//bin/  to  /usr/local/cpanel/3rdparty/bin/

That will fix the problem.

 

Using encrypted passwords in mysql

It is a good idea to store passwords in encrypted forms in mysql databases. Function MD5() is a good option to encrypt the passwords. You can use this function in the mysql codes to encrypt the passwords. There may be some situations that we may need to reset the password stored in encrypted form, then also you can use the same MD5() function.

Here is one such situation. One customer sets his password in a table say ‘access’.

—————————————

mysql> select * from access;
+----------+----------------------------------+
| userid | passwd |
+----------+----------------------------------+
| testuser | c03d38cc11d91bb813351fb7985adae9 |
+----------+----------------------------------+
1 row in set (0.01 sec)

—————————————

 

What happens if he forgot that password ?? We have no option to decrypt the password, so what we can do is to reset the password right?. Here it goes..

We can reset the new encrypted password using the command below.

mysql> update access set passwd=MD5('newpassword') where userid='testuser';

this will set the password new password in MD5 encrypted form.

For example if we want to reset the password as ‘redhat’ then just give the command.

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

mysql> update access set passwd=MD5(‘redhat’) where userid=’testuser’;

Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0

mysql> select * from access;
+----------+----------------------------------+
| user | passwd |
+----------+----------------------------------+
| testuser | e2798af12a7a0f4f70b4d69efbc25f4d |
+----------+----------------------------------+
1 row in set (0.00 sec)

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

Here 'e2798af12a7a0f4f70b4d69efbc25f4d' is the MD5 encrypted form of 
redhat.

InnoDB: Operating system error number 13 in a file operation.

You might come across with following error while starting mysql.

-----------------------------------
071027 7:43:13 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
071027 07:43:13 mysqld ended
-----------------------------------

Resolution: This error may mean mysql does not have privilege to access database directory. (/var/lib/mysql)

Giving the required privilege will fix this error.

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

chown -R mysql.mysql /var/lib/mysql

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

Disk full error in MySQL logs

Disk full error in MySQL logs.

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

81218 14:53:40 [ERROR] /usr/libexec/mysqld: Disk is full writing ‘/tmp/#sql_5047_21.MYI’ (Errcode: 28).

Waiting for someone to free space... Retry in 60 secs
-------------------

This occurs when /tmp runs out of space. Check the size of /tmp partition. It should be atleast 3 times as the size of largest table.

Execute following query to list tables with large size.

-------------------
mysql>SELECT concat(table_schema,'.',table_name),concat(round(table_rows/1000000,2),'M') rows,
concat(round(data_length/(1024*1024*1024),2),'G') DATA,
concat(round(index_length/(1024*1024*1024),2),'G')idx,
concat(round((data_length+index_length)/(1024*1024*1024),2),'G') total_size,
round(index_length/data_length,2) idxfrac FROM 
information_schema.TABLES ORDER BY data_length+index_length DESC LIMIT 10;
-------------------
Solution

MySQL uses an environment variable “TMPDIR” to store temporary files. If you don’t have TMPDIR set in my.cnf, MySQL uses the system default, which is normally /tmp, /var/tmp, or /usr/tmp.

So set “TMPDIR” as any directory with sufficient size and restart MySQL.

Eg:-

TMPDIR=/backup/mysqltemp

 

Unable to start Mysql after its Downgrade

This issue usually happens after the mysql downgrade from version 5 to 4.

The error will be like:

ERROR 2002: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

If you check further, you can see charset issue related with mysql (charset #83) in the /var/lib/mysql/HOSTNAME.err file.

You can fix this issue by appending the below line in file “/usr/share/mysql/charsets/Index”

cp1251 83

Restart the mysql service after this modification.