关于分布式缓存集群的一些问题 [英] Some questions on Distributed cache cluster

查看:130
本文介绍了关于分布式缓存集群的一些问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在server1和server2上设置了一个2服务器缓存群集,配置如下:

I have setup a 2-server cache cluster on server1 and server2 with following configuration:

<?xml version =" 1.0" encoding =" utf-8"?>

< configuration>

    < configSections>

        < section name =" dataCache" type =" Microsoft.Data.Caching.DataCacheSection,CacheBaseLibrary,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91" />
$
    < / configSections>

    < dataCache cluster =" DistributedCacheServer" size =" Medium">

        < caches>           < cache type =" partitioned"一致性= QUOT;强"名称= QUOT;默认"&NBSP;复制品= QUOT; 2英寸minWriteQuorum =" 2">

                <政策>

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < eviction type =" lru" />

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < expiration defaultTTL =" 10" isExpirable = QUOT;真" />               < / policy>

            < / cache>

        < / caches>

        < hosts>

            < host clusterPort =" 22234" HOSTID = QUOT; 1913659238"大小= QUOT; 1228" quorumHost =" false"&
               名称= QUOT; server1的" cacheHostName =" DistributedCacheService"

                cachePort = QUOT; 22233" />
$
            < host clusterPort =" 22234" HOSTID = QUOT; 420351013"大小= QUOT; 1228" quorumHost =" false"&
               名称= QUOT;服务器2" cacheHostName =" DistributedCacheService"

                cachePort = QUOT; 22233" />
$
        < / hosts>

        < advancedProperties>

            < partitionStoreConnectionSettings的providerName = QUOT; System.Data.SqlClient的"

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; connectionString =" Data Source = dbserver; Initial Catalog = Cache; Integrated Security = True; Trusted_Connection = Yes;"

          ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; leadHostManagement = QUOT假QUOT; />
$
        < / advancedProperties>

    < / dataCache>

< / configuration>

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="dataCache" type="Microsoft.Data.Caching.DataCacheSection, CacheBaseLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </configSections>
    <dataCache cluster="DistributedCacheServer" size="Medium">
        <caches>
            <cache type="partitioned" consistency="strong" name="default" replicas="2" minWriteQuorum="2">
                <policy>
                    <eviction type="lru" />
                    <expiration defaultTTL="10" isExpirable="true" />
                </policy>
            </cache>
        </caches>
        <hosts>
            <host clusterPort="22234" hostId="1913659238" size="1228" quorumHost="false"
                name="server1" cacheHostName="DistributedCacheService"
                cachePort="22233" />
            <host clusterPort="22234" hostId="420351013" size="1228" quorumHost="false"
                name="server2" cacheHostName="DistributedCacheService"
                cachePort="22233" />
        </hosts>
        <advancedProperties>
            <partitionStoreConnectionSettings providerName="System.Data.SqlClient"
                connectionString="Data Source=dbserver;Initial Catalog=Cache;Integrated Security=True;Trusted_Connection=Yes;"
                leadHostManagement="false" />
        </advancedProperties>
    </dataCache>
</configuration>

以下是我的一些问题:

1.&NBSP;插入的缓存对象似乎不在2台服务器之间分发。 

我使用命令 Get-CacheStatistics -HostName server1 -cacheport 22233
Get-CacheStatistics -HostName server2 -cacheport 22233.  我看到一个主机总是获取所有对象,另一个主机总是有0个数。  我的所有缓存对象都有各种密钥,并且在一个区域内创建。 在每个
群集重启后,它会随机选择一个主机去,然后所有缓存对象都只会插入到该主机中。

I user the command Get-CacheStatistics -HostName server1 -cacheport 22233 and Get-CacheStatistics -HostName server2 -cacheport 22233.  I saw that one host always get all the objects, the other host always has count of 0.   All my cache objects have various keys and are created within one region.  After each Cluster restart, it randomly pick one host to go, then all cache objects will be inserted into that host only.

2。崩溃一台服务器将关闭整个集群

例如,现在server1具有所有缓存对象,如果我使server1崩溃(通过停止DistributedCache.exe进程) ,我希望server2仍在服务中。 但我的观察结果是所有Put和Get进出集群都会得到"有
是暂时性的失败,请在一段时间后重试。"错误群组。在server1的进程重新启动后,群集将再次恢复工作。

For example, now the server1 has all the cache objects, if I make server1 crash (by stopping DistributedCache.exe process), I would expect server2 still be in service.  But my observation is that all Put and Get to and from the cluster would get "There is a temporary failure, please retry after some time." error.  The cluster will back working again after the server1's process restart itself.

3。高可用性功能不起作用

我把replicas =" 2" minWriteQuorum = QUOT; 2英寸在配置中,希望如果一个主机崩溃,缓存的对象应该仍然在另一个主机中可用。 但是,如果我崩溃一个主机(通过停止DistributedCache.exe进程),我得到"有
暂时失败,请在一段时间后重试。"如果我尝试获取先前插入的缓存对象,则会出错。

I put replicas="2" minWriteQuorum="2" in the configure, hoping that if one host is crashed, the cached object should still be available in the other host.  However, if I crash one host(by stopping DistributedCache.exe process),  I get "There is a temporary failure, please retry after some time." error if I try to get a previously inserted cached object.

如果我切换到让主服务器进行群集管理(通过更改quorumHost =" true"对于主机和设置  leadHostManagement =" true"

All above 3 observations happen as well if I switch to letting lead server do the cluster management (by changing quorumHost="true" for both hosts and set  leadHostManagement="true"

有人可以告知我做错了什么吗?我希望1. 缓存对象平均分配给两个主机; 2.一台服务器崩溃不会影响群集; 3如果1,2正常工作,高可用性功能是我的选择。

Could someone advise what I did wrong?  I would like 1. the cache object equally distributed to the two hosts; 2. crashing of one server would not effect the cluster; 3 the high avaliability feature is an option for me if 1,2 are working properly.

谢谢

 

 

 

推荐答案

1.一个命名区域总是映射到一个节点。因此,如果在一个区域中插入对象,它将始终存储在区域映射到的一个节点中。对于分发,应该存储对象在'系统区域'中,表示对象应使用无区域api插入
。有关更多信息您可以参考以下文档:

1. One named region is always mapped to one node. So if you insert objects in one region, it will always be stored in one of the nodes where the region maps to. For distribution, object should be stored in 'system regions', means object should be inserted using region-less api's. For more information you can refer the documentation at:

http:// msdn。 microsoft.com/en-us/library/ee790985.aspx

2。根据我的理解,即使其中一个节点出现故障,Get也应该正常工作。您能否告诉我们使用哪个版本的app fabric缓存?

2. As per my understanding, Get should work even if one of the node is down. Can you let us know which version of app fabric caching is being used ?

至于插入,一旦设置了HA,至少有两个节点应该处于活动状态以完成写入,否则数据将是该节点出现故障后立即丢失。所有写入都将失败,直到群集中存在至少两个节点,用于启用HA的缓存。

As for insertion, once HA is set, atleast two node should be active to complete a write, otherwise data will be lost as soon as that node goes down. All write will fail until atleast two nodes are present in the cluster for caches with HA enabled.

3。 minWriteQuorum是指在写入minWriteQuorum份数后写入是否成功。您可以尝试将此值设置为1。但它不是V1.0中经过测试的特性。所以它可能会也可能不会起作用。

3. What minWriteQuorum, means write is successful after minWriteQuorum number of copies have been written. You may try setting this value to one. But it is not a tested feaure in V1.0. So it may or may not work.


这篇关于关于分布式缓存集群的一些问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