We can use the below script to truncate all the old tables that are no present in 21.2.3 Analytics – note that the cluster should have existed on 21.2.3 for more than 3 months (or whatever is the retention period) before we truncate these old tables. In other words, these tables will be referenced until the retention period has expired, even after upgrading to 21.2.3 and hence should not be truncated - it's only safe to truncate them once the cluster has been on 21.2.3 for a period longer than the retention period configured.
Procedure:
1. Create a file truncate.sh on any one of the Analytic nodes
2. Copy and paste the below script to the above file
3. Change the permissions of the file as below
chmod a+x truncate.sh
Execute the scrtip as below
sudo ./truncate.,sh
Below is the script to be used (copy and paste this while creating a script file on any one of the Analytics node as mentioned above)
#!/bin/bash
TABLES="tenantSrcFacts tenantDestFacts sdwanSite2SiteUsage_1 sdwanTcpAppPerfFacts sdwanSiteRuleUsage sdwanAppSubscriber sdwanSite2SiteSlam_1 sdwanSite2SiteSlaPathStatus tenantappfacts tenanturlcatfacts sdwanAppFacts_1 sdwanVRFUsage_1 tenanturlrepfacts tenantrulefacts tenantfwdclassfacts tenantzonefacts tenantsvcfacts sdwanWanUsage sdwanSiteUsage sdwanAccCktCos_1 sdwanSite2SiteSlaViolation sdwan_site_dia_rule_usage sdwanSite2SiteRuleUsage sdwanSite2SiteMos sdwanAccCktMos sdwanTraffCond sdwan_site2site_traffcond sdwan_site2site_traffcond intfUtil sdwanAccCktBw system_lte alarm_facts secacc_global_stats"
for table in $TABLES; do cqlsh -u cassandra -p cassandra -e "TRUNCATE van_analytics.${table}" ; done
Note: Post executing the script, you should run the below to clear snapshots
sudo nodetool clearsnapshot
Check "df -kh" before and after running the script to check the difference in the disk space