简体   繁体   English

停止服务器时丢失数据[Infinispan]

[英]lost data when stopping server [Infinispan]

In my project i use infinispan to manage my data and improve the performance, so i have a problem is when we stop de server and restart it all my data are deleted ans it's normal beacause its a cache. 在我的项目中,我使用infinispan来管理数据并提高性能,所以我有一个问题是,当我们停止服务器并重新启动它时,我的所有数据都被删除了,这是正常的,因为它有一个缓存。

so i demand you if you have a sugggestion for me for saving my data of my application even if the server is stopped ? 因此,即使服务器停止了,我是否也建议您保存我的应用程序数据?

I searched in the internet , i found a lot of solution like using database with infinispan or store the data into a file like using (filecacheStore, jdbccachestore, casassandraCachedatastore) and i dont know which one is the best solution! 我在互联网上搜索,发现了很多解决方案,例如将数据库与infinispan结合使用,或将数据存储到文件中,例如(使用filecacheStore,jdbccachestore,casassandraCachedatastore),但我不知道哪个是最佳解决方案!

thank you very much in advance for your reply. 非常感谢您的答复。

There's a multitude of options and none is best for all use-cases; 有很多选择,没有一个是最适合所有用例的。 that's why there are the options. 这就是为什么有选择的原因。 You haven't said much about your app needs. 关于您的应用需求,您还没有说太多。

1) Use persistent cache store ( single file store is the simplest option probably). 1)使用永久性缓存存储( 单个文件存储可能是最简单的选择)。 This is and OOTB solution. 这是OOTB的解决方案。

2) Before shutdown fetch and persist all data from your app (use streams API to iterate through), and upload them after boot. 2)在关机之前,获取并保留您应用中的所有数据(使用流API进行迭代),并在启动后上传它们。 This does not add any overhead during runtime but requires you to handle the process yourselves. 这不会在运行时增加任何开销,但需要您自己处理过程。

3) Use cluster of nodes and always keep some nodes with the data up. 3)使用节点群集,并始终保持某些节点的数据正常运行。 However, backups (either via 1) or 2)) might be advisable anyway. 但是,无论如何,建议备份(通过1)或2))。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM