0

1.Trying to create a cluster using Hazelcast. In case of data backup:

<hazelcast>
  <map name="**default**">
    <backup-count>1</backup-count>
  </map>
</hazelcast>

From the above snippet, just wanted to clarify what does "default" map name stands for? does it mean that all maps will have backup count 1, or the map name "default" will have a backup count of 1.

HazelCast Reference Link

  1. Is there a way I can iterate over all the maps across the cluster ?
RIshab R Bafna
  • 397
  • 1
  • 3
  • 7

1 Answers1

1
  1. The name "default" (not "**default**") means any map.

If you have doubt over this, create a cluster of two nodes, put some data into a Hazelcast map and kill one node. If backup count was 1 for that map, you won't have lost data for that map.

  1. Try

    Set<String> iMapNames = this.hazelcastInstance.getDistributedObjects().stream()
            .filter(distributedObject -> distributedObject instanceof IMap)
            .map(distributedObject -> distributedObject.getName()).collect(Collectors.toCollection(TreeSet::new));
    
    iMapNames.stream().forEach(name -> {
        IMap<?, ?> iMap = this.hazelcastInstance.getMap(name);
        System.out.printf("IMap: '%s'%n", iMap.getName());
    }
    
Neil Stevenson
  • 3,060
  • 9
  • 11