HiperLogic

Virtualization, High Performance Computing, Healthcare IT, Enterprise Computing

March 2011

You are currently browsing the monthly archive for March 2011.

I was asked today how to perform an application consistent backup of MySQL in a Linux Virtual Machine on VMware for a customer evaluating Veeam Backup.

On Windows, Veeam can do application consistent backups through the Veeam Microsoft Volume Shadow Copy Services (VSS) integration for VSS aware applications. Unfortunately Linux does not have a system like Microsoft Volume Shadow Copy Services (VSS) that allows applications to be made application consistent by backup applications like VMware vDR or Veeam Backup.

A simple workaround is to leverage VMware tools ability to call custom freeze/thaw scripts during a quiesced snapshot to enable customers to do the required application quiescence.

The example below is for MySQL, for other applications you need to know the application specific command to quiesce the application and modify the scripts below appropriately.

Step 1. Make sure VMware Tools are installed in the Linux VM
VMware Tools MUST be installed and should be up to date in your Linux Virtual Machine.
Step 2. Determine how to quiesce the application
To quiesce MySQL we will do a mysqldump to create a transactionally consistent backup of mysql without downtime.

Note the disadvantage of this method is that it takes more space since it creates a copy of the database. Alternatively, If you can stop/start mysql during an off hour backup that is a simple way to quiesce ( no transactions can occur if the database is stopped ) as well. You would stop mysql in the pre-freeze, and start mysql in the post-thaw in that case.

Step 3. Create /usr/sbin/pre-freeze-script
Below are the commands to type at the Linux command shell to create the pre-freeze script which will create a transactionally consistent backup of MYSQL and store the resulting statements in /var/mysqlbackup.todaysdate.sql

The resulting .sql file produced by mysqldump contains a set of SQL INSERT statements that can be used to reload the dumped tables at a later time

cat <<EOF > /usr/sbin/pre-freeze-script
mysqldump --single-transaction --all-databases > /var/mysqlbackup.\`date +"%m%d%y"\`.sql
EOF

Check the above command worked properly by examining the created script.

cat /usr/sbin/pre-freeze-script

The result of the cat command above should look like below

mysqldump --single-transaction --all-databases > /var/mysqlbackup.`date +"%m%d%y"`.sql

Make the script executable

chmod 755 /usr/sbin/pre-freeze-script

Step 4. Create the /usr/sbin/post-thaw-script
In this case we don’t have to call anything in the post-thaw so create an empty script :

  touch /usr/sbin/post-thaw-script
  chmod 755 /usr/sbin/post-thaw-script

Step 5. Enable VMware Tools Quiescence
Now check “Use VMware Tools Quiescence” in Veeam Backup, and Veeam will ask VMware tools to quiesce the VM, and VMware Tools will call /usr/sbin/pre-freeze-script and /usr/sbin/post-thaw-script to create the application consistent snapshot.

After the Veeam backup, login to the VM and validate the backup file with the date of the backup exists:

root@vCentos ~# ls -la /var/mysqlbackup.032411.sql
-rw-r--r-- 1 root root 422120 Mar 24 11:59 /var/mysqlbackup.032411.sql
root@vCentos ~#

You can customize the above procedure for any Linux application that provides a method to quiesce itself.

Tags: , , , ,

If you need to add a domain service account to the local Administrators group on a list of computers, this simple PowerShell script will take file with a list of computer names ( one per line) and add the user to the local Administrators group on all of them.

Usage:

Powershell to Bulk Add a User to Local Admin on Multiple Computers

Powershell to Bulk Add a User to Local Admin on Multiple Computers

The script is below, you must change the string MYDOMAINHERE to whatever your domain is.


function ListAdministrators($Group)
{
  $members= $Group.psbase.invoke("Members") | %{$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)}
  $members
}

function Ping-Server {
   Param([string]$srv)
   $pingresult = Get-WmiObject Win32_PingStatus -Filter  "Address='$srv'"
   if($pingresult.StatusCode -eq 0) {$true} else {$false}
}

if ($args.Length -ne 2) {
 Write-Host "`tUsage: "
 Write-Host "`t`t.\AddToLocalAdmin.ps1 < group or user > <file of machines>"
 Write-Host "`t`tExample: .\AddToLocalAdmin.ps1 FooBarGroup c:\temp\mymachines.txt"
 return
}

#Your domain, change this
$domain = "MYDOMAINHERE"

