Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Wednesday, July 8, 2015

Moving the VMware vCenter Server 4.x/5.x/6.0.x SQL database



A simple necessary task that isn’t so simple.  So the scenario plays out like this.  Customer is running vCenter, Update Manager and SRM databases on a SQL server that is running Windows 2003 with SQL 2005 – not extremely uncommon.  With the impending end of Windows 2003 looming we decide to migrate to Windows 2008 R2 and SQL 2008 R2.  

For the most part we followed KB 7960893 from VMware.

Now this KB will get you close, which is nice.  And what does close mean.  It means that we had databases up and running on the SQL server.  It means that we had ODBC connections that were connected and tested OK.  And then….It means that we couldn’t get the service to start – WTF.

So let’s look at the process and the final resolution.  First off it’s a pretty common task and I was doing this for a customer in their DR site, but it is something that everyone will run into at some time. 

Several steps in the process.

1.       Backup the databases on the old SQL server.  Simple enough go into SQL management studio right click the database and back it up.  Stop all of the VMware services on vCenter and SRM first.
2.       Copy the databases over to the new server – Really easy.
3.       Restore the databases to the new SQL server.
4.       Yeah this next step is a little harder.  Permissions.  We had to set the proper permissions.  The customer wanted to use a different service account and instead of having separate accounts for vCenter, UM, and SRM they wanted to use one account for all of them.  Not a huge deal, so whatever, let’s make it happen.  We used a local account in SQL with SQL server authentication.  We then granted dbo permissions to the vCenter, UM, and SRM databases.  You also have to give it dbo for the msdb database.  OK, all of this sounds pretty straightforward so far.
5.       Edit the vcdb.properties file to change the server name – Really easy.
6.       I didn’t update the SQL server agents just yet, because I didn’t care about performance statistics.
7.       Go to ODBC and ODBC32 on the vCenter server and change them to point to the new server and the correct database using the proper username and password.  Then test it.  BOOM, everything worked.  Start the vCenter and UM services up.  And…It failed.  WTF.

Troubleshooting Time

8.       So to do a little troubleshooting I looked in event viewer, got a whole bunch of nothing. 
9.       So what next?  I decided to start the vCenter service using the executable in standalone mode.  Open an administrative command prompt and the run vcdb –s.  Hmmm.  Interesting error.  Login failure and it was related to a DSN, which is telling me SQL login failure.  But the ODBC connections all tested positive.
10.   So I did a registry search and each of the 3 databases all have a section with a DB entry in it.  In that section I looked in there, and it still had the old entry for the name in there.  In the picture it is entry 2.  So I changed it.  DANG IT, the service still wouldn’t start.
11.   Well the line right below the username in the registry is the password hash for the old username, in the picture it is entry 3.  To change that password hash you have to go back to that administrative command prompt and run the vcdb –p command and then enter the new password twice.  And now.  BOOM the service starts.  WOO HOO.


12.   So now let’s start the Update Manager service.  It fails.  WTF.

13.   This was pretty easy.  I ran the Update Manager Utility and change the database in there and it started up fine after that.  Update Manager Utility is mentioned in KB 2011327, and it is located under Program Files (x86), because it is still a 32bit program, also have to update the ODBC32 as well.  So start the service and it worked.

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2011327






14.   OK so now 2 of the 3 databases are connected and running.  Go to the SRM server and start that service up.  DANG IT, no go.  On to troubleshoot that.

15.   Went through several troubleshooting steps, and actually worked with VMware technical support, but since nothing was really set up in SRM we just did a full uninstall/reinstall.  It wasn’t pretty and if there had been any data on there I would have definitely taken the time to get it working, but…I didn’t so this was the easy way out.

So in a nutshell, it wasn’t as easy as I thought it would be.  But it is done, consulting is never quite as easy as it seems, but I still enjoy it.

Tuesday, March 3, 2015

Active Directory - Fine-Grained Password Policy

So I have been doing quite a bit of consulting lately and thought I would document some of the more interesting tasks that I run across.  In the last couple of weeks I have dealt with software deployments through GPO and KACE boxes.  Exchange Troubleshooting, VMware Performance troubleshooting, and several other things. 

Got the opportunity to finally implement Fine-Grained password policies.  For those of you that don't know what that is, by default using an AD domain you set one password policy at the domain level and everyone inherits that.  So what if you want to set different policies on different OUs?  No big deal create a couple of GPOs with the policies that you want and apply them to the correct OUs - WRONG!!! That doesn't work.  You can't set password policies on an OU.  You have to set up what they call Fine-Grained Password Policies. 

I found a pretty good TechNet article that pointed me in the right direction.  The problem with a lot of Microsoft's direction is that they point you in the right direction and you are in Los Angeles and want to go to NYC and they say go East.  Now it is on you to figure out how to get there.  This article was exactly that way.  It left out lots of switches and several other things to make sure it was working correctly.

