Archive

Archive for January, 2008

Rsync

January 27th, 2008 Behzad No comments

Rsync is a powerful command that is used to synchronize and transfer files and directories. Rsync is widely used for mirroring Web sites. and transfers only the changes in files, using a clever rsync algorithm. This is a very useful method for backups as it is uses minimal bandwidth and it is also commonly used to keep clustered servers working together. The ending slashes are very important while using rsync. If you are not familiar with how it works simply make sure to have an ending slash on both the source and the destination and it should be fine.

The general form is:

rsync source destination

A few examples are:
rsync -vrplogDtH /old/usr/local/apache/conf /usr/local/apache

That will sync the /old/usr/local/apache/conf/ directory to the /usr/local/apache/conf/ directory on the same server. If you want to use rsync to go between servers then use the following:

rsync -ave ssh root@192.168.0.1:/backup/ /backup/

That will take the backup directory on 192.168.0.1 and copy it to the server the command is run from. The command will also accept a remote destination if you adjust the command line accordingly.

DNS Useful Commands

January 27th, 2008 Behzad No comments

The Domain Name System (DNS) is a distributed, hierarchical database where authority flows from the top (or root) of the hierarchy downward.

When thinking of the structure of the DNS, imagine an inverted tree. Each branch of the tree is within a zone of authority; however, multiple branches of the tree can be within a single zone.

The software (Bind being the most common) that stores domain name information is called a domain name server. A single name server can be authoritative for multiple zones. All zones have a primary master and a secondary master name server that provides authoritative responses for their zones.

If you query a name server not authoritative for a particular zone, that name server will most likely have up-to-date information. This is because zone information propagates throughout the Internet at regular intervals, and name servers cache zone information for which they are not authoritative.

DNS Commands
There are three crucial commands that can put all the DNS information you need at your fingertips. The way to use this article is to try each of the commands listed on a domain name, so you can see what the output looks like.

Zone file database records divide DNS information into three primary types: NS (Name Server) records, MX (Mail Exchange) records, and A (Address) records. NS records indicate the name servers. MX records indicate the hosts that handle e-mail delivery; the priority (pri) number indicates the order in which mail servers are used, with the lowest number receiving the highest priority. The A (Address) records map hostnames to IP addresses, the real names of machines.

host
This is the simplest of the DNS commands. It is a quick way to determine the IP address of a hostname:

: host www.your-domain-name.com

The -a option will return all of the DNS information in verbose format.

: host ?a www.your-domain-name.com

Now that you know the IP address for your-domain-name.com, try a reverse lookup.

: host

dig (domain information groper)
This command gathers and returns DNS information in a format the name server can use directly. You will find it easy to query specific name servers with dig.

You can quickly determine the Name servers of your host or any other host:

: dig ns your-host.com

You can determine the MX records of your domain name:

: dig mx your-domain-name.com

Then you check your website against your host?s name servers:

: dig www.your-domain-name.com @ns.your-host.com

Dig can provide output that is in the same format as the zone file itself. Here is how to get the whole zone file:

: dig any www.your-domain-name.com

Here are the most useful dig query types: dig any (gathers all DNS information), dig ns (gathers name server information), dig mx (gathers mail exchanger information) and dig a (gathers network address information).

The dig command can also do reverse lookups with output formatted for the zone file:

: dig -x

nslookup
You can use this tool as a single line command, or you can use it interactively, which distinguishes it from the other DNS commands. Once you have started nslookup, type set all to list the default options. As with dig you can choose the server (name server) you want to query, and you can decide the type of DNS information on which to focus.

Just as you can issue commands to nslookup interactively, you can also change the initial defaults by starting a .nslookuprc file. The format of the .nslookup is one command per line:

set type=NS
set domain=ns.your-host.com
set timeout=10

Conclusion
These three commands can provide you with most of the information you need about your domain names. They are powerful tools, and this article should provide you enough information to get started or offer a quick refresher if you already use these commands.

How do I increase VE migration timeout in VZAgent configuration?

January 25th, 2008 Behzad No comments

To adjust default VE migration timeout directly in VZAgent configuration it is possible to edit the file /etc/sysconfig/vzagent/vzagent.conf file on Virtuozzo hardware node (in the section hwm/configuration/timeouts/migrate), by default it is set to 1 hour (3600 seconds):

<hwm><configuration>

<timeouts>

<migrate>3600</migrate>

To increase migration timeout it is required to increase value in <migrate> tag, just for example, to increase it up to 2 hours 3600 should be replaced with 7200.

Please note, VZAgent services restart is required to apply new VZAgent configuration in case of adjusting parameters directly in VZAGent configuration file. To restart VZAgent services the following command should be executed on Virtuozzo hardware node:

# vzagent_ctl restart

Update WHM/cPanel Manually

January 25th, 2008 Behzad No comments

cPanel/WHM sould upgrade itself automatically every once in a while; however, if you want to do this manually then just follow these steps:

1) Login to your Server/VPS as root using SSH

2) Run the command: /scripts/upcp -force

3) Restart cPanel: /etc/init.d/cpanel restart

The actual upgrade may take a while, so you will need to be patient.

Load Balancing Servers

January 25th, 2008 Behzad No comments

One server responding to all the incoming HTTP requests for a website might not able to handle all the incoming traffic of a website. This would become more difficult if the website becomes more popular. As a result pages will load slowly and users will have to wait for a long time to view web pages. Due to increase in traffic and connections to website there will be need to upgrade the server and it would be no more cost effective.

To improve the server scalability, more servers are needed to add more scalability and distribute load among the servers which is also called as clustering and load distribution among these servers is called as Load balancing. Load balancing applies to all types of servers including application and database servers.

Load Balancing Mechanism

The load balancing mechanism used for spreading HTTP requests is known as IP Spraying. HTTP traffic needs to be evenly distributed when there are multiple servers in the group. It acts as one server to clients for example an internet browser. “Load dispatcher” and “network dispatcher” are the equipments used for IP spraying. You can simply call them as “Load Balancer”.IP Sprayer redirects HTTP requests to a server in a server cluster. It all depend on the type of IP sprayer involved so that the architecture can provide more scalability, load balancing and overcome all the fail-over requirements.