Hazelcast maps are used to distribute data across a cluster and make it easy to scale your applications while protecting data against member failures. You can create and configure maps using the Map resource.
Configure the Map Resource
You can use any of the following configuration options in the Map resource. For more information, see the API reference.
| Field | Description | ||
|---|---|---|---|
|
Name of the map to be created. If empty, the CR name will be used. It cannot be updated after the map is created successfully. |
||
|
Name of the Hazelcast resource. |
||
|
Count of synchronous backups. |
||
|
Maximum time in seconds for each entry to stay in the map. |
||
|
Maximum time in seconds for each entry to stay idle in the map. |
||
|
Configuration for removing data from the map when it reaches its maximum size.
|
||
|
Indexes to be created for the map data. |
||
|
Custom attributes for field queries when using the Predicates API. |
||
|
Whether to persist map data.
|
||
|
Configuration options for loading or storing map entries using a persistent data store such as a relational database. You can learn more at Working with external data.
|
||
|
Configuration options for listening for map-level or entry-based events using the listeners provided by the Hazelcast’s eventing framework. You can learn more at Distributed object events.
|
||
|
Configuration options for server side near cache. You can learn more at Near cache.
|
Example configuration
The following Map resource creates a map configuration for the Hazelcast custom resource that is defined in the hazelcastResourceName field.
apiVersion: hazelcast.com/v1alpha1
kind: Map
metadata:
name: map-sample
spec:
hazelcastResourceName: hazelcast-sample
backupCount: 1
timeToLiveSeconds: 0
maxIdleSeconds: 0
eviction:
evictionPolicy: NONE
maxSize: 0
maxSizePolicy: PER_NODE
indexes:
- type: HASH
name: index1
attributes:
- "name"
- "age"
- type: BITMAP
attributes:
- "name"
bitMapIndexOptions:
uniqueKey: id
uniqueKeyTransition: RAW
attributes:
- name: attribute1
extractorClassName: class1
persistenceEnabled: true
entryListeners:
- className: com.example.MyListener
includeValues: true
local: false
nearCache:
name: mostly-read-map
inMemoryFormat: OBJECT
invalidateOnChange: true
timeToLiveSeconds: 300
maxIdleSeconds: 300
eviction:
evictionPolicy: NONE
maxSizePolicy: ENTRY_COUNT
size: 5000
cacheLocalEntries: true
After creating the Map resource, you can check its status:
kubectl get map map-sample -o wide
NAME STATUS HAZELCAST-RESOURCE MESSAGE
map-sample Success hazelcast-sample