Persisting data on disk using Hazelcast

我怕爱的太早我们不能终老 提交于 2019-12-12 08:30:36

问题


I have installed HazelCast 2.5. I want to persist my records into disk. I learned that MapStore does this job. However i'm not sure how to implement MapStore.

Code i've written so far:

    public class MyMaps implements MapStore<String,String> {

public static Map<Integer, String> mapCustomers = Hazelcast.getMap("customers");

public static void main(String[] args) {
{ 
    mapCustomers.put(1, "Ram");
    mapCustomers.put(2, "David");
    mapCustomers.put(3, "Arun");

}

}

How do i put all these entries into disk.

Is it necessary to have a back-end like MySQL or PostgreSQL to use this class?

I believe the following function can be used:

public void delete(String arg0);
public void deleteAll(String arg0);
public void store(String arg0);
public void storeAll(String arg0);

I need a sample snippet of how to implement MapStore.

Please provide me with sample code.

Please Help.!!


回答1:


In following links you can find example map store implementations (fro SimpleDB and HBase).

  • Integrating Hazelcast and SimpleDB
  • Distribute with Hazelcast, Persist into HBase

Yes, you should have a centralized datastore and your MapStore implementation will connect and operate on.



来源:https://stackoverflow.com/questions/15132946/persisting-data-on-disk-using-hazelcast

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!