缓存主机配置设置(Windows Server AppFabric 缓存)

Windows Server AppFabric 缓存主机设置存储在两个位置:群集级别的群集配置设置中和缓存主机级别的每个缓存主机中。

群集级别的缓存主机设置

存储在群集级别的缓存主机设置与缓存主机作为群集中的参与者的执行方式相关,例如内存消耗和用于通信的网络端口设置。这些群集级别的缓存主机设置将在群集配置设置(Windows Server AppFabric 缓存)中进行介绍。

基于 Windows PowerShell 的缓存管理工具也可以查看和编辑大多数群集级别的设置。有关详细信息,请参阅使用 Windows PowerShell 管理 Windows Server AppFabric 缓存功能

主机级别的缓存主机设置

每台缓存主机上存储的缓存主机设置都起一定作用并与运行软件所需的设置相关,例如它们设置缓存主机在哪里可以找到群集配置存储位置及如何配置日志接收器。

为了存储缓存主机设置,每台缓存主机都使用一个名为 DistributedCacheService.exe.config 的配置文件。此文件是在安装时自动创建和配置的,位于 .\Windows\System32\AppFabric 文件夹。此配置文件中所使用的设置在大多数情况中都不应进行编辑。唯一可能必须编辑此文件的时候是设置日志记录级别或更改日志位置。

备注

DistributedCacheService.exe.config 文件中此处未介绍的其他设置由 AppFabric 用于内部操作。

dataCacheConfig 元素设置

dataCacheConfig 元素中的设置在缓存群集信息方面对缓存主机非常有意义。dataCacheConfig 元素中包含群集名称、群集配置存储位置和缓存主机服务名称等设置。

在不带参数使用 Use-CacheCluster 命令时,PowerShell 管理工具也使用下表中概述的 dataCacheConfig 元素中的设置。有关详细信息,请参阅使用 Windows PowerShell 管理 Windows Server AppFabric 缓存功能

设置 XML 配置位置

缓存服务器名称

dataCacheConfig 元素的 hostName 属性。

群集配置位置连接字符串

clusterConfig 元素的 connectionString 元素。clusterConfig 元素是 dataCacheConfig 元素的子元素。

备注

如果使用 SQL Server 数据库来存储群集配置设置,则 SQL Server 连接字符串将以明文形式存储在 DistributedCacheService.exe.config 文件中。如果可以,请使用 Windows 集成安全来保护数据库,以便不需要在连接字符串中使用密码。

示例

下例显示了缓存主机配置文件 DistributedCacheService.exe.config 的样子。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- Microsoft.ApplicationServer.Caching.Core assembly name is hard-coded -->
    <section name="dataCacheConfig" type="Microsoft.ApplicationServer.Caching.DataCacheConfigSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <section name="fabric" type="Microsoft.Fabric.Common.ConfigFile, Microsoft.WindowsFabric.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" allowLocation="true" allowDefinition="Everywhere" />
    <section name="dataCache" type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </configSections>
  <dataCacheConfig cacheHostName="AppFabricCachingService">
    <log location="" logLevel="-1" />
    <clusterConfig provider="System.Data.SqlClient" connectionString="Data Source=SqlServer1;Initial Catalog=CacheConfigDB;Integrated Security=True" />
  </dataCacheConfig>
  <fabric>
    <section name="param" path="">
      <key name="VersionInfoClass" value="Microsoft.ApplicationServer.Caching.ServerVersionInfo, Microsoft.ApplicationServer.Caching.Server" />
      <key name="DroppedReplicaKeepDuration" value="0" />
      <key name="ClusterStableNodeUpInterval" value="10" />
      <key name="ReplicationQueueCapacity" value="128" />
      <key name="CopyQueueCapacity" value="2" />
      <key name="ReplicationTempListCapacity" value="1024" />
      <key name="ReplicationTempListInitialSize" value="128" />
      <key name="ReplicationRetryInterval" value="12" />
      <key name="ThrowOnAssert" value="true" />
    </section>
  </fabric>
  <dataCache size="Small">
    <hosts>
      <host replicationPort="22236" arbitratorPort="22235" clusterPort="22234" hostId="1739552749" size="1228" leadHost="true" account="NT AUTHORITY\NETWORK SERVICE" name="localhost" cacheHostName="AppFabricCachingService" cachePort="22233" />
    </hosts>
  </dataCache>
  <runtime>
    <gcServer enabled="true" />
  </runtime>
  <startup>
    <supportedRuntime version="v4.0.30125" />
  </startup>
</configuration>

另请参阅

概念

应用程序配置设置(Windows Server AppFabric 缓存)
群集配置设置(Windows Server AppFabric 缓存)
Windows Server AppFabric 缓存问题疑难解答
使用 Windows PowerShell 管理 Windows Server AppFabric 缓存功能
Windows Server AppFabric 缓存概念
开发缓存客户端(Windows Server AppFabric 缓存)

  2011-12-05