Hello ,

I am using DistributedMapCacheServer with setting of Persistent Directory. I 
can see contents of cache in the directory, but the contents do not survive 
nifi restart .
Older values from cache should be available after restart, right ?
I have attached template where I have configured client and distributed map 
cache server.
Based on answer in following link , data in cache should be available on 
restart.
https://community.cloudera.com/t5/Support-Questions/How-to-update-nifi-cache-on-nifi-service-restart/td-p/225434
Please provide insights on how I can achieve a persistent cache in which data 
survives pod restart .

Thanks,
Ravneet

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<template encoding-version="1.3">
    <description></description>
    <groupId>1bb85433-58b3-492a-b49c-24aac8ee538e</groupId>
    <name>DistributedMapCacheTestTemplate</name>
    <snippet>
        <controllerServices>
            <id>25c4ade7-73e8-326c-0000-000000000000</id>
            <parentGroupId>68c69c38-77cd-31e4-0000-000000000000</parentGroupId>
            <bundle>
                <artifact>nifi-distributed-cache-services-nar</artifact>
                <group>org.apache.nifi</group>
                <version>1.14.0</version>
            </bundle>
            <comments></comments>
            <descriptors>
                <entry>
                    <key>Server Hostname</key>
                    <value>
                        <name>Server Hostname</name>
                    </value>
                </entry>
                <entry>
                    <key>Server Port</key>
                    <value>
                        <name>Server Port</name>
                    </value>
                </entry>
                <entry>
                    <key>SSL Context Service</key>
                    <value>
                        <identifiesControllerService>org.apache.nifi.ssl.SSLContextService</identifiesControllerService>
                        <name>SSL Context Service</name>
                    </value>
                </entry>
                <entry>
                    <key>Communications Timeout</key>
                    <value>
                        <name>Communications Timeout</name>
                    </value>
                </entry>
            </descriptors>
            <name>NifiDistributedMapCacheClientService</name>
            <persistsState>false</persistsState>
            <properties>
                <entry>
                    <key>Server Hostname</key>
                    <value>localhost</value>
                </entry>
                <entry>
                    <key>Server Port</key>
                    <value>4557</value>
                </entry>
                <entry>
                    <key>SSL Context Service</key>
                </entry>
                <entry>
                    <key>Communications Timeout</key>
                    <value>30 secs</value>
                </entry>
            </properties>
            <state>ENABLED</state>
            <type>org.apache.nifi.distributed.cache.client.DistributedMapCacheClientService</type>
        </controllerServices>
        <processGroups>
            <id>655db25e-8f82-3854-0000-000000000000</id>
            <parentGroupId>68c69c38-77cd-31e4-0000-000000000000</parentGroupId>
            <position>
                <x>0.0</x>
                <y>0.0</y>
            </position>
            <comments></comments>
            <contents>
                <connections>
                    <id>01776a35-74e9-3acd-0000-000000000000</id>
                    <parentGroupId>655db25e-8f82-3854-0000-000000000000</parentGroupId>
                    <backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
                    <backPressureObjectThreshold>10000</backPressureObjectThreshold>
                    <destination>
                        <groupId>655db25e-8f82-3854-0000-000000000000</groupId>
                        <id>4ef3ace0-a8e6-39f2-0000-000000000000</id>
                        <type>PROCESSOR</type>
                    </destination>
                    <flowFileExpiration>0 sec</flowFileExpiration>
                    <labelIndex>1</labelIndex>
                    <loadBalanceCompression>DO_NOT_COMPRESS</loadBalanceCompression>
                    <loadBalancePartitionAttribute></loadBalancePartitionAttribute>
                    <loadBalanceStatus>LOAD_BALANCE_NOT_CONFIGURED</loadBalanceStatus>
                    <loadBalanceStrategy>DO_NOT_LOAD_BALANCE</loadBalanceStrategy>
                    <name>success</name>
                    <selectedRelationships>success</selectedRelationships>
                    <source>
                        <groupId>655db25e-8f82-3854-0000-000000000000</groupId>
                        <id>8d29055e-19e7-3e39-0000-000000000000</id>
                        <type>PROCESSOR</type>
                    </source>
                    <zIndex>0</zIndex>
                </connections>
                <connections>
                    <id>92298e96-c84c-37cd-0000-000000000000</id>
                    <parentGroupId>655db25e-8f82-3854-0000-000000000000</parentGroupId>
                    <backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
                    <backPressureObjectThreshold>10000</backPressureObjectThreshold>
                    <destination>
                        <groupId>655db25e-8f82-3854-0000-000000000000</groupId>
                        <id>8d29055e-19e7-3e39-0000-000000000000</id>
                        <type>PROCESSOR</type>
                    </destination>
                    <flowFileExpiration>0 sec</flowFileExpiration>
                    <labelIndex>1</labelIndex>
                    <loadBalanceCompression>DO_NOT_COMPRESS</loadBalanceCompression>
                    <loadBalancePartitionAttribute></loadBalancePartitionAttribute>
                    <loadBalanceStatus>LOAD_BALANCE_NOT_CONFIGURED</loadBalanceStatus>
                    <loadBalanceStrategy>DO_NOT_LOAD_BALANCE</loadBalanceStrategy>
                    <name>success</name>
                    <selectedRelationships>success</selectedRelationships>
                    <source>
                        <groupId>655db25e-8f82-3854-0000-000000000000</groupId>
                        <id>304f44e6-0cb8-343d-0000-000000000000</id>
                        <type>PROCESSOR</type>
                    </source>
                    <zIndex>0</zIndex>
                </connections>
                <connections>
                    <id>a357f9ef-66eb-39f7-0000-000000000000</id>
                    <parentGroupId>655db25e-8f82-3854-0000-000000000000</parentGroupId>
                    <backPressureDataSizeThreshold>1 GB</backPressureDataSizeThreshold>
                    <backPressureObjectThreshold>10000</backPressureObjectThreshold>
                    <destination>
                        <groupId>655db25e-8f82-3854-0000-000000000000</groupId>
                        <id>472727cd-b988-3533-0000-000000000000</id>
                        <type>PROCESSOR</type>
                    </destination>
                    <flowFileExpiration>0 sec</flowFileExpiration>
                    <labelIndex>1</labelIndex>
                    <loadBalanceCompression>DO_NOT_COMPRESS</loadBalanceCompression>
                    <loadBalancePartitionAttribute></loadBalancePartitionAttribute>
                    <loadBalanceStatus>LOAD_BALANCE_NOT_CONFIGURED</loadBalanceStatus>
                    <loadBalanceStrategy>DO_NOT_LOAD_BALANCE</loadBalanceStrategy>
                    <name>success</name>
                    <selectedRelationships>success</selectedRelationships>
                    <source>
                        <groupId>655db25e-8f82-3854-0000-000000000000</groupId>
                        <id>4ef3ace0-a8e6-39f2-0000-000000000000</id>
                        <type>PROCESSOR</type>
                    </source>
                    <zIndex>0</zIndex>
                </connections>
                <processors>
                    <id>304f44e6-0cb8-343d-0000-000000000000</id>
                    <parentGroupId>655db25e-8f82-3854-0000-000000000000</parentGroupId>
                    <position>
                        <x>2440.0</x>
                        <y>40.0</y>
                    </position>
                    <bundle>
                        <artifact>nifi-standard-nar</artifact>
                        <group>org.apache.nifi</group>
                        <version>1.14.0</version>
                    </bundle>
                    <config>
                        <bulletinLevel>WARN</bulletinLevel>
                        <comments></comments>
                        <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                        <descriptors>
                            <entry>
