Backing up and restoring the vCenter Server Appliance 6 database

One extremely important advantage of the VMware vCenter Server Appliance (VCSA) is its native PostgreSQL (vPostgres) database. With the embedded database and VCSA, it is now possible to support installations which scale to the maximum capability of vCenter, without additional Operating System or Database licensing costs.

Incumbent with the use of VCSA, however, comes a certain degree of responsibility for backing up the PostgreSQL database embedded with the vCenter Server Appliance. A good backup of the VCSA database makes the following tasks much easier:

  • In-place restore of VCSA database
  • Migration to a different installation of VCSA
  • Protection of vCenter tasks & events for auditing purposes

The process is actually very simple and detailed in VMware KB: 2091961, however typical to VMware, there are few actual procedural details which might help an admin who was not intimately familiar with Linux procedures, for example:

  • How do you create the folder you want to keep database backups on the VCSA?
  • How do you transfer the vCenter vPostgres backup and restore package linux_backup_restore.zip to the VCSA?
  • How do you extract a ZIP archive on a Linux system?
  • How do you retrieve the database backup from the VCSA once it is created?

I will answer these questions in a simple, step-by-step procedure with screenshots and suggestions for applications and settings to use in the process.

Preparing to back up the vCenter Server Appliance (6.X) Database

Open the VMware KB: 2091961 and scroll down to locate the attachment: linux_backup_restore.zip

Save the file to an appropriate folder on your local Windows system

Install WinSCP

Now, if you don’t already have it installed, go get the WinSCP Installation Package. WinSCP is free and one of the most useful utilities with vSphere in general, but there are some WinSCP settings specific to vSphere and the VCSA.

Get the Installation Package so you can save settings specific to your environment

Run as administrator

image005

Choose your language and then: OK

Next

Accept and then Install

Choose to donate and/or Finish

Enable SSH on the VMware vCenter Server Appliance 6

Using a vSphere Client, open a Virtual Machine Remote Console window to your VCSA installation to make sure SSH is enabled.

image010

 

This works just like it does in ESXi:, press F2 to log-in

The password you specify here will be the OS password you set when installing the VCSA.

Using the up/down arrow on your keyboard, scroll down to: Troubleshooting Mode Options then press: Enter

Now, using the up/down arrow, highlight: Enable SSH and press: Enter to toggle SSH for your VCSA installation. NOTE: it is not necessary at this time to enable the BASH Shell, we will do that from Putty

When set correctly, this is how it looks:

Press: Esc to exit

Log in to the vCenter Server Appliance Linux console as root

Open Putty (I am going to take for granted that you already have this one!) and type in the IP address of your VCSA installation (in my example above, it is: 192.168.153.110)

Yes to accept

Enter the username: root and the password that you set for your OS installation.

Now, type (or copy & paste) the two commands to Enable BASH Access and Launch BASH Shell on your VCSA

You will find yourself at the root of the VCSA installation

Now, create a folder to store the PostgresSQL backups, at least until you are able to transfer them off the system. Run the command: mkdir db_backups

Now, list that folder with permissions by typing: ls –la to list the root folder

We can now see the permissions for: db_backups as: drwx (or just rwx for the User)

The Linux permissions listing works as follows:

Read Write eXecute Read Write eXecute Read Write eXecute
d r w x

so the fact that our directory “db_backups” shows “drwx” means that the user (that’s us) has Read, Write and eXecute on this folder.

Change directory into the: db_backups folder

Connecting to VCSA with WinSCP

Using WinSCP successfully with the VMware vCenter Server Appliance requires one of two things to occur:

1.Reconfigure VCSA

–OR-

2.Reconfigure the connection on WinSCP

I universally choose to re-configure WinSCP to work with my vCenter Appliance!

Enter your basic connection parameters in WinSCP and click: Advanced

Now choose: SFTP and enter the following value as SFTP Server: shell /usr/lib64/ssh/sftp-server

Now click: OK and then: Login

Yes

Continue

And you are in

Now locate the location you saved: linux_backup_restore.zip (on the left) and the folder you create on VCSA (on the right)

and drag-and-drop the file to copy to your VCSA

Extract the ZIP on the VCSA

List the contents of the directory: db_backups with the command: ls –la

Unzip: linux_backup_restore.zip

List the contents of the directory: db_backups with the command: ls –la

Neither of the scripsthas eXecute permissions, so add eXecute for the User with the command: chmod +x *.py

List the contents of the directory: db_backups with the command: ls –la (again)

The *.py have become eXecutable!

