Setting up persistent data storage in Content Manager of the Cognos Analytics service instance

Set up a persistent data storage in Content Manager to hasten object searching after restarting the Cognos Analytics service instance.

You can configure a persistent storage for indexing files of a size that minimizes the time that is needed to restart the Cognos Analytics service instance and get results of object searches. For example, if you have up to 1 million objects in your content store, then create a persistent data storage of the size of 3 GB on the Content Manager pod.

Synopsis

set_cm_persist_data_size.sh [-h] -n namespace [-p <size_in_GB >]

Options

-t namespace
The namespace or project.
-p size_in_GB
The size of the Content Manager persistent data storage in GB.
Note: The size of the search index files grows by 3 GB approximately for every one million of objects.
-h
Prints help to the console and exits.

Example

The following example sets up the persistent data storage of the size of 6 GB on the Content Manager pod of the Cognos Analytics service instance:

./set_cm_persist_data_size.sh -t NAMESPACE -p 6

To change the volume of a persistent storage, you must first run the script with the size_in_GB equals zero, to remove the existing storage, and then run the script again with the value of the size_in_GB that you require, for example 9 GB:

./set_cm_persist_data_size.sh -t NAMESPACE
./set_cm_persist_data_size.sh -t NAMESPACE -p 9

Script file

The set_cm_persist_data_size.sh script is a file with the following contents:

#!/usr/bin/env bash
#
# -----------------------------------------------------------------------------
#         Licensed Materials - Property of IBM
#
#         IBM Cognos Products: ca
#
#         (C) Copyright IBM Corp. 2025
#
#         US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
# -----------------------------------------------------------------------------
#
#

set -e
#set -x

volume_size=0

function usage {
    echo "Usage: $0 [-h] -n namespace [-p <size in GB>]"
}

function help {
    usage
    echo "-h                prints help to the console"
    echo "-n namespace      namespace of cognos instance (required)"
    echo "-p size in GB     size of CM persisent data volume in GB. (default=${volume_size})"  
    echo "                  A zero value will reset and remove persistent volume."
    echo "                  If you need to resize the volume reset to 0 first, then set the new size."
    exit 0
}


while getopts ":hn:p:" opt; do
     case ${opt} in
     h)
        help
        ;;
     n)
        namespace=$OPTARG
        ;;
     p)
        volume_size=$OPTARG
        ;;
     \?)
        usage
        exit 0
        ;;
     esac
done

if [ -z $namespace ]; then
    echo "A namespace must be provided"
    help
fi

if [[ $volume_size =~ ^[0-9]+$ ]]
then
    echo "The volume size will be set to ${volume_size} GB."
else
    echo "The volume size is not a valid numeric"
    exit 1
fi

cr_name=$(oc -n ${namespace} get caserviceinstance --no-headers -o custom-columns=NAME:.metadata.name)

if [ -z $cr_name ]; then
    echo "Unable to find CAServiceInstance CR for namespace: ${namespace}"
    help
fi

echo "Setting CM persistent data volume in instance ${cr_name} ..."
oc patch caserviceinstance ${cr_name} --type merge -p "{\"spec\":{\"persistCmDataCacheSizeGb\":${volume_size}}}" -n ${namespace}
echo "Checking instance status ..."
sleep 20

# Checking status of ca reconcile
for i in {1..240};do
    caStatus=$(oc get caserviceinstance ${cr_name} -o jsonpath="{.status.caStatus}" -n ${namespace})
    failMessage=$(oc get caserviceinstance ${cr_name} -o jsonpath="{.status.failMessage}" -n ${namespace})
    ansibleMessage=$(oc get caserviceinstance ${cr_name} -o jsonpath='{.status.conditions[*].message}{"\n"}' -n ${namespace})
    progress=$(oc get caserviceinstance ${cr_name} -o jsonpath="{.status.progress}" -n ${namespace})
    progressMessage=$(oc get caserviceinstance ${cr_name} -o jsonpath="{.status.progressMessage}" -n ${namespace})

    if [[ ${caStatus} == "Completed" ]];then
        echo "Change Completed Successfully"
        break
    elif [[ ${caStatus} == "Failed" ]];then
        echo "Change ${caStatus} [${failMessage}]!"
        echo $ansibleMessage
        exit 1
    fi
    echo "Change Status: ${caStatus} [${progressMessage}] (${progress})"
    sleep 20
done