Disabling the Analytics subsystem on Kubernetes

During maintenance of an API Connect cluster, you can shut down the Analytics subsystem by disabling the client, ingestion, and storage microservices so that those processes are not running and there is no way to reach them.

Before you begin

Disabling the Analytics subsystem stops the collection and storage of data as well as making the subsystem unavailable. If you just want to pause data collection without disabling the entire subsystem (for example, while renewing certificates), see Stopping Analytics data collection.

About this task

When you disable Analytics, there will be no data in either the API Manager Dashboards or third-party offloads.

Procedure

  1. Back up your Analytics data as explained in Backing up and restoring the analytics database.
  2. Disable shard allocation for storage.

    Disabling shard allocation is optional, but is recommended because it prevents new shards from being created for replication when a node is unavailable, and helps avoid corruption issues in full system restarts. Disable shard allocation for storage by running the following command:

    kubectl -n namespace exec -it storage-master|shared_pod -- curl_es _cluster/settings -XPUT -d '{"persistent":{"cluster.routing.allocation.enable":"none"}}'
    where:
    • namespace is the namespace where the Analytics subsystem is installed.
    • storage-master|shared_pod is the name of any storage-master or storage-shared pod. You can get the name of your storage pods by running the following command and substituting in the namespace where Analytics is installed:
      kubectl -n namespace get po
    When you disable shard allocation, the response looks like the following example:
    {"acknowledged":true,"persistent":{"cluster":{"routing":{"allocation":{"enable":"none"}}}},"transient":{}}
  3. Unassociate the Analytics service from all gateway services.
    1. In Cloud Manager, click Topology icon Topology.
    2. In the section for the Availability Zone that contains the Analytics service, locate the Gateway service that the Analytics service is associated with.
    3. Click Actions menu and select Unassociate analytics service.
  4. Unregister the Analytics service from Cloud Manager:
    1. In Cloud Manager, click Topology icon Topology.
    2. In the section for the Availability Zone that contains the Analytics service, locate the Analytics service and click Delete.

    For more information, see Registering an analytics service.

  5. Perform a synced flush of storage.

    Flushing the storage is optional, but is recommended because it helps to avoid losing the data that was not yet written to disk. This step flushes all current index operations synchronously and attempts to write everything that is in flux to disk. Perform a synced flush of storage by running the following command:

    kubectl -n namespace exec -it storage-master|shared_pod -- curl_es _flush/synced -XPOST
    When you flush storage, the response looks like the following example:
    {"_shards":{"total":33,"successful":13,"failed":0},".export-status":{"total":1,"successful":1,"failed":0},".apic-config":{"total":1,"successful":1,"failed":0},".kibana-6":{"total":1,"successful":1,"failed":0},"apic-api-2020.06.19-000002":{"total":15,"successful":5,"failed":0},"apic-api-2020.06.18-1":{"total":15,"successful":5,"failed":0}}

    The operation often fails, and it is safe to rerun it multiple times until it passes and there are all "failed" counts are zero. If it continues to fail after running multiple attempts over the span of a couple minutes, you can proceed to the next step.

  6. Edit the Analytics CR to disable ingestion, storage, and the client.
    1. Run the following command to open the CR for editing:
      kubectl edit a7s -n <namespace>
    2. Add the enabled: false setting to the ingestion, storage, and client sections as in the following example:
      spec:
          client:
            enabled: false
          ingestion:
            enabled: false
          storage:
            enabled: false
    3. Save the change and exit the editor.