<key>File Size</key>
<value>
    <name>File Size</name>
</value>
                            </entry>
                            <entry>
<key>Batch Size</key>
<value>
    <name>Batch Size</name>
</value>
                            </entry>
                            <entry>
<key>Data Format</key>
<value>
    <name>Data Format</name>
</value>
                            </entry>
                            <entry>
<key>Unique FlowFiles</key>
<value>
    <name>Unique FlowFiles</name>
</value>
                            </entry>
                            <entry>
<key>generate-ff-custom-text</key>
<value>
    <name>generate-ff-custom-text</name>
</value>
                            </entry>
                            <entry>
<key>character-set</key>
<value>
    <name>character-set</name>
</value>
                            </entry>
                            <entry>
<key>mime-type</key>
<value>
    <name>mime-type</name>
</value>
                            </entry>
                        </descriptors>
                        <executionNode>ALL</executionNode>
                        <lossTolerant>false</lossTolerant>
                        <penaltyDuration>30 sec</penaltyDuration>
                        <properties>
                            <entry>
<key>File Size</key>
<value>500B</value>
                            </entry>
                            <entry>
<key>Batch Size</key>
<value>1</value>
                            </entry>
                            <entry>
<key>Data Format</key>
<value>Text</value>
                            </entry>
                            <entry>
