Cassandra-Verdichtungsstrategie ändern

Apigee verwendet die Cassandra-Datenbank zum Speichern der meisten Daten, einschließlich Daten für Proxys, Caches und Tokens. Die Komprimierung ist ein wichtiger Prozess zur Reduzierung der Größe der in Datenbanken gespeicherten Daten und ist für die Aufrechterhaltung effizienter Datenbankvorgänge unerlässlich. Cassandra unterstützt verschiedene Verdichtungsstrategien. Apigee empfiehlt allen Kunden von Edge for Private Cloud, ihre Cassandra-Cluster mit der LeveledCompactionStrategy anstelle der Standard-SizeTieredCompactionStrategy für alle Tabellen auszuführen. LeveledCompactionStrategy bietet eine bessere Leistung, eine bessere Laufwerksauslastung, effizientere Verdichtungen und benötigt weniger freien Speicherplatz im Vergleich zu SizeTieredCompactionStrategy.

Bei allen neuen Installationen von Apigee 4.52.02 oder höher wird Cassandra automatisch mit LeveledCompactionStrategy konfiguriert. Wenn Sie jedoch eine ältere Version von Apigee verwenden oder ein Upgrade auf Apigee 4.52.02 von einer älteren Version durchgeführt haben, wird in Ihrer Installation möglicherweise weiterhin Cassandra mit SizeTieredCompactionStrategy verwendet.

Es wird zwar nicht empfohlen, die Verdichtungsstrategie in eine andere Strategie als LeveledCompactionStrategy zu ändern, aber dieses Dokument beschreibt, wie Sie die Änderung bei Bedarf vornehmen können, und enthält Anweisungen zum Überprüfen Ihrer aktuellen Verdichtungsstrategie. Das Ändern der Verdichtungsstrategie in eine nicht empfohlene Option kann dazu führen, dass zukünftige Cassandra-Software-Upgrades Ihre Änderungen überschreiben. Wenn Sie einen nicht standardmäßigen Ansatz verwenden, sollten Sie Ihre Verdichtungsstrategie nach jedem Upgrade überprüfen.

Vorbereitung

Vorhandene Verdichtungsstrategie prüfen

Sie können die vorhandene Verdichtungsstrategie für Tabellen überprüfen. Folgen Sie dazu der Anleitung in Anhang 1. Wenn die Verdichtungsstrategie bereits LeveledCompactionStrategy ist, kann das daran liegen, dass sie mit der Installation von OPDK 4.51 oder höher begonnen oder zuvor gemäß den Empfehlungen von Apigee zu LeveledCompactionStrategy geändert wurde. Wenn Sie LeveledCompactionStrategy bereits verwenden, empfiehlt Apigee, mit dieser Strategie fortzufahren und Änderungen zu vermeiden. Da Edge for Private Cloud jedoch von Ihnen betrieben wird, können Sie in der folgenden Anleitung die Verdichtungsstrategie bei Bedarf ändern.

Back-up

Da eine Änderung der Verdichtungsstrategie einen vollständigen Verdichtungszyklus in Cassandra-Knoten auslöst, kann es aufgrund der Last durch Verdichtungen und gleichzeitigem Anwendungstraffic zu Latenzen kommen. Möglicherweise ist ein Rollback dieser Änderung erforderlich, um Cassandra-Knoten aus Sicherungen wiederherzustellen. Unter Informationen zum Sichern erfahren Sie, wie Sie Ihre Daten sichern, bevor Sie die Verdichtungsstrategie ändern.

Verdichtungsdurchsatz

Nachdem die Verdichtungsstrategie in LeveledCompactionStrategy geändert wurde, können Verdichtungen über einen langen Zeitraum ausgeführt werden. Je nach Größe der Datenverdichtung kann die Laufzeit variieren. Während des Verdichtungszyklus kann Cassandra weitere Systemressourcen verbrauchen. Damit die Verdichtung nicht viele Systemressourcen in Anspruch nimmt, was zu einer Unterbrechung von API-Laufzeitanfragen führen kann, empfehlen wir, Limits für den Verdichtungsdurchsatz festzulegen.

