Windows Server AppFabric首页
http://msdn.microsoft.com/zh-cn/windowsserver/ee695849(en-us).aspx
高可用性(Windows Server AppFabric 缓存)
http://msdn.microsoft.com/zh-cn/library/ee790974.aspx
www.nhibernate.org 去看NHIBERNATE的一些文档,中文资料在博客堂http://blog.joycode.com/ 、博客园http://www.cnblogs.com/、CSDN http://www.csdn.net 等上面找一下
PS C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministra
tion> Export-CacheClusterConfig
位于命令管道位置 1 的 cmdlet Export-CacheClusterConfig
请为以下参数提供值:
File: c:\a.txt
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataCache" type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<dataCache size="Small">
<caches>
<cache consistency="StrongConsistency" name="default">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="10" isExpirable="true" />
</policy>
</cache>
</caches>
<hosts>
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="1839725557" size="2047" leadHost="true" account="RDEV\SCMCORE2$"
cacheHostName="AppFabricCachingService" name="SCMCORE2" cachePort="22233" />
</hosts>
<advancedProperties>
<partitionStoreConnectionSettings leadHostManagement="false" />
<securityProperties mode="None" protectionLevel="None">
<authorization>
<allow users="rdev\dingfengfeng" />
<allow users="NT Authority\Network Service" />
<allow users="rdev\tes" />
</authorization>
</securityProperties>
</advancedProperties>
</dataCache>
</configuration>
PS C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministra
tion> Set-CacheClusterSecurity
位于命令管道位置 1 的 cmdlet Set-CacheClusterSecurity
请为以下参数提供值:
SecurityMode: Transport
ProtectionLevel: EncryptAndSign
PS C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministra
tion> Start-CacheCluster
HostName : CachePort Service Name Service Status Version Info
-------------------- ------------ -------------- ------------
SCMCORE2:22233 AppFabricCachingService UP 1 [1,1][1,1]
PS C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministra
tion> Get-CacheAllowedClientAccounts
rdev\dingfengfeng
NT Authority\Network Service
PS C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministra
tion> Grant-CacheAllowedClientAccount
位于命令管道位置 1 的 cmdlet Grant-CacheAllowedClientAccount
请为以下参数提供值:
Account: rdev\huangbiao
PS C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministra
tion> get-cachehostconfig
位于命令管道位置 1 的 cmdlet Get-CacheHostConfig
请为以下参数提供值:
HostName: scmcore
CachePort: 22233
HostName : SCMCORE
ClusterPort : 22234
CachePort : 22233
ArbitrationPort : 22235
ReplicationPort : 22236
Size : 2559 MB
ServiceName : AppFabricCachingService
HighWatermark : 90%
LowWatermark : 70%
IsLeadHost : True
PS C:\Windows\System32\WindowsPowerShell\v1.0\Modules\DistributedCacheAdministra
tion> get-cachehostconfig
位于命令管道位置 1 的 cmdlet Get-CacheHostConfig
请为以下参数提供值:
HostName: scmcore2
CachePort: 22233
HostName : SCMCORE2
ClusterPort : 22234
CachePort : 22233
ArbitrationPort : 22235
ReplicationPort : 22236
Size : 2047 MB
ServiceName : AppFabricCachingService
HighWatermark : 90%
LowWatermark : 70%
IsLeadHost : False
设置高可用性集群
Set-CacheConfig -CacheName NamedCache1 -TimeToLive 30 Secondaries 1
注意:仅运行 Windows Server 的 Enterprise 或 DataCenter 版本的缓存主机支持此功能;且缓存主要主机不能少于三台,微软的说法是少于为了缓存群集保持可用,大多数主
要主机必须保持可用。测试情况是主要主机为两台时,有一台当机,整个缓存就不可用了。
最后配置情况,可以用Export-CacheClusterConfig 导出,修改后在import进去。注意这设置是三个机器都是leadHost="true",leadHostManagement="false",群集管理交给sql server

代码
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="dataCache" type="Microsoft.ApplicationServer.Caching.DataCacheSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<dataCache size="Small">
<caches>
<cache consistency="StrongConsistency" name="default" secondaries="1">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="60" isExpirable="true" />
</policy>
</cache>
<cache consistency="StrongConsistency" name="issueweb" secondaries="1">
<policy>
<eviction type="Lru" />
<expiration defaultTTL="60" isExpirable="true" />
</policy>
</cache>
</caches>
<hosts>
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="828916006" size="2559" leadHost="true" account="RDEV\SCMCORE$"
cacheHostName="AppFabricCachingService" name="SCMCORE" cachePort="22233" />
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="1688081450" size="2047" leadHost="true" account="RDEV\SCMCORE2$"
cacheHostName="AppFabricCachingService" name="SCMCORE2" cachePort="22233" />
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="242331826" size="2047" leadHost="true" account="RDEV\SCMCORE3$"
cacheHostName="AppFabricCachingService" name="SCMCORE3" cachePort="22233" />
</hosts>
<advancedProperties>
<partitionStoreConnectionSettings leadHostManagement="false" />
<securityProperties>
<authorization>
<allow users="rdev\swordbuilder" />
<allow users="rdev\huangbiao" />
<allow users="NETWORK SERVICE" />
</authorization>
</securityProperties>
</advancedProperties>
</dataCache>
</configuration>
leadHostManagement 群集级别设置 | leadHost 缓存主机设置 | 设置组合说明 | 有效的缓存主机责任 |
false
|
false
|
SQL Server 或自定义提供程序执行群集管理角色。这不是主要主机。
|
仅正常的缓存主机操作。
|
false
|
true
|
SQL Server 执行群集管理角色。如果您将 leadHostManagement 设置更改为 true,则它是主要主机。
|
仅正常的缓存主机操作。
|
true
|
false
|
主要主机执行群集管理角色,但它不是主要主机。
|
仅正常的缓存主机操作。
|
true
|
true
|
主要主机执行群集管理角色。这是主要主机。
|
正常的缓存主机操作,并与其他主要主机一起管理群集。
|
缓存客户端安全设置
与缓存群集安全设置一样,缓存客户端可以使用 securityProperties
元素在应用程序配置文件中配置安全设置。或者,客户端可以采用编程方式将DataCacheSecurity 类和 DataCacheFactoryConfiguration 类的 SecurityProperties 属性结合使用来配置安全。有关详细信息,请参阅应用程序配置设置(Windows Server AppFabric 缓存)。
缓存客户端和缓存群集使用启用连接的安全设置,这一点非常重要。在下表中,列代表服务器安全设置,行代表客户端安全设置。每个组合列出“Pass”或“Fail”,取决于是否允许连接。
客户端设置 | Mode=None, ProtectionLevel=Any | Mode=Transport, ProtectionLevel=None | Mode=Transport, ProtectionLevel=Sign | Mode=Transport, ProtectionLevel=EncryptAndSign |
None, Any
|
Pass
|
Fail
|
Fail
|
Fail
|
Transport, None
|
Fail
|
Pass
|
Fail
|
Fail
|
Transport, Sign
|
Fail
|
Pass
|
Pass
|
Fail
|
Transport, EncryptAndSign
|
Fail
|
Pass
|
Pass
|
Pass
|
IIS->应用程序池 ->高级设置->标识,可以设置web程序连接缓存服务器的用户