https://technet.microsoft.com/en-us/library/cc754461(v=ws.10).aspx

As I have started to delve more and more back into the Microsoft world I have really come to empower PowerShell quite a bit more than ever.  It started with Exchange where I did a complete migration from Exchange 2010 to Exchange 2013 via PowerShell from Setup to migration to tear down.  Maybe I was bored, maybe I was trying to be cool (As much as computer dorks can be cool).

So I accomplished a lot of this task using PowerShell.  The concept is pretty Easy.  You have to create what is called a PSO (Password Setting Object).  You create this by using the New-ADFineGrainedPasswordPolicy cmdlet.  You then have to specify things like MaxPasswordAge, MinPasswordAge, and a few other parameters.  Not all that hard. 

Once you create the PSO you can view it using ADSI Edit under the Password Settings Container.  You can also modify settings from here if needed.  Once you have gotten this far, it still doesn't work.  Now, you have to assign who is going to have this policy applied to them. 

You would think that you can apply this to an OU, but you would be wrong.  You have to create a Domain Security Group and then grant that group permissions to the PSO.  Now you would think just go to properties and the security tab add it in and you are done.  You are wrong.  You have to go to ADSI Edit, go to that Password Settings Container and locate the PSO you just created.  Click Properties and then click the Attribute Editor tab.  Look for the msDS-PsoAppliesTo attribute.  You then enter the full DN (Distinguished Name) of the Global Security Group.

After that add users to the Group and you are good.

So how do you test.  Well I picked a user (the wrong user) and added him to the group, we then did a bunch of restarts and nothing.  So I found out after some prodding that he changed his password last week but didn't think that would count.  So I checked his expiration date.  It showed a really long number.  Now I had no clue what that number meant.  It showed a regular date in the viewing box but when you tried to modify it (which you couldn't) it showed this long number. 

So what does that long number mean out of curiosity I looked it up.  This attribute is Integer8, a large 64-bit number that represents a date as the number of 100-nanosecond intervals since 12:00 AM January 1, 1601.  1601???  Wow, not quite sure why that number but OK.

Anyway I found a user whose password expired about 2 months ago (He had the password never expires on him, which I had to deselect to see this value).  I added him to the group and did a restart and he had to change his password.  It worked like it should.  So for those of you that want to accomplish this, it isn't really difficult, just play around in a test network like your customers production machines and play around.

Monday, August 13, 2012

VMware on NetApp NFS