#Get the user to add
$username = $args[0]

#File to read computer list from
$strComputers = Get-content $args[1]

foreach ($strComputer in $strComputers)
{ 

  if (Ping-Server($strComputer)) { 

      $computer = [ADSI]("WinNT://" + $strComputer + ",computer")
      $Group = $computer.psbase.children.find("administrators")
      # This will list what’s currently in Administrator Group so you can verify the result
      write-host -foregroundcolor green "====== $strComputer BEFORE ====="
      ListAdministrators $Group
      write-host -foregroundcolor green "====== BEFORE ====="

      # Even though we are adding the AD account
      # It is being added to the local computer and so we will need to use WinNT: provider 

      $Group.Add("WinNT://" + $domain + "/" + $username) 

      write-host -foregroundcolor green "====== $strComputer AFTER ====="
      ListAdministrators $Group
      write-host -foregroundcolor green "====== AFTER ====="

   }
   else
   {
      write-host -foregroundcolor red "$strComputer is not pingable"
   }
}

Tags:

HiperLogic will be presenting on How Cloud Computing Transforms IT Operations at the Online Tech Cloud Computing Seminar on March 22nd: Cloud 2 Cloud

Tags:

VMware announced today a new product called vCenter Operations. The one takeaway about this new solution is that it enables the VMware admin to quickly find out what is abnormal in the environment through self-learning technology.

For example, an application owner will come to the VMware team and say “something is not normal with my application, it is slower than normal, what is going on?”.

The VMware admin now has to determine what “normal” is for the application is, determine if the problem is the application or the infrastructure, and package all of this information up to report back to the application owner.

With vCenter Operations a skilled VMware admin can quickly understand what is abnormal to narrow the scope of the issue, quickly identify what the problem and remediate the issue.

vCenter Operations has a very different UI than you may be accustomed to. In the screenshot below, vCenter Operations is reporting on three metrics: Workload, Health, and Capacity:

  1. workload score (0-100) – The amount of resources the objects wants to use compared to the resources the object has.
  2. health score (0-100). How normal is the object behaving based on past historical behavior of the object.
  3. capacity score (0-100). How much capacity do you have on a object, less than 30 days capacity left would be red.

Note I use the word “object”, and object can be many things like a virtual machine etc.

vCenter Operations

Another detail view:

vCenter Operations Detail

vCenter Operations Detail

vCenter Operations is packaged as a virtual appliance and comes in three editions, see below for some the basic differences. For the standard edition pricing starts at $50 per VM (Less than 500 VMs). With standard edition you don’t get access to 3rd party integration, customized dashboards, or AD integration.

vCenter Operations Edition Comparison

Note vCenter Operations still requires the VMware admin to interpret the abnormal metrics and create a plan of action, it does not offer a prescriptive recommendation (yet).

Tags: ,

There is an interesting webpage at the NY Times that allows you to play rock-paper-scissors against a computer that uses 200,000 past rounds against humans in an attempt to defeat you.

A truly random game would be the best offense, since the computer is programmed to reply with a non-random throw based on what a human would do. I thought this would be a fun way to show how you can use PowerShell to create a simple script to create a randomized set of throws to play:

$hand = "rock", "paper", "scissors"
$rand = New-Object system.random
#Just keep repeating this line to get the next throw
$hand[$rand.next(0,3)]

The result after 41 rounds was a PowerShell Win!

Result of PowerShell vs Rock-Paper-Scissors

Result of PowerShell vs Rock-Paper-Scissors

Tags:

There was a recent discussion online on the merits of using VMware High Availability (HA) and Fault Tolerance (FT) to protect an application that had HA and FT baked in. I believe this discussion will start popping up more and more in the near future, many new “cloud scale” applications are coded in such a way to be highly available, scalable, and fault tolerant which alleviates the need for features like Hypervisor level HA and FT.

For example, Google uses a software stack that has allowed them to withstand 1,600 server failures in a 1,800-unit cluster with uninterrupted service. This same distributed model that assumes failure of the underlying resource is how cloud applications are commonly developed today. VMware with their investment in Spring Source has recognized the importance of supporting the next generation of applications that will not be depend on keeping a single OS instance up and running at all costs. The future is going to revolve around applications built and designed to run on unreliable, cheap, expendable resources.

Tags:

© 2006-2010 HiperLogic, LLC.  |  Serving the Ann Arbor, Southeast Michigan, and Ohio region  |  (888)-268-3930  |