Backup the VMware vCenter Server Appliance PostgreSQL (vPostgres) database

Run the: backup_lin.py script, provide a filename: python backup_lin.py –f 11112015_VCDB.bak

Now use WinSCP to transfer the backup to a different location

You will have to refresh the folder listing in WinSCP (Ctrl+R) to see the files created

Drag the database backup to your chosen folder on Windows

Restore the VMware vCenter Server Appliance PostgreSQL (vPostgres) database

First, use WinSCP to upload the appropriate backup file. WinSCP will prompt you to overwrite, if a copy of that file exists. Make your choice.

Stop the vCenter Server with: service vmware-vpxd stop

Stop the vCenter Datacenter Content Library Service with: service vmware-vdcs stop

Restore the vCenter database with: python restore_lin.py –f 11112015_VCDB.bak (or whatever the name of your file)

There may be numerous “NOTICE” lines referencing parts of the vCenter Server Appliance which simply don’t exist in your configuration. Just ignore these and look for the ultimate message: Restore completed successfully

Now start the vCenter with: service vmware-vpxd start

Now start the vCenter Datacenter Content Library Service with: service vmware-vdcs start

And you should be in business!

Mission Critical Virtual Machines on VMware vSphere

Building Mission Critical VMs on VMware vSphere is pretty simple. There are just a few commonly acknowledged Best Practices with which to adhere, regardless of whether you are installing Windows or Linux:

  • Use Paravirtualized drivers wherever possible
  • Remove unnecessary hardware from the VM (settings)
  • Disable unnecessary or unused devices in BIOS
  • Assign no more resources to the VM than are actually required

In the following steps, I am going to be building a VM to serve as Active Directory Domain Controller for my lab (jb-lab.local) on Windows Server 2012. Continue reading “Mission Critical Virtual Machines on VMware vSphere”

Building Ubuntu Server as a VM on ESXi

Ubuntu is one of the most well-known and useful server Operating Systems available. Today I am going to show you how to build Ubuntu Server 14.04.3 LTS as a Virtual Machine running on VMware vSphere ESXi using the VIrtual Machine Remote Console (VMRC) and ISO Image on local disk. Let’s get started…. Continue reading “Building Ubuntu Server as a VM on ESXi”

Installing open-vm-tools on Ubuntu Server

Most every Virtual Machine needs to have some sort of VMware Tools running. In the “Old Days,” the norm was to mount an ISO provided by VMware and install their version of the VMware Tools. More recently, VMware has been encouraging Operating System vendors and communities to develop their own version of the VMware tools, which are known as the “open-vm-tools.” The VMware Tools (VMware ISO) installations for most Operating Systems are now described as “deprecated”.

In the following steps, we will install open-vm-tools for Ubuntu from the command line. In order to do this, our VM needs to have access to the internet to be able to download the packages from the configured repositories.

Continue reading “Installing open-vm-tools on Ubuntu Server”

Preparing for Disaster

I was in Manhattan during Hurricane Sandy. The path of the storm was clear, and the outcome largely pre-determined. Because the company I work for (VMsources) has many clients in Manhattan, it was decided that the best place for me, were disaster to strike, was right in Manhattan. Continue reading “Preparing for Disaster”

Qualifying vSphere releases for use in production

If you have ever wondered when it time to upgrade VMware vSphere; you might want to consider the experience of the unfortunate and unwise early adopters of vSphere 5.1. The time to upgrade is clearly NOT the first public release of any new version of vSphere! Continue reading “Qualifying vSphere releases for use in production”

Diagnosing and fixing Virtual Machine Remote Console MKS problems

vCenter_client_connectionsVirtual Machine Remote Console (VMRC) issues, also known as MKS Errors, seem to be more and more common these days. The causes and solutions to most of these problems are the same for the large-scale user of vSphere Enterprise Plus as they are for the home-lab user on a trial license. It usually boils down to one fulcrum: The client (vSphere Client for Windows or the Web Client) does not “see” your vSphere Cluster the same way that vCenter “sees” all of the ESXi Hosts. Try to answer the following questions, and then we’ll get started with diagnosis. Continue reading “Diagnosing and fixing Virtual Machine Remote Console MKS problems”

Building a vSphere Home or Learning Lab – Part 2

In Part two, we will install the VMware vSphere Client for Windows, create forward and reverse DNS (which is a prerequisite for installing vCenter in any form) and then we will install the VMware vCenter Server Appliance (VCSA) to manage our ESXi VMs Continue reading “Building a vSphere Home or Learning Lab – Part 2”