'Infinispan - Cannot create more that one cache at startup using helm template

I want to create more than one cache using helm, my yaml is the following

deploy:
  infinispan:
    cacheContainer:
      distributedCache:
          - name: "mycache"
            mode: "SYNC"
            owners: "2"
            segments: "256"
            capacityFactor: "1.0"
            statistics: "false"
            encoding:
              mediaType: "application/x-protostream"
            expiration:
              lifespan: "3000"
              maxIdle: "1001"
            memory:
              maxCount: "1000000"
              whenFull: "REMOVE"
            partitionHandling:
              whenSplit: "ALLOW_READ_WRITES"
              mergePolicy: "PREFERRED_NON_NULL"
          - name: "mycache1"
            mode: "SYNC"
            owners: "2"
            segments: "256"
            capacityFactor: "1.0"
            statistics: "false"
            encoding:
              mediaType: "application/x-protostream"
            expiration:
              lifespan: "3000"
              maxIdle: "1001"
            memory:
              maxCount: "1000000"
              whenFull: "REMOVE"
            partitionHandling:
              whenSplit: "ALLOW_READ_WRITES"
              mergePolicy: "PREFERRED_NON_NULL"

when when i install the helm i get the following error

 Red Hat Data Grid Server failed to start org.infinispan.commons.configuration.io.ConfigurationReaderException: Missing required attribute(s): name[86,1]

I dont know if is possible to create more than one cache. I have followed the following documentation https://access.redhat.com/documentation/en-us/red_hat_data_grid/8.3/html/building_and_deploying_data_grid_clusters_with_helm/configuring-servers

Thanks for your help.

Alexis



Solution 1:[1]

Yes it's possible to define multiple caches. You have to use the format:

deploy:
  infinispan:
    cacheContainer:
      <1st-cache-name>:
        <cache-type>:
          <cache-definition>:
            ...
      <2nd-cache-name>:
        <cache-type>:
          <cache-definition>:

So in your case that will be:

deploy:
  infinispan:
    cacheContainer:
      mycache: # mycache definition follows
        distributedCache:
          mode: "SYNC"
          owners: "2"
          segments: "256"
          capacityFactor: "1.0"
          statistics: "false"
          encoding:
            mediaType: "application/x-protostream"
          expiration:
            lifespan: "3000"
            maxIdle: "1001"
          memory:
            maxCount: "1000000"
            whenFull: "REMOVE"
          partitionHandling:
            whenSplit: "ALLOW_READ_WRITES"
            mergePolicy: "PREFERRED_NON_NULL"
      mycache1: # mycache1 definition follows
        distributedCache:
          mode: "SYNC"
          owners: "2"
          segments: "256"
          capacityFactor: "1.0"
          statistics: "false"
          encoding:
            mediaType: "application/x-protostream"
          expiration:
            lifespan: "3000"
            maxIdle: "1001"
          memory:
            maxCount: "1000000"
            whenFull: "REMOVE"
          partitionHandling:
            whenSplit: "ALLOW_READ_WRITES"
            mergePolicy: "PREFERRED_NON_NULL"

See here for an example of how to define multiple caches in json/xml/yaml formats.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ryan Emerson