This document will explain how to load maps in hazelcast and view them on screen
Below steps can be followed to load sample data in Hazelcast IMDG cluster:
- Go to the directory where hazelcast cluster is installed and navigate to
bindirectory. - Add the map's information in
hazelcast.xml.For a sample on how to add map information referhazelcast.xmlpresent underhazelcast-cluster/src/main/resources. - Write loader class to load data in Hazelcast map. For sample refer
HazelcastMapLoader.javapresent underhazelcast-cluster/src/main/java/com/impetus/hazelcast/example. - Run
HazelcastMapLoader.javaclass to ingest records intestMapusing below commands:-
Add
hazelcast-cluster-startup-1.0.0.jarand lib present in<path to jar>/hazelcast-cluster-startup-1.0.0folder to classpath:CLASSPATH="<path to jar>/hazelcast-cluster-startup-1.0.0.jar:<path to jar>/lib/*" -
Add main class:
CLASSNAME=com.impetus.hazelcast.example.HazelcastMapLoader -
Call main class:
java -classpath $CLASSPATH $CLASSNAME -
This should load sample map in hazelcast cluster.
-
You will see following logs as shown below:
Apr 20, 2018 3:04:29 PM com.hazelcast.core.LifecycleService INFO: HazelcastClient[hz.client_0_dev][3.4.6] is STARTING Apr 20, 2018 3:04:29 PM com.hazelcast.core.LifecycleService INFO: HazelcastClient[hz.client_0_dev][3.4.6] is STARTED Apr 20, 2018 3:04:29 PM com.hazelcast.core.LifecycleService INFO: HazelcastClient[hz.client_0_dev][3.4.6] is CLIENT_CONNECTED Apr 20, 2018 3:04:29 PM com.hazelcast.client.spi.impl.ClusterListenerThread INFO: Members [1] { Member [localhost]:5701 }
-
- Open browser and enter url
http:<IP Address>:9000/#/hazelcast - To see the data in map, Go to
Mapsand then totestMap. - Click on
Browse. - Add the key in it and click on
Browsebutton. IntestMapthe keys are :Key1,Key2...Key999. - To clear the Map record from UI, click on
Cleartab. It will not remove the data from Hazelcast, but will only clear the screen.