caching - 如何使用兵马俑服务器实现集群缓存?
问题描述
有人可以告诉我如何使用 terracota 服务器在两个微服务之间实现集群缓存共享,任何参考项目都可以很好地开始
eh-cache.xml
ehcache xml : <?xml version="1.0" encoding="UTF-8"?>
<ehcache:config`enter code here`
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:terracotta='http://www.ehcache.org/v3/clustered'
xmlns:ehcache='http://www.ehcache.org/v3'
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.8.xsd
http://www.ehcache.org/v3/clustered http://www.ehcache.org/schema/ehcache-clustered-ext-3.8.xsd">
<ehcache:service>
<terracotta:cluster>
<terracotta:connection url="terracotta://localhost:9410/clustered"/>
<terracotta:server-side-config auto-create="true">
<!--<terracotta:default-resource from="default-resource"/>-->
<terracotta:shared-pool name="shared-pool-expense" unit="MB">100</terracotta:shared-pool>
</terracotta:server-side-config>
</terracotta:cluster>
</ehcache:service>
<ehcache:cache alias="areaOfCircleCache">
<ehcache:key-type>java.lang.String</ehcache:key-type>
<ehcache:value-type>com.db.entity.LogMessage</ehcache:value-type>
<ehcache:resources>
<!-- <ehcache:heap unit="entries">100</ehcache:heap>
<ehcache:offheap unit="MB">10</ehcache:offheap>-->
<terracotta:clustered-dedicated unit="MB">10</terracotta:clustered-dedicated>
</ehcache:resources>
</ehcache:cache>
</ehcache:config>
解决方案
这个问题相当大。我建议从文档开始,然后在您无法弄清楚的情况下提出具体问题。
推荐阅读
- java - 在此查找唯一路径数算法中我做错了什么?
- javascript - 防止在js中将数字转换为八进制
- c# - 运行 Selenium 浏览器测试时 DOM 中的重复元素
- json - 使用 jq 获取键子集并将输出包装到列表
- javascript - 编辑 Java 脚本以偏离某个键并分配不同的值
- react-native - 在 Xcode 上导入自定义反应原生模块的正确方法是什么?
- c# - C# 使用自定义函数扩展属性
- java - 集合中的性能发现元素
- emscripten - 在模块实例之间共享 WebAssembly.Memory
- php - 制作可以从 HTML 表单中获取输入的可拖动元素(圆形、矩形等形状)