<key>Unique FlowFiles</key>
<value>false</value>
                            </entry>
                            <entry>
<key>generate-ff-custom-text</key>
<value>${now()}</value>
                            </entry>
                            <entry>
<key>character-set</key>
<value>UTF-8</value>
                            </entry>
                            <entry>
<key>mime-type</key>
                            </entry>
                        </properties>
                        <runDurationMillis>0</runDurationMillis>
                        <schedulingPeriod>45 sec</schedulingPeriod>
                        <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                        <yieldDuration>1 sec</yieldDuration>
                    </config>
                    <executionNodeRestricted>false</executionNodeRestricted>
                    <name>GenerateFlowFile</name>
                    <relationships>
                        <autoTerminate>false</autoTerminate>
                        <name>success</name>
                    </relationships>
                    <state>RUNNING</state>
                    <style/>
                    <type>org.apache.nifi.processors.standard.GenerateFlowFile</type>
                </processors>
                <processors>
                    <id>472727cd-b988-3533-0000-000000000000</id>
                    <parentGroupId>655db25e-8f82-3854-0000-000000000000</parentGroupId>
                    <position>
                        <x>3112.0</x>
                        <y>552.0</y>
                    </position>
                    <bundle>
                        <artifact>nifi-standard-nar</artifact>
                        <group>org.apache.nifi</group>
                        <version>1.14.0</version>
                    </bundle>
                    <config>
                        <bulletinLevel>WARN</bulletinLevel>
                        <comments></comments>
                        <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                        <descriptors>
                            <entry>
<key>Log Level</key>
<value>
    <name>Log Level</name>
</value>
                            </entry>
                            <entry>
<key>Log Payload</key>
<value>
    <name>Log Payload</name>
</value>
                            </entry>
                            <entry>
<key>Attributes to Log</key>
<value>
    <name>Attributes to Log</name>
</value>
                            </entry>
                            <entry>
<key>attributes-to-log-regex</key>
<value>
    <name>attributes-to-log-regex</name>
</value>
                            </entry>
                            <entry>
<key>Attributes to Ignore</key>
<value>
    <name>Attributes to Ignore</name>
</value>
                            </entry>
                            <entry>
<key>attributes-to-ignore-regex</key>
<value>
    <name>attributes-to-ignore-regex</name>
</value>
                            </entry>
                            <entry>
<key>Log prefix</key>
<value>
    <name>Log prefix</name>
</value>
                            </entry>
                            <entry>
<key>character-set</key>
<value>
    <name>character-set</name>
</value>
                            </entry>
                        </descriptors>
                        <executionNode>ALL</executionNode>
                        <lossTolerant>false</lossTolerant>
                        <penaltyDuration>30 sec</penaltyDuration>
                        <properties>
                            <entry>
