Configuring Maps
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.
Configuring the Map
Resource
Below are the configuration options for the Map
resource. You can find more detailed information in API Reference page.
Field | Description | ||
---|---|---|---|
|
Name of the map config to be created. If empty, the CR name will be used. It cannot be updated after the map config is created successfully. |
||
|
HazelcastResourceName defines the 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 max size.
|
||
|
Indexes to be created for the map data. |
||
|
When enabled, map data will be persisted.
|
||
|
Configuration options when you want to load/store the map entries from/to a persistent data store such as a relational database. You can learn more at Working With External Data.
|
||
|
Configuration options for listening for the map-level or entry-based events using the listeners provided by the Hazelcast’s eventing framework. You can learn more at Distributed Object Events.
|
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
persistenceEnabled: true
entryListeners:
- className: com.example.MyListener
includeValues: true
local: false
After creating the Map
resource, you can learn about its status with the following command
kubectl get map map-sample -o wide
NAME STATUS MESSAGE
map-sample Success