Distributed HashMap or distributed information storage in Java

Does anyone know a good java framework for distributed hash mapping (DHT)?

I used overlay Weaver some time ago, but there is a lack of good documentation, so I only use it to make an ugly hacker prototype... But now I need reliable code Or did someone find a good document for overlay Weaver?

If the DHT framework supports Chord or Kademlia and can be invoked in my java application, it will be perfect.

Or does anyone know a better way to save reliable and fail safe short string data in distributed systems?

Solution

I think hazelcast is suitable for this situation It doesn't actually need to be set (more than you need to add dependencies to hazelcast jar) The following code example demonstrates how to set up a shared mapping

// Code in process 1
Config cfg = new Config();
HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
Map<Integer,String> sharedData = instance.getMap("shared");
sharedData.put(1,"This is shared data");

// Code in process 2
Config cfg = new Config();
HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg);
Map<Integer,String> sharedData = instance.getMap("shared");
String theSharedString = sharedData.get(1);

Hazelcast supports various shared data structures, including map, queue, list, atomiclong, idgenerator, etc. the documentation is good. According to my experience, the implementation is reliable

If you are using a rational build environment (such as Maven), you need the following dependencies to start with:

<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>hazelcast</artifactId>
    <version>3.4</version>
</dependency>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>