Saturday, 30 November 2013

Xenserver VM force reboot not working?

xe vm-shutdown force=true vm=
xe vm-reset-powerstate force=true vm=



Log in to the host
Get the UUID of the VM that is hung
Run list_domains to get the domain ID of the VM
Run a destroy_domain on the domain ID
Now do a force reboot of the VM
Example CLI steps

xe vm-list name-label=vm001
list_domains|grep 6512c54b-4f3f-6737-3bc7-68b377f15a6a
/opt/xensource/debug/destroy_domain -domid 450
xe vm-reboot force=true vm=vm001
The VM should now be up and running again.

Xenserver 6.1 CLI commands specific for Storage Migration





Check SR uuid
xe sr-list name-label=mystorage
List disks for vm
xe vm-disk-list vm=myvmname
List specific VDI
xe vdi-list name-label=myvdiname
offline migrate disk
xe vdi-copy sr-uuid=mystorageuuid uuid=myvdiuuid
live migrate disk
xe vdi-pool-migrate sr-uuid=mystorageuuid uuid=myvdiuuid
check copy task
xe task-list name-label=VDI.copy
check migrate task
xe task-list name-label=VDI.pool_migrate 

Change Master

xe pool-designate-new-master host-uuid=`xe host-list name-label=HOSTNAME --minimal`

XenServer Command Line Commands

Find out name of VMs running on a specific host

xe vm-list resident-on=`xe host-list name-label=HOSTNAME --minimal`|grep name-label|cut -f9- -d" "

Thursday, 7 November 2013

[Howto Fix] Table './eximstats/sends' is marked as crashed and should be repaired

mysql> repair table eximstats.sends;


mysqlcheck -u root --check auto-repair --optimize all-databases

How to check last reboot date and time in linux servers

You can check the last reboot date and time in linux servers by using the following commands.
# who -b
#last reboot

Command to check load in all the VPS in a nodes

vzlist -o hostname,laverage,veid

HOSTNAME         LAVERAGE       VEID

Redirect Rule not working

We faced an issue recently where a redirect rule was not working irrespective of correctly specifying in .htaccess file. We checked in several ways but the issue was not resolved. Finally, my fellow admin suggested we add it directly in the virtual host in apache config file of the domain. And it worked!!!!.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^webmail.yourdomainname.com
RewriteRule ^/(.*)$https://www.google.com/a/yourdomainname.com/$1  [L,R=301]

How to find max apache connections to a domain from IPs

You can use the following script to determine the IP/IPs from which maximum apache connections were made to the domain.

less /usr/local/apache/domlogs/domain.com | awk ‘{print $1}’ | sort | uniq -c | sort -n

use tcpdump command to check connections to port 80

You can use the following command to get the connections to port 80:
tcpdump -nn ‘tcp[13] == 2′ and port 80 -c 100 -i any

vzquota : (error) quota file is corrupted

If you get error “vzquota : (error) quota file is corrupted”

Use below commands,

# vzquota off 5000

vzquota : (error) quota file is corrupted

# vzquota drop  5000

# vzctl start 5000
Starting container …
Initializing quota …

Now wait for quota to get recreated

How to install iftop in Linux servers

iftop is a command line tool that shows a list of active network connections between local host and any remote host, sorted by their bandwidth usage. The list of top-ranking network connections (in terms of bandwith usage) is periodically refreshed in a text-based user interface. Using iftop, you can visually check the bidirectional bandwidth usage of different network connections in real time. In order to install iftop on Linux, follow the instructions below.

If you would like to build and install the latest version of iftop manually, do the following.
$ yum -y install ncurses-devel libpcap-devel
$ wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
$ tar xvfvz iftop-0.17.tar.gz
$ cd iftop-0.17
$ ./configure
$ make
$ make install

How to clear eximstats db

If the size of your eximstats database is getting large, you can do the following steps to clear it.

Login to mysql

mysql

mysql> use eximstats
mysql> delete from sends;
mysql> delete from smtp;
mysql> delete from failures;
mysql> delete from defers;

You can also use the following steps.

mysqladmin drop eximstats

mysqladmin create eximstats

mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql