Moving Cache Cluster Settings to a Production Environment (Windows Server AppFabric Caching)

Typically, you test Windows Server AppFabric cache client applications on a test cache cluster before deploying the applications to production. In production, the applications use a production cache cluster. It is important to successfully move the settings from the test cache cluster to the production cache cluster to ensure that the applications work correctly. There are two methods for moving Windows Server AppFabric cache cluster settings from a test environment to a production environment:

  • Create and test a Windows PowerShell script that makes the necessary changes.

  • Use the Export-CacheClusterConfig and Import-CacheClusterConfig Windows PowerShell commands.

Create and Test a Windows PowerShell Script

You can create a Windows PowerShell script that makes the necessary changes on the production cache cluster. Consider the following guidelines in creating this script:

  • Use the New-Cache command for each required named cache. Use Get-CacheConfig on the test cache cluster to verify that you are correctly configuring the target cache with the New-Cache command.

  • Use the Set-CacheClusterSecurity command to change the default security settings for the cluster if required.

  • Use the Grant-CacheAllowedClientAccount command to allow the required Windows accounts access to the production cache cluster.

  • Use the Set-CacheHostConfig command to customize the cache host settings for each host in the cluster if required. Verify that the specified cache host names exist on the production cache cluster.

Depending on your required customizations, you might only use a portion of the commands listed above. For example, if you did not change the default security settings in the test environment, then you should not call Set-CacheClusterSecurity on the production cache cluster. Also, note that you can create a more complex Windows PowerShell script that reads settings from the test environment and recreates those settings on the production cache cluster automatically. This type of script is beyond the scope of this document.

After you create the Windows PowerShell script, you should test it before using it in production. Create a new cache cluster in the test environment with default settings, and then run the script on this test cache cluster. To verify the cache cluster is correctly configured, run your applications through a series of tests that utilize the cache cluster in the test environment.

Using Export-CacheClusterConfig and Import-CacheClusterConfig

Another method for moving settings from test to production is to export the test cache cluster configuration file, edit it, and then import it into production.

You must be careful when using this technique not to unintentionally remove required settings from the production cache cluster. For example, if the test cache cluster configuration file does not contain all of the existing named caches in production, you are responsible for adding those additional named caches to this file. It is recommended to compare the cache cluster configuration files from both test and production during this process to reduce this type of mistake.

To use this technique, first export the cache cluster settings from the test cache cluster using the Export-CacheClusterConfig command. Then use the following steps to edit the configuration file:

  1. Verify that list of caches is comprehensive for both existing production caches and the new caches that are getting added from the test environment. Update the list of caches if required.

  2. Modify the list of hosts to match those in the production environment. Decide if the cache host settings, such as size, can be applied to the servers in the production environment. You should never add new cache hosts to the cache cluster by using this technique, because those hosts will not be correctly configured.

  3. Verify the mode and protectionLevel attributes on the securityProperties element.

  4. Modify the list of allowed users in the authorization section to contain all current users in production in addition to any new users required by the target changes.

Note that some of the XML elements and attributes previously described might be missing from your cache cluster configuration file if you are using default settings.

See Also

Community Additions