This information was taken from a NetApp white paper by Bikash Roy Choudhury – TR-3839. I am just pulling out snippets that I thought were very interesting. Not all of it is specific to NetApp, but most of my consulting work is on NetApp.
  1. Deduplication - A VMware datastore has a high level of data duplication. This is because it contains many instances of the same guest operating systems, application software, and so on. NetApp deduplication technology can eliminate this duplicated data, dramatically reducing the amount of storage required by your VMware environment. Space savings range from 50% to 90%, with 70% being typical.
  2. Strongly consider using CAT6 cables rather than CAT5/5e. GbE will work on Cat5 cable and retransmissions will recover from any errors that occur, but they have a more significant impact on IP storage networks.
  3. NFS NETWORKS AND STORAGE PERFORMANCE - There are three primary measures of storage performance: bandwidth (MBps), throughput in I/O operations per second (IOPS), and latency (ms). Throughput and bandwidth are related in the sense that the throughput measured in Mbps equals to IOPs multiplied by the I/O size. The I/O size is the size of the I/O operation from the host perspective.IOPS are usually determined by the back-end storage configuration. If the workload is cached, then it‘s determined by the cache response; most often, it‘s determined by the spindle configuration for the storage object. In the case of NFS datastores, the storage object is the file system. On a NetApp storage system, the IOPS achieved are primarily determined by the number of disk drives in an aggregate. You should also know that each NFS datastore mounted by ESX (including vSphere) uses just one TCP session to an NFS datastore carrying both NFS control information and NFS data. Because of this, the upper limit throughput achievable from a single ESX host for a single datastore—regardless of link aggregation—is a single link. If you use 1GbE, this means that a reasonable expectation is a unidirectional workload of ~80–100MB/sec (GbE is full duplex, so this can be 160MB/sec bidirectionally with a mixed workload). Higher total throughput on an ESX server can be achieved by leveraging multiple datastores. You can scale up the total throughput to multiple datastores using link aggregation and routing mechanisms.
    The performance described above is sufficient for many use cases. Based on these numbers, NFS is appropriate for various VMware scenarios:
    • A shared datastore supporting many VMs with an aggregate throughput requirement within the guidelines above (a large number of IOPS, but generally not large-block I/O)
    • A single busy VM as long as its I/O load can be served by a single GbE link
    With small-block I/O (8K), a GbE connection delivers 12,500 IOPS—roughly the performance of 70 15K spindles. On the other hand, a SharePoint VM tends to use I/O sizes of 256K or larger. Using 256K I/O sizes yields just 390 IOPS, which would likely be a problem. Under such circumstances, 10GbE may be the best performance option. If you use 10GbE—though a single TCP session will be used per datastore—much more throughput is available for demanding workloads. If 10GbE isn‘t an option, you can use NFS for some VMs over 1GbE and FC or iSCSI for others depending on the application throughput and latency requirements.
  4. Partition Alignment - For NFS, there is no VMFS layer involved, so only the alignment of the guest VM file system within the VMDK to the NetApp storage array is required.The correct alignment for a new VM can be set using either diskpart to format a partition with the correct offset or by using fdisk from the ESX service console. In practice to avoid further creating of improperly aligned VMs, you must create templates that are properly aligned so new virtual machines built using those templates are properly aligned. NetApp has created a tool: mbralign, to check and correct the alignment of existing virtual machines.
  5. THIN PROVISIONING - As mentioned above, the ability to take best advantage of thin provisioning is a major benefit of using NetApp NFS. VMware thin provisions the VMDK files on NFS datastores by default, but there are two types of thin-provisioned virtual disk files available:
    • “Thick” type thin-provisioned virtual disk.This type of virtual disk file is created by default on NFS datastores during the virtual machine creation process. It has the following properties:
      • Creates a flat .VMDK file; does not occupy actual disk blocks (thin provisioned) until there is a physical write from the guest OS
      • Guaranteed disk space reservation
      • Cannot oversubscribe the disk space on the NFS datastore
    • “Thin” type thin-provisioned virtual disk.You must create this type of virtual disk file using the vmkfstools command. It‘s properties are:
      • Creates a flat .VMDK file; does not occupy actual disk blocks (thin provisioned) until there is a physical write from the guest OS
      • No guaranteed disk space reservation
      • Can oversubscribe the disk space on the NFS datastore
    You can run the following command against an NFS datastore to show its actual disk space utilization:
    • # vdf -h /vmfs/volumes/<NFS Datastore Name>
    Using the “thin” type of virtual disk you have the option to oversubscribe the storage capacity of a datastore, allocating more space than a datastore actually contains on the assumption that VMs will not all use the capacity allocated to them. This can be a very attractive option; however, it has a few limitations that you must know about before you implement it.
    Should an oversubscribed datastore encounter an out-of-space condition, all of the running VMs will become unavailable. The VMs simply “pause” waiting for space, but applications running inside of VMs may fail if the out-of-space condition isn’t addressed in a short period of time. For example, Oracle databases will remain active for 180 seconds; after that time has elapsed the database will fail.
  6. High Availability and Disaster Recovery - NetApp recommends the following ESX failover timeout settings for NFS. We recommend increasing the default values to avoid VMs being disconnected during a failover event. NetApp VSC can configure these settings automatically. The settings that NetApp recommends (across all ESX hosts) are:
    • NFS.HeartbeatFrequency (NFS.HeartbeatDelta in vSphere) = 12
    • NFS.HeartbeatTimeout = 5(default)
    • NFS.HeartbeatMaxFailures = 10. When the number of NFS datastores are increased, we also recommend increasing the heap values: Net.TcpipHeapSize =>’30′ to Net.TcpipHeapMax => ‘120′
      1. Back up your Windows registry.
      2. Select Start>Run, type regedit.exe, and click OK.
      3. In the left‐panel hierarchy view, double-click HKEY_LOCAL_MACHINE, then System, then CurrentControlSet, then Services, and then Disk.
      4. Select the TimeOutValue and set the data value to 190 (decimal).
    Every “HeartbeatFrequency” (or 12 seconds) the ESX server checks to see that the NFS datastore is reachable. Those heartbeats expire after “HeartbeatTimeout”(or 5 seconds), after which another heartbeat is sent. If “HeartbeatMaxFailures”(or 10 heartbeats) fail in a row, the datastore is marked as unavailable and the VMs crash.
    This means that the NFS datastore can be unavailable for a maximum of 125 seconds before being marked unavailable, which covers the large majority of NetApp failover events.
    During this time period, a guest sees a non-responsive SCSI disk on the vSCSI adapter. The disk timeout is how long the guest OS will wait when the disk is non-responsive. Use the following procedure to set operating system timeouts for Windows servers to match the 190-second maximum set for the datastore:
    1. Back up your Windows registry.
    2. Select Start>Run, type regedit.exe, and click OK.
    3. In the left‐panel hierarchy view, double-click HKEY_LOCAL_MACHINE, then System, then CurrentControlSet, then Services, and then Disk.
    4. Select the TimeOutValue and set the data value to 190 (decimal).