哪个嵌入式数据库用 Java 编写用于简单的键/值存储?
我最近问了一个关于 Neo4j 的问题,我开始使用它并且看起来不错.它是可嵌入的,并且是用 Java 编写的,并且没有(太多)依赖项.
I recently asked a question about Neo4j, which I got working and which seems nice. It's embeddable and it's written in Java and there aren't (too) many dependencies.
但它是一个图形数据库,我不知道将其用作简单的键/值存储是否是个好主意.
However it's a graph DB and I don't know if it's a good idea or not to use it as a simply key/value store.
基本上我有一张大地图,在 Java 中它看起来像这样:
Basically I've got a big map, which in Java would look like this:
Map<Integer,Map<String,String>>
我在主映射中有几千万个条目,每个条目都包含一个属性/值映射.内部"映射相对较小:大约 20 个条目.
I've got a few tens of millions of entries in the main map and each entry contains itself a map of property/values. The "inner" map is relatively small: about 20 entries.
我需要一种方法来将该地图从 web 应用程序的运行中持久保存到另一个.
I need a way to persist that map from on run of the webapp to the other.
使用 Neo4j,我所做的是为每个 ID(整数)创建一个节点,然后为内部映射中的每个条目放置一个属性.从我早期的测试来看,它似乎有效,但我不确定这是一个好方法.
Using Neo4j, what I did is create one node for every ID (integer) and then put one property for each entry inside the inner map. From my early testing it seems to work but I'm not sure it's a good way to proceed.
您会使用哪个用 Java 编写的可嵌入数据库?
Which embeddable DB, written in Java, would you use?
要求是:
用 Java 编写
written in Java
可嵌入(所以不要太大)
embeddable (so nothing too big)
不是 SQL (*)
开源
易于备份(我需要能够在服务器运行时进行实时"备份)
easy to backup (I need to be able to make "live" backups, while the server is running)
我的术语也可能有点错误,所以请随时帮助/纠正我.对于我的地图地图",最合适的应该是键/值对数据库吧?
My terminology may be a bit wrong too, so feel free to help me / correct me. For my "map of maps", the best fit would be a key/value pair DB right?
我有点迷失键/值对数据库、文档数据库、大表、图形数据库等之间的区别.
I'm a bit lost as the difference between key/value pairs DB, Document DBs, big tables, graph DBs, etc.
我也想使用像 Neo4J 这样的图形数据库来满足我的需要是否是个好主意(我认为性能真的不会成为问题,因为我将拥有相对少量的条目).
I'd also like if it's a good idea to use a graph DB like Neo4J for my need (I think performance really ain't going to be an issue seen the relatively small amount of entries I'll have).
当然,我可以简单地保留我自己的地图,但我真的不想在这里重新发明任何轮子.我想重用一个久经考验的数据库...
Of course I could simply persist my map of maps myself but I really don't want to reinvent any wheel here. I want to reuse a tried and tested DB...
(*) 我不想要 SQL 的原因是我将始终拥有这个地图的地图",并且内部地图会不断发展,所以我不想要过于结构化的东西.
(*) The reason I do not want SQL is that I'll always have this "map of maps" and that the inner map is going to constantly evolve, so I don't want something too structured.
推荐答案
Google 的 LevelDB 转入 Java:
There seem to be a couple of ports of Google's LevelDB into Java:
- Dain LevelDB 端口(纯 Java)
- Dain LevelDB (JNI)
那么这里有一个完整的嵌入式 Java 数据库列表:
Then there is a whole list of embedded Java databases here:
- 嵌入式java数据库
- Java 嵌入式数据库比较
相关文章