<key>Log Level</key>
<value>info</value>
                            </entry>
                            <entry>
<key>Log Payload</key>
<value>false</value>
                            </entry>
                            <entry>
<key>Attributes to Log</key>
                            </entry>
                            <entry>
<key>attributes-to-log-regex</key>
<value>.*</value>
                            </entry>
                            <entry>
<key>Attributes to Ignore</key>
                            </entry>
                            <entry>
<key>attributes-to-ignore-regex</key>
                            </entry>
                            <entry>
<key>Log prefix</key>
                            </entry>
                            <entry>
<key>character-set</key>
<value>UTF-8</value>
                            </entry>
                        </properties>
                        <runDurationMillis>0</runDurationMillis>
                        <schedulingPeriod>0 sec</schedulingPeriod>
                        <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                        <yieldDuration>1 sec</yieldDuration>
                    </config>
                    <executionNodeRestricted>false</executionNodeRestricted>
                    <name>LogAttribute</name>
                    <relationships>
                        <autoTerminate>true</autoTerminate>
                        <name>success</name>
                    </relationships>
                    <state>RUNNING</state>
                    <style/>
                    <type>org.apache.nifi.processors.standard.LogAttribute</type>
                </processors>
                <processors>
                    <id>4ef3ace0-a8e6-39f2-0000-000000000000</id>
                    <parentGroupId>655db25e-8f82-3854-0000-000000000000</parentGroupId>
                    <position>
                        <x>2448.0</x>
                        <y>432.0</y>
                    </position>
                    <bundle>
                        <artifact>nifi-standard-nar</artifact>
                        <group>org.apache.nifi</group>
                        <version>1.14.0</version>
                    </bundle>
                    <config>
                        <bulletinLevel>WARN</bulletinLevel>
                        <comments></comments>
                        <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                        <descriptors>
                            <entry>
<key>Cache Entry Identifier</key>
<value>
    <name>Cache Entry Identifier</name>
</value>
                            </entry>
                            <entry>
<key>Distributed Cache Service</key>
<value>
    <identifiesControllerService>org.apache.nifi.distributed.cache.client.DistributedMapCacheClient</identifiesControllerService>
    <name>Distributed Cache Service</name>
</value>
                            </entry>
                            <entry>
<key>Put Cache Value In Attribute</key>
<value>
    <name>Put Cache Value In Attribute</name>
</value>
                            </entry>
                            <entry>
<key>Max Length To Put In Attribute</key>
<value>
    <name>Max Length To Put In Attribute</name>
</value>
                            </entry>
                            <entry>
<key>Character Set</key>
<value>
    <name>Character Set</name>
</value>
                            </entry>
                        </descriptors>
                        <executionNode>ALL</executionNode>
                        <lossTolerant>false</lossTolerant>
                        <penaltyDuration>30 sec</penaltyDuration>
                        <properties>
                            <entry>
<key>Cache Entry Identifier</key>
<value>date</value>
                            </entry>
                            <entry>
<key>Distributed Cache Service</key>
<value>25c4ade7-73e8-326c-0000-000000000000</value>
                            </entry>
                            <entry>
<key>Put Cache Value In Attribute</key>
<value>date.retrieved</value>
                            </entry>
                            <entry>
<key>Max Length To Put In Attribute</key>
<value>256</value>
                            </entry>
                            <entry>