Führen Sie den folgenden nodetool-Befehl auf jedem der Knoten aus, um den Verdichtungsdurchsatz auf maximal 128 MB auf allen Cassandra-Knoten zu erhöhen:

nodetool setcompactionthroughput 128

Größe von VMs für Verdichtungen festlegen

Achten Sie darauf, dass die Cassandra-Knoten genügend CPU- und Arbeitsspeicherressourcen haben, bevor Sie diese Änderung ausführen. Achten Sie darauf, dass keine Cassandra-Knoten mit mehr als 25% der CPU-Auslastung arbeiten, bevor Sie diese Änderung ausführen.

Nach einer Änderung der Verdichtungsstrategie wird erwartet, dass ein vollständiger Verdichtungszyklus ausgeführt wird. Daher wird empfohlen, die Verdichtungsstrategie in Zeiten mit geringem Traffic zu ändern.

Gestaffelte Ausführungen

Sie können möglicherweise nicht alle Knoten innerhalb eines Tages ändern, insbesondere wenn Sie große Cassandra-Cluster betreiben, da die Indizes auf jedem Knoten einzeln neu erstellt werden müssen. Sie können die Verdichtungsstrategie für jeweils ein Schema oder für eine Tabelle ändern. Ändern Sie dazu die Verdichtungsstrategie der Tabelle und erstellen Sie dann alle Indizes in der Tabelle (falls vorhanden) auf allen Knoten neu. Wiederholen Sie dann das obige Verfahren für jede Tabelle oder jeden Schlüsselbereich. Solche Ausführungen für eine Tabelle oder einen Schlüsselbereich können so aufgeschlüsselt werden, dass sie über verschiedene Tage hinweg ausgeführt werden.

So ändern Sie beispielsweise die Verdichtungsstrategie der Tabelle oauth_20_access_tokens im Schema kms in LeveledCompactionStrategy:

  1. Ändern Sie die Tabelle, um die Verdichtungsstrategie zu ändern, indem Sie die folgende CQL ausführen:

    ALTER TABLE kms.oauth_20_access_tokens WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  2. Erstellen Sie alle Indizes nur dieser Tabelle neu:

    nodetool rebuild_index kms oauth_20_access_tokens oauth_20_access_tokens_app_id_idx
    nodetool rebuild_index kms oauth_20_access_tokens oauth_20_access_tokens_client_id_idx
    nodetool rebuild_index kms oauth_20_access_tokens oauth_20_access_tokens_refresh_token_idx   
        

Änderung der Verdichtungsstrategie

Grundsätzlich erfolgt die Änderung der Verdichtungsstrategie in zwei Schritten:

  1. Die Verdichtungsstrategie jeder Tabelle ändern.
  2. Erstellen Sie alle Indexe auf jedem Knoten einzeln neu.

Zum Ändern der Verdichtungsstrategie müssen Sie für jede Tabelle einzeln einen ALTER TABLE-Befehl ausführen. Hier ein Beispiel für einen ALTER TABLE-Befehl:

# To change to LeveledCompactionStrategy
ALTER TABLE kms.oauth_20_access_tokens WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  
# To change to SizeTieredCompactionStrategy
ALTER TABLE kms.oauth_20_access_tokens WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};

Tabelle ändern, um eine neue Verdichtungsstrategie festzulegen

Führen Sie die folgenden CQLs auf einem beliebigen Cassandra-Knoten aus, um die Strategie für jeweils einen Schlüsselraum zu ändern. CQLs können über die CQL-Eingabeaufforderung ausgeführt werden. Anleitung zum Aufrufen der CQL-Eingabeaufforderung:

/opt/apigee/apigee-cassandra/bin/cqlsh `hostname -i`

Um XXXXXXXX:9042 mit Apigee verbunden.

[cqlsh 5.0.1 | Cassandra 3.11.16 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

Mit den folgenden Befehlen wird die Änderung der Verdichtungsstrategie in LeveledCompactionStrategy beschrieben. Es können aber auch ähnliche Befehle für andere Verdichtungsstrategien verwendet werden.

Die Schritte 14 bis 16 unten gelten nur, wenn du die Monetarisierung nutzt.

  1. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: kms
    ALTER TABLE kms.organizations WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.maps WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.apps WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.app_credentials WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.api_products WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.apiproducts_appslist WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.api_resources WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.app_end_user WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.oauth_20_authorization_codes WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.oauth_20_access_tokens WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.oauth_10_request_tokens WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.oauth_10_access_tokens WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.oauth_10_verifiers WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE kms.app_enduser_tokens WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    
  2. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: user_settings
    ALTER TABLE user_settings.user_settings WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    
  3. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: keyvaluemap
    ALTER TABLE keyvaluemap.keyvaluemaps_r21 WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    
  4. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: devconnect
    ALTER TABLE devconnect.developers WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE devconnect.companies WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE devconnect.company_developers WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    
  5. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: counter
    ALTER TABLE counter.counters_current_version WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE counter.counters_with_expiry WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE counter.counters WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE counter.key_timestamp_count WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE counter.timestamp_key WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE counter.period_timestamp WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE counter.gateway_quota WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    
  6. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: cache
    ALTER TABLE cache.cache_entries WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE cache.cache_sequence_id_r24 WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    
  7. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: auth
    ALTER TABLE auth.totp WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  8. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: audit
    ALTER TABLE audit.audits WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE audit.audits_ref WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    
  9. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: apprepo
    ALTER TABLE apprepo.organizations WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apprepo.environments WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apprepo.apiproxies WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apprepo.apiproxy_revisions WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apprepo.api_proxy_revisions_r21 WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  10. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: apimodel_v2
    ALTER TABLE apimodel_v2.apis WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.apis_revision WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.resource WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.method WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.revision_counters WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.template_counters WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.template WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.credentials WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.credentialsv2 WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.schemas WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.security WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel_v2.template_auth WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  11. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: identityzone
    ALTER TABLE identityzone.IdentityZones WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE identityzone.OrgToIdentityZone WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  12. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: dek
    ALTER TABLE dek.keys WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  13. CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum: analytics
    ALTER TABLE analytics.custom_aggregates_defn WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE analytics.custom_rules_defn WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE analytics.custom_aggregates_defn_updates WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE analytics.custom_rules_defn_updates WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  14. [Nur Monetarisierung] CQLs zur Änderung der Verdichtungsstrategie für den Schlüsselbereich: mint
    ALTER TABLE mint.limits WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE mint.suspended_developer_products WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE mint.invitations WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  15. [Nur Monetarisierung] CQLs zur Änderung der Verdichtungsstrategie für den Schlüsselbereich: taurus
    ALTER TABLE taurus.triggers WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE taurus.job_details WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE taurus.org_triggers WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE taurus.triggers_suite WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  16. [Nur Monetarisierung] CQLs zur Änderung der Verdichtungsstrategie für den Schlüsselbereich: notification
    ALTER TABLE notification.notification_service_item WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE notification.notification_service_black_list_item WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE notification.notification_email_template_item WITH compaction = {'class' : 'LeveledCompactionStrategy'};

Indizes neu erstellen

Dieser Schritt muss nach jeder Änderung der Verdichtungsstrategie ausgeführt werden. Führen Sie die folgenden nodetool-Befehle nacheinander auf jedem Cassandra-Knoten aus.

Die Schritte 7 bis 9 unten gelten nur, wenn du die Monetarisierung nutzt.

  1. Indexe für Schlüsselraum neu erstellen: kms

    nodetool rebuild_index kms api_products api_products_organization_name_idx
    nodetool rebuild_index kms app_credentials app_credentials_api_products_idx
    nodetool rebuild_index kms app_credentials app_credentials_organization_app_id_idx
    nodetool rebuild_index kms app_credentials app_credentials_organization_name_idx
    nodetool rebuild_index kms app_end_user app_end_user_app_id_idx
    nodetool rebuild_index kms apps apps_app_family_idx
    nodetool rebuild_index kms apps apps_app_id_idx
    nodetool rebuild_index kms apps apps_app_type_idx
    nodetool rebuild_index kms apps apps_name_idx
    nodetool rebuild_index kms apps apps_organization_name_idx
    nodetool rebuild_index kms apps apps_parent_id_idx
    nodetool rebuild_index kms apps apps_parent_status_idx
    nodetool rebuild_index kms apps apps_status_idx
    nodetool rebuild_index kms maps maps_organization_name_idx
    nodetool rebuild_index kms oauth_10_access_tokens oauth_10_access_tokens_app_id_idx
    nodetool rebuild_index kms oauth_10_access_tokens oauth_10_access_tokens_consumer_key_idx
    nodetool rebuild_index kms oauth_10_access_tokens oauth_10_access_tokens_organization_name_idx
    nodetool rebuild_index kms oauth_10_access_tokens oauth_10_access_tokens_status_idx
    nodetool rebuild_index kms oauth_10_request_tokens oauth_10_request_tokens_consumer_key_idx
    nodetool rebuild_index kms oauth_10_request_tokens oauth_10_request_tokens_organization_name_idx
    nodetool rebuild_index kms oauth_10_verifiers oauth_10_verifiers_organization_name_idx
    nodetool rebuild_index kms oauth_10_verifiers oauth_10_verifiers_request_token_idx
    nodetool rebuild_index kms oauth_20_access_tokens oauth_20_access_tokens_app_id_idx
    nodetool rebuild_index kms oauth_20_access_tokens oauth_20_access_tokens_client_id_idx
    nodetool rebuild_index kms oauth_20_access_tokens oauth_20_access_tokens_refresh_token_idx
    nodetool rebuild_index kms oauth_20_authorization_codes oauth_20_authorization_codes_client_id_idx
    nodetool rebuild_index kms oauth_20_authorization_codes oauth_20_authorization_codes_organization_name_idx
    
  2. Indexe für Schlüsselraum neu erstellen: devconnect

    nodetool rebuild_index devconnect companies companies_name_idx
    nodetool rebuild_index devconnect companies companies_organization_name_idx
    nodetool rebuild_index devconnect companies companies_status_idx
    nodetool rebuild_index devconnect company_developers company_developers_company_name_idx
    nodetool rebuild_index devconnect company_developers company_developers_developer_email_idx
    nodetool rebuild_index devconnect company_developers company_developers_organization_name_idx
    nodetool rebuild_index devconnect developers developers_email_idx
    nodetool rebuild_index devconnect developers developers_organization_name_idx
    nodetool rebuild_index devconnect developers developers_status_idx
    
  3. Indexe für Schlüsselraum neu erstellen: cache

    nodetool rebuild_index cache cache_entries cache_entries_cache_name_idx
    
  4. Indexe für Schlüsselraum neu erstellen: audit

    nodetool rebuild_index audit audits audits_operation_idx
    nodetool rebuild_index audit audits audits_requesturi_idx
    nodetool rebuild_index audit audits audits_responsecode_idx
    nodetool rebuild_index audit audits audits_timestamp_idx
    nodetool rebuild_index audit audits audits_user_idx
    
  5. Indexe für Schlüsselraum neu erstellen: apimodel_v2

    nodetool rebuild_index apimodel_v2 apis a_name
    nodetool rebuild_index apimodel_v2 apis a_org_name
    nodetool rebuild_index apimodel_v2 apis_revision ar_a_active_rev
    nodetool rebuild_index apimodel_v2 apis_revision ar_a_def_index_template
    nodetool rebuild_index apimodel_v2 apis_revision ar_a_def_method_template
    nodetool rebuild_index apimodel_v2 apis_revision ar_a_latest_rev
    nodetool rebuild_index apimodel_v2 apis_revision ar_a_name
    nodetool rebuild_index apimodel_v2 apis_revision ar_a_uuid
    nodetool rebuild_index apimodel_v2 apis_revision ar_base_url
    nodetool rebuild_index apimodel_v2 apis_revision ar_is_active
    nodetool rebuild_index apimodel_v2 apis_revision ar_is_latest
    nodetool rebuild_index apimodel_v2 apis_revision ar_name
    nodetool rebuild_index apimodel_v2 apis_revision ar_org_name
    nodetool rebuild_index apimodel_v2 apis_revision ar_rel_ver
    nodetool rebuild_index apimodel_v2 apis_revision ar_rev_num
    nodetool rebuild_index apimodel_v2 method m_a_name
    nodetool rebuild_index apimodel_v2 method m_api_uuid
    nodetool rebuild_index apimodel_v2 method m_ar_uuid
    nodetool rebuild_index apimodel_v2 method m_base_url
    nodetool rebuild_index apimodel_v2 method m_name
    nodetool rebuild_index apimodel_v2 method m_org_name
    nodetool rebuild_index apimodel_v2 method m_r_name
    nodetool rebuild_index apimodel_v2 method m_r_uuid
    nodetool rebuild_index apimodel_v2 method m_res_path
    nodetool rebuild_index apimodel_v2 method m_rev_num
    nodetool rebuild_index apimodel_v2 resource r_a_name
    nodetool rebuild_index apimodel_v2 resource r_api_uuid
    nodetool rebuild_index apimodel_v2 resource r_ar_uuid
    nodetool rebuild_index apimodel_v2 resource r_base_url
    nodetool rebuild_index apimodel_v2 resource r_name
    nodetool rebuild_index apimodel_v2 resource r_org_name
    nodetool rebuild_index apimodel_v2 resource r_res_path
    nodetool rebuild_index apimodel_v2 resource r_rev_num
    nodetool rebuild_index apimodel_v2 schemas s_api_uuid
    nodetool rebuild_index apimodel_v2 schemas s_ar_uuid
    nodetool rebuild_index apimodel_v2 security sa_api_uuid
    nodetool rebuild_index apimodel_v2 security sa_ar_uuid
    nodetool rebuild_index apimodel_v2 template t_a_name
    nodetool rebuild_index apimodel_v2 template t_a_uuid
    nodetool rebuild_index apimodel_v2 template t_entity
    nodetool rebuild_index apimodel_v2 template t_name
    nodetool rebuild_index apimodel_v2 template t_org_name
    nodetool rebuild_index apimodel_v2 template_auth au_api_uuid
    
  6. Indexe für Schlüsselraum neu erstellen: dek

    nodetool rebuild_index dek keys usecase_index
    
  7. [Nur Monetarisierung] Indexe für Schlüsselraum neu erstellen: mint

    nodetool rebuild_index mint limits limits_created_date_idx
    nodetool rebuild_index mint limits limits_id_idx
    nodetool rebuild_index mint limits limits_org_id_idx
    nodetool rebuild_index mint limits limits_updated_date_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_created_date_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_currency_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_dev_id_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_id_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_limit_id_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_org_id_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_prod_id_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_reason_code_idx
    nodetool rebuild_index mint suspended_developer_products suspended_developer_products_sub_org_id_idx
    nodetool rebuild_index mint invitations invitations_company_id_idx
    nodetool rebuild_index mint invitations invitations_created_at_idx
    nodetool rebuild_index mint invitations invitations_developer_id_idx
    nodetool rebuild_index mint invitations invitations_lastmodified_at_idx
    nodetool rebuild_index mint invitations invitations_org_id_idx
    
  8. [Nur Monetarisierung] Indexe für Schlüsselraum neu erstellen: taurus

    nodetool rebuild_index taurus triggers triggers_env_idx
    nodetool rebuild_index taurus triggers triggers_job_id_idx
    nodetool rebuild_index taurus triggers triggers_org_id_idx
    nodetool rebuild_index taurus job_details job_details_job_class_name_idx
    nodetool rebuild_index taurus job_details job_details_job_group_idx
    nodetool rebuild_index taurus job_details job_details_job_name_idx
    nodetool rebuild_index taurus org_triggers org_triggers_org_id_idx
    nodetool rebuild_index taurus triggers_suite triggers_suite_group_idx
    nodetool rebuild_index taurus triggers_suite triggers_suite_name_idx
    nodetool rebuild_index taurus triggers_suite triggers_suite_suite_id_idx
    
  9. [Nur Monetarisierung] Indexe für Schlüsselraum neu erstellen: notification

    nodetool rebuild_index notification notification_service_item notification_service_item_org_id_idx
    nodetool rebuild_index notification notification_service_item notification_service_item_status_idx
    nodetool rebuild_index notification notification_service_black_list_item notification_service_black_list_item_org_id_idx
    nodetool rebuild_index notification notification_service_black_list_item notification_service_black_list_item_to_email_idx
    nodetool rebuild_index notification notification_email_template_item notification_email_template_item_name_idx
    nodetool rebuild_index notification notification_email_template_item notification_email_template_item_org_id_idx
    

Überprüfung

  1. Folgen Sie der Anleitung in Anhang 1, um zu prüfen, ob die Änderung der Verdichtungsstrategie auf dem Schema wirksam ist.
  2. Prüfen Sie, ob die Verdichtung erfolgreich ausgeführt wurde und die Daten nach der Strategieänderung komprimiert wurden:
    1. Führen Sie auf jedem Cassandra-Knoten den folgenden nodetool-Befehl aus, um zu sehen, ob alle Verdichtungen abgeschlossen sind und nichts aussteht:
      nodetool compactionstats
    2. Nachdem Sie mit dem obigen Befehl verifiziert haben, dass keine Verdichtungen ausstehen, prüfen Sie, ob der Zeitstempel der letzten Änderung der Datendateien (unter /opt/apigee/data/apigee-cassandra/data/) nach dem Zeitstempel liegt, zu dem die CQL-Änderung der Verdichtungsstrategie ausgeführt wurde.

Rollback

Falls Sie ein Rollback durchführen müssen, können Sie eine der folgenden Optionen auswählen:

Option 1: Änderung rückgängig machen

Führen Sie ein Rollback der Verdichtungsstrategie auf die Strategie durch, die Sie ursprünglich hatten.

Führen Sie ähnliche ALTER TABLE-Befehle in der CQL-Eingabeaufforderung aus, die Sie zuvor ausgeführt haben, um die Verdichtungsstrategie zu ändern.

Wenn Sie bereits die Indizes neu erstellt haben, während Sie die Verdichtungsstrategie in LeveledCompactionStrategy geändert haben, müssen Sie die Indizes noch einmal neu erstellen. Führen Sie dieselben Schritte wie zuvor für die Neuerstellung aller Indexe aus. Wenn Sie die Indexe zuvor nicht neu erstellt haben, müssen Sie die Indexe während des Rollbacks nicht neu erstellen.

Option 2: Vollständige Datenwiederherstellung aus einer Sicherung

Stellen Sie Daten aus der Sicherung für alle Schlüsselbereiche wieder her:

Folgen Sie der Anleitung zur Wiederherstellung, wie unter Aus einer Sicherung wiederherstellen beschrieben.

Anhang 1: Verdichtungsstrategie prüfen

Verdichtungsstrategien werden in Cassandra auf Tabellenebene festgelegt. Mit den folgenden Abfragen können Sie die Verdichtungsstrategie für die einzelnen Tabellen prüfen.

Sie können CQLs über die CQL-Eingabeaufforderung ausführen. So rufen Sie die CQL-Eingabeaufforderung auf:

/opt/apigee/apigee-cassandra/bin/cqlsh `hostname -i`

Die Antwort sieht in etwa so aus:

Connected to apigee at XX.XX.XX.XX:9042.
[cqlsh 5.0.1 | Cassandra 3.11.16 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

Die aktuelle Verdichtungsstrategie lässt sich so festlegen:

Jede Zeile in der Ausgabe gehört zu einer Tabelle innerhalb eines Schlüsselraums. Für jede Zeile gibt die Spalte compaction die von der Tabelle verwendete Verdichtungsstrategie an.

  • Wenn die Verdichtungsstrategie auf „SizeTieredCompactionStrategy“ festgelegt ist, sieht die Spalte compaction in den folgenden Abfragen in etwa so aus:
  • {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
  • Wenn die Verdichtungsstrategie auf LeveledCompactionStrategy festgelegt ist, sieht die Spalte compaction in den folgenden Abfragen in etwa so aus:
  • {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}

Die folgenden Abfragen können ausgeführt werden, um die Verdichtungsstrategie für jede Tabelle in einem bestimmten Schlüsselbereich zu bestimmen:

select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'kms';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'user_settings';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'keyvaluemap';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'devconnect';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'counter';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'cache';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'auth';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'audit';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'apprepo';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'apimodel_v2';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'identityzone';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'dek';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'analytics';

#If you are using Monetization, check the below as well
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'mint';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'taurus';
select keyspace_name, table_name, compaction from system_schema.tables where keyspace_name = 'notification';