【问题标题】:Ehcache: How to swap to the diskStore when Terracotta server is off-line?Ehcache:Terracotta服务器离线时如何切换到diskStore?
【发布时间】:2011-12-25 09:52:00
【问题描述】:

当 Terracotta 服务器不可用时,我需要将我的应用程序配置为从 Terracotta 服务器配置切换到 diskStore。有没有办法做到这一点? 当我在 ehcache.xml 上配置 terracottaConfig 元素时,如果无法访问 Terracotta 服务器,我将无法启动应用程序.... 这是我的 ehcache.xml 配置:

    <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="ehcache.xsd" name="gpCacheManager">

    <diskStore path="java.io.tmpdir" />

    <terracottaConfig rejoin="true">
        <tc-config>
            <servers>
                <server host="XXX.XXX.XXX.XX" name="host1">
                </server>
            </servers>
            <clients>
                <logs>app/logs-%i</logs>
            </clients>
            <nonstop immediateTimeout="true" timeoutMillis="3000">
                <timeoutBehavior type="localReads" />
            </nonstop>
        </tc-config>
    </terracottaConfig>

    <defaultCache maxElementsInMemory="10000" eternal="false"
        timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="false"
        diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
        memoryStoreEvictionPolicy="LRU">
        <terracotta clustered="true">
            <nonstop immediateTimeout="false" timeoutMillis="3000">
                <timeoutBehavior type="localReads" />
            </nonstop>
        </terracotta>
    </defaultCache>

    <cache name="oxmCache" maxElementsInMemory="10000" eternal="false"
        timeToIdleSeconds="240" timeToLiveSeconds="240" overflowToDisk="false"
        diskPersistent="false" diskExpiryThreadIntervalSeconds="240"
        memoryStoreEvictionPolicy="LRU">
        <terracotta clustered="true">
            <nonstop immediateTimeout="false" timeoutMillis="3000">
                <timeoutBehavior type="localReads" />
            </nonstop>
        </terracotta>
    </cache>

</ehcache>

谢谢!

【问题讨论】:

    标签: java caching ehcache terracotta


    【解决方案1】:

    恐怕目前不支持使用磁盘(在客户端上)。 基本上,如果我说对了,当它不可用时,您希望将条目溢出到磁盘而不是兵马俑服务器上。

    现在,我想您也希望在服务器恢复时进行和解,对吧?因为我很难看到磁盘上的(部分)数据是如何有用的......你愿意详细说明吗?

    【讨论】:

    • 真正的问题是我不能离线使用应用程序(没有 Terracotta 服务器)。如果有办法在没有可用的 Terracotta 服务器的情况下启动应用程序,我将管理磁盘上的部分数据,以便在服务器可用时进行协调......
    猜你喜欢
    • 1970-01-01
    • 2015-10-21
    • 2014-04-02
    • 2011-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多