Configuring Windows Server AppFabric (caching)
Once you have finished configuring the Hosting Services as discussed in the preceding recipe, the next task is to configure the Caching Services for AppFabric. Just like in the preceding recipe, we will select a service account that should be part of the administrator group so that it has an administrative access to the caching configuration provider. Once again we will consider a workstation configuration and select a valid local system account.
We will see how to setup the Caching Configuration Store Provider. At the end of this recipe, we will also see how to join/create a new cache cluster (that this, the instance of Window Server AppFabric Cache is part of) along with the end point details (that is, port addresses) used by AppFabric services to communicate on the network.
Once we have configured Windows Server AppFabric Caching Services, we will be able to start using AppFabric Caching.
Getting ready
To begin this recipe, we will need the following in place:
- A service account for the AppFabric Caching service.
- A file share (UNC Server Share) to store XML based cache configurations or a SQL Server database for a SQL Server based AppFabric Configuration store. (This is required for configuring a High Availability Caching Service scenario that runs on Windows Server 2008.)
How to do it...
To set up Windows Server AppFabric Caching follow these steps:
- Run the AppFabric Configuration wizard.
- Accept the User Account Control (UAC) dialog, confirming that you will allow this program to make changes to your computer.
- Click on Next on the Before you Begin and Configure Hosting Services screens to reach Configure Caching Service.
- Once you are on the Caching Service screen of the Configure AppFabric wizard, select the Set Caching Service configuration.
- Under Caching Service Account, click on Change. This will allow you to select the identity for the Caching Service Account.
- If your machine is in workstation mode, then you cannot change the service account. Otherwise, you can browse and select a local account (that has administrative access to the Caching Configuration store).
- Select XML from the Caching Service configuration provider dropdown.
- The SQL Server based configuration is not available for the Caching Configuration Service in workstation mode. If you select SQL provider and click on Configure, you will get the following error message:
Note
We discuss the use of SQL Server AppFabric Caching Service Configuration Store Provider in more detail in Chapter 7, Monitoring Windows Server AppFabric Deployment.
- Under File Share, provide a file path of an existing UNC file share. This will allow Windows Server AppFabric's Configuration Service to store and manage information stored as an XML file under this provided path. Your screen will appear as follows:
- It should be noted that the File share (UNC server share) selection wizard will not allow you to create a new file share. As highlighted in the beginning of the recipe, it is required to have a UNC file share readily available. Under cluster information select New Cluster and click on Next.
- Configure AppFabric Cache Node by providing a unique port number value (numbers must be between 1024 and 65535) for the Cache port, Cluster port, Arbitration port, and Replication port.
Note
The Cache port is used for transmitting data between Cache Clients and Cache Hosts. The Cluster port enables Cache Cluster formation and Management. The Arbitration port is used to double check if the Cache Host is unavailable. Arbitration is used when the Cache Host fails. The Replication Host is used to move data between the Cache Hosts. Replication is used when Cache is configured for High Availability.
- Configure Windows firewall exceptions by selecting the rules for Windows Server AppFabric Caching Service and Remote Service Management. Your screen should appear similar to the following:
- After clicking on Next, click on Yes on the Windows Server AppFabric Configuration Wizard dialog box and you will come to the end of the wizard with an option to launch IIS to further manage Windows Server AppFabric. Click on Finish to close the wizard.
- Congratulations! You have fully configured Windows Server AppFabric. Click on Finish.
Note
The High Availability feature of Windows Server AppFabric Caching can only be enabled on Enterprise versions of Windows Server 2008/2008 R2. This implies that all the nodes in the cluster must have enterprise editions of Windows Server 2008/2008 R2. For more information you may refer to: http://go.microsoft.com/fwlink/?LinkId=164929.
How it works...
The Windows Server AppFabric Caching Service requires a service account to run its Windows service as well as a configuration provider where it can store its configuration. As the caching service runs under the identity of the provided account, the account must have administrative privileges so that it can access and modify the configuration.
The Windows Server AppFabric Caching Service needs to identify which ports to connect to in order to communicate with the other hosts in the cluster. Once the port numbers are specified, ensure that any software or hardware firewalls are not blocking these ports.
As we experienced in this recipe, the Windows Server AppFabric Caching Service is highly configurable and the configuration wizard makes it extremely easy to set up (or change) the existing configuration.
Now that we have configured Services for AppFabric and all the services are up and running under valid service accounts along with firewall rule definitions, we can now start coding to test and start consuming the caching service.