Assign more that 8 vCPUs a VM on XenServer 6

Posted on Updated on

XenServer supports more than 8 virtual CPUs in a guest, but the XenCenter GUI interface imposes a hard limit of 8. If you want to use more than 8 VCPUs for a guest, you must do so via the ‘xe’ command line:

xe vm-param-set uuid=your_vms_uuid VCPUs-at-startup=16

 xe vm-param-set uuid=your_vms_uuid VCPUs-max=16

To find ‘your_vms_uuid’, you can use:

xe vm-list name-label=VMname

Where “VMname” is the human readable name you assigned in XenCenter.

It is not recommendedto use more that 8 vCPUs. More vCPUs does not automatically equal more performance, especially if there are multiple VMs running on this XenServer instance. Also realize that a HT CPU does not equal a full extra CPU.

About the only scenario in which it is necessary to assign all of your physical CPUs over to a single guest if you’re doing 1:1 virtualization of an application that has been proven capable of scaling well to the number of CPUs you’re trying to use. Otherwise you’re just causing additional CPU scheduling overhead in the hypervisor.

Creating database in mysql

Posted on Updated on

Login as the mysql root user to create database:

 $ mysql -u root -p

Sample outputs:

Add a database called cars, and then enter:

mysql> CREATE DATABASE taxi1;

Now, the database is created. Use this database with use command:

 mysql> USE taxi1;

Next, create a table called drivers with name, email and id as fields:

 mysql> CREATE TABLE drivers (id INT, name VARCHAR(20), email VARCHAR(20));

 

To display your tables in taxi1 database, type:

mysql> SHOW TABLES;

Sample outputs:

+—————–+

| Tables_in_taxi1 |

+—————–+

| drivers         |

+—————–+

1 row in set (0.00 sec)

 

Finally, add a data i.e. row to table drivers using INSERT statement, run:

 mysql> INSERT INTO drivers (id,name,email) VALUES(1,”raja”,”xyz@abcde.com”);

Sample outputs:

Query OK, 1 row affected (0.00 sec)

Try to add few more rows to your table:

mysql> INSERT INTO drivers (id,name,email) VALUES(2,”kumar”,”kum@efgh.com”);

mysql> INSERT INTO drivers (id,name,email) VALUES(3,”emile”,”emile@ijkl.com”);

To display all rows i.e. data stored in drivers table, enter:

 mysql> SELECT * FROM drivers;

Sample outputs:

+——+——-+—————+

| id   | name  | email         |

+——+——-+—————+

|    1 | raja | xyz@abcde.com  |

|    2 | kumar | kum@efgh.com   |

|    3 | emile   | emile@ijkl.com |

+——+——-+—————+

3 rows in set (0.00 sec)

 

Customizing error messages in apache2

Aside Posted on Updated on

Add this line to
 httpd.conf file – if it is applicable for the entire site
 or
 .htaccess file – if it is applicable to the particular application

(In the above case AllowOverride All or AllowOverride redirect should be present in httpd.conf file)

 errorDocument 404 /error_pages/404.html
In this case, 404 error is getting redirected to 404.html file in error_pages directory.
So create a file called 404.html file in error_pages directory in /var/www
404.html should contain the following
<html><body><h1>It works!</h1>
<p>The requested site is under maintainence.</p>
</body></html>

Redirecting URL requests in Apache2

Posted on Updated on

Add this line to

httpd.conf file – if it is applicable for the entire site

or

.htaccess file – if it is applicable to the particular application

(In the above case AllowOverride All or AllowOverride redirect should be present in httpd.conf file)

redirect /test     http://www.mysite.com

Manual Installation of Tomcat from Zip file on Ubuntu 12.04

Posted on Updated on

 

1)      Visit http://tomcat.apache.org/ to download Tomcat

2)      Unzip it with tar -zxvf Tomcatxxx.tar

                          tar -zxvf apache-tomcat-6.0.16.tar.gz

3)      move the folder to required directory. In my case it is /app/tomcat directory

4)      Now create an user tomcat to run the tomcat service under this username. Also change the directory permissions to tomcat

#useradd tomcat

Or

#adduser tomcat

#chown -R tomcat:tomcat /app/tomcat/

#chmod 0755 /etc/init.d/tomcat

5)      Considering that JRE is already installed, the following two lines should be present in the /etc/environment file

Add these two lines

JAVA_HOME=/usr/local/jdk1.6.0_45

PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/jdk1.6.0_45/bin”

6)      Create a file called tomcat in the following path /etc/init.d/ for auto startup with the following lines in it

export CATALINA_HOME=”/app/tomcat”case “$1” in

start)

tomcat_id=$(ps -ef | grep $CATALINA_HOME | grep -v grep | awk ‘{print $2}’ | head -n 1)

if [ -n “$tomcat_id” ]

then

echo “Tomcat is already Running with PID:” $tomcat_id

else

echo “Starting tomcat from $CATALINA_HOME”

sudo -u tomcat authbind –deep $CATALINA_HOME/bin/startup.sh

fi

;;

stop)

tomcat_id=$(ps -ef | grep $CATALINA_HOME | grep -v grep | awk ‘{print $2}’ | head -n 1)

if [ -n “$tomcat_id” ]

then

echo “Stopping tomcat from $CATALINA_HOME”

sudo -u tomcat authbind –deep $CATALINA_HOME/bin/shutdown.sh

else

echo “Tomcat is not running”

fi

;;

status)

tomcat_id=$(ps -ef | grep $CATALINA_HOME | grep -v grep | awk ‘{print $2}’ | head -n 1)

if [ -n “$tomcat_id” ]

then

echo “Tomcat is Running with PID:” $tomcat_id

else

echo “Tomcat is not Running…….”

fi

;;

*)

echo $”usage: $0 {start|stop|status}”

exit 3

;;

esac

Note:

Install authbind if required by typing apt-get install authbind

7)      Finally apply 0755 permissions to tomcat file

#chown -R 0755 tomcat:tomcat /etc/init.d/tomcat #chmod 0755 /etc/init.d/tomcat 

8)      Now you can start the tomcat using any of the following commands

# sh /app/tomcat/bin/startup.sh # /etc/init.d/tomcat start 

9)      To create a service in ubuntu, install the following utility

 #apt-get install sysv-rc-conf 

10)   Then open the utility and enable the service in all run levels as shown in the screenshot

 # sysv-rc-conf 

11)   Done, tomcat is ready for use.

Free tool to backup VMs on Xenserver Host

Posted on Updated on

Few months back, I came across a fantastic software to backup Xenserver virtual machines without any downtime. It is Xackup from Fungusware. I am using this tool in my production environment. It works fine without any issues.

The features are

  1. It can Backup, Restore or Migrate VMs from Xenserver Hosts.
  2. It takes a snapshot of the VM and then exports the VM in compressed format to the storage. After the backup process, it automatically deletes the snapshot file from the server.
  3. It takes the differential backup. So it saves space on storage end.
  4. Email alerts let us know the status and the whole background process of the backup and restoration.
  5. It can migrate or (or clone) a Virtual machine between XenServers without having to use an intermediary storage medium.
  6. You can schedule your Virtual Machines to be backed up on a given schedule
  7. Xackup attempts to keep you informed of its progress at all times.

It uses Simple mechanism as follows:

It don’t use any propriety storage formats, backups are stored as compressed archives and use the standard XenServer methods to do all the work. That means if something should happen to go wrong, we always have the ability to manually intervene and make sure your VMs are always safe.

Further details can be found at http://www.fungusware.com/products/xackup/