<key>Character Set</key>
<value>UTF-8</value>
                            </entry>
                        </properties>
                        <runDurationMillis>0</runDurationMillis>
                        <schedulingPeriod>0 sec</schedulingPeriod>
                        <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                        <yieldDuration>1 sec</yieldDuration>
                    </config>
                    <executionNodeRestricted>false</executionNodeRestricted>
                    <name>FetchDistributedMapCache</name>
                    <relationships>
                        <autoTerminate>true</autoTerminate>
                        <name>failure</name>
                    </relationships>
                    <relationships>
                        <autoTerminate>true</autoTerminate>
                        <name>not-found</name>
                    </relationships>
                    <relationships>
                        <autoTerminate>false</autoTerminate>
                        <name>success</name>
                    </relationships>
                    <state>RUNNING</state>
                    <style/>
                    <type>org.apache.nifi.processors.standard.FetchDistributedMapCache</type>
                </processors>
                <processors>
                    <id>8d29055e-19e7-3e39-0000-000000000000</id>
                    <parentGroupId>655db25e-8f82-3854-0000-000000000000</parentGroupId>
                    <position>
                        <x>3072.0</x>
                        <y>248.0</y>
                    </position>
                    <bundle>
                        <artifact>nifi-standard-nar</artifact>
                        <group>org.apache.nifi</group>
                        <version>1.14.0</version>
                    </bundle>
                    <config>
                        <bulletinLevel>WARN</bulletinLevel>
                        <comments></comments>
                        <concurrentlySchedulableTaskCount>1</concurrentlySchedulableTaskCount>
                        <descriptors>
                            <entry>
<key>Cache Entry Identifier</key>
<value>
    <name>Cache Entry Identifier</name>
</value>
                            </entry>
                            <entry>
<key>Distributed Cache Service</key>
<value>
    <identifiesControllerService>org.apache.nifi.distributed.cache.client.DistributedMapCacheClient</identifiesControllerService>
    <name>Distributed Cache Service</name>
</value>
                            </entry>
                            <entry>
<key>Cache update strategy</key>
<value>
    <name>Cache update strategy</name>
</value>
                            </entry>
                            <entry>
<key>Max cache entry size</key>
<value>
    <name>Max cache entry size</name>
</value>
                            </entry>
                        </descriptors>
                        <executionNode>ALL</executionNode>
                        <lossTolerant>false</lossTolerant>
                        <penaltyDuration>30 sec</penaltyDuration>
                        <properties>
                            <entry>
<key>Cache Entry Identifier</key>
<value>date</value>
                            </entry>
                            <entry>
<key>Distributed Cache Service</key>
<value>25c4ade7-73e8-326c-0000-000000000000</value>
                            </entry>
                            <entry>
<key>Cache update strategy</key>
<value>replace</value>
                            </entry>
                            <entry>
<key>Max cache entry size</key>
<value>1 MB</value>
                            </entry>
                        </properties>
                        <runDurationMillis>0</runDurationMillis>
                        <schedulingPeriod>0 sec</schedulingPeriod>
                        <schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
                        <yieldDuration>1 sec</yieldDuration>
                    </config>
                    <executionNodeRestricted>false</executionNodeRestricted>
                    <name>PutDistributedMapCache</name>
                    <relationships>
                        <autoTerminate>true</autoTerminate>
                        <name>failure</name>
                    </relationships>
                    <relationships>
                        <autoTerminate>false</autoTerminate>
                        <name>success</name>
                    </relationships>
                    <state>RUNNING</state>
                    <style/>
                    <type>org.apache.nifi.processors.standard.PutDistributedMapCache</type>
                </processors>
            </contents>
            <defaultBackPressureDataSizeThreshold>1 GB</defaultBackPressureDataSizeThreshold>
            <defaultBackPressureObjectThreshold>10000</defaultBackPressureObjectThreshold>
            <defaultFlowFileExpiration>0 sec</defaultFlowFileExpiration>
            <flowfileConcurrency>UNBOUNDED</flowfileConcurrency>
            <flowfileOutboundPolicy>STREAM_WHEN_AVAILABLE</flowfileOutboundPolicy>
            <name>CacheTest</name>
            <variables/>
        </processGroups>
    </snippet>
    <timestamp>08/17/2021 19:56:59 PDT</timestamp>
</template>

Reply via email to