Cassandra-Verdichtungsstrategie ändern

Apigee verwendet zum Speichern der meisten Daten Cassandra-Datenbanken, einschließlich Daten für Proxys, Caches und Tokens. Die Verdichtung ist ein Standardprozess zur Reduzierung der Größe der in Datenbanken gespeicherten Daten. Dies ist für einen effizienten Betrieb der Datenbanken von entscheidender Bedeutung. Cassandra unterstützt verschiedene Strategien für die Verdichtung. Apigee empfiehlt allen Edge for Private Cloud-Kunden, ihre Cassandra-Cluster für alle Spaltenfamilien mit der Strategie LeveledCompactionStrategy und nicht mit der Standardstrategie SizeTieredCompactionStrategy zu betreiben. LeveledCompactionStrategy bietet eine bessere Leistung, eine bessere Laufwerksauslastung, effizientere Verdichtungen und benötigt weniger freien Speicherplatz als SizedTieredCompactionStrategy.

Bei allen neuen Installationen von Apigee 4.51.00 oder höher wird Cassandra automatisch mit LeveledCompactionStrategy eingerichtet. Wenn Sie jedoch eine ältere Version von Apigee verwenden oder von einer älteren Version ein Upgrade auf Apigee 4.51.00 durchgeführt haben, verwendet Ihre Version möglicherweise noch Cassandra mit SizeTieredCompactionStrategy. Informationen dazu, welche Verdichtungsstrategie Ihre Version von Cassandra verwendet, finden Sie im Abschnitt Verdichtungsstrategie prüfen.

Auf dieser Seite wird erläutert, wie Sie die Verdichtungsstrategie in LeveledCompactionStrategy ändern.

Vorbereitung

Vorhandene Verdichtungsstrategie prüfen

Folgen Sie der Anleitung unter Verdichtungsstrategie prüfen, um die vorhandene Verdichtungsstrategie für Spaltenfamilien zu prüfen. Wenn die Komprimierungsstrategie bereits LeveledCompactionStrategy lautet, müssen Sie die restlichen Schritte auf dieser Seite nicht ausführen.

Back-up

Da eine Änderung der Verdichtungsstrategie einen vollständigen Verdichtungszyklus in C*-Knoten auslöst, kann es aufgrund der Last der Verdichtungen und des gleichzeitigen Anwendungstraffics zu Latenzen kommen. Ein Rollback dieser Änderung kann erforderlich sein, um Cassandra-Knoten aus Sicherungen wiederherzustellen. Unter Daten sichern erfahren Sie, wie Sie Ihre Daten sichern, bevor Sie die Verdichtungsstrategie ändern.

Verdichtungsdurchsatz

Nachdem die Komprimierungsstrategie in LeveledCompactionStrategy geändert wurde, können Verdichtungen noch lange ausgeführt werden. Abhängig von der Größe der Datenverdichtung kann die Laufzeit variieren. Während des Verdichtungszyklus verbraucht Cassandra möglicherweise mehr Systemressourcen. Damit die Verdichtung nicht viele Systemressourcen in Anspruch nimmt, was zu Störungen der 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 allen C*-Knoten auf maximal 128 MB festzulegen:

nodetool setcompactionthroughput 128

Größe von VMs für Verdichtungen

Achten Sie darauf, dass C*-Knoten genügend CPU-/Arbeitsspeicherressourcen haben, bevor Sie diese Änderung ausführen. Achten Sie darauf, dass keine C*-Knoten mit mehr als 25% der CPU-Auslastung ausgeführt werden, bevor Sie diese Änderung vornehmen.

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 Läufe

Möglicherweise sind Sie nicht in der Lage, den Wechsel aller Knoten innerhalb eines Tages abzuschließen, insbesondere wenn Sie große Cassandra-Cluster betreiben, da die Indizes auf jedem Knoten einzeln neu erstellt werden müssen. Sie können die Komprimierungsstrategie jeweils nur für ein Schema oder eine Spaltenfamilie (Tabelle) ändern. Ändern Sie dazu die Spaltenfamilie, um ihre Komprimierungsstrategie zu ändern, und erstellen Sie dann alle Indexe 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 einzelne Tabelle oder einen Schlüsselbereich können so aufgeschlüsselt werden, dass sie über verschiedene Tage hinweg ausgeführt werden.

So können Sie beispielsweise die Verdichtungsstrategie der Spaltenfamilie oauth_20_access_tokens im Schema kms ändern:

  1. Tabelle ändern, um die Verdichtungsstrategie zu ändern:
       
    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

Verdichtungsstrategie ändern

Grundsätzlich besteht das Ändern der Verdichtungsstrategie in zwei Schritten:

  1. Komprimierungsstrategie jeder Tabelle ändern.
  2. Erstellen Sie nacheinander alle Indizes auf jedem Knoten neu.

Tabelle ändern, um neue Verdichtungsstrategie festzulegen

Führen Sie die folgenden Cassandra Query Language-Befehle (CQL) auf einem beliebigen Cassandra-Knoten aus und ändern Sie die Strategie für jeweils einen Schlüsselraum. CQLs können über die cql-Eingabeaufforderung ausgeführt werden. So rufen Sie die Eingabeaufforderung cql auf:

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

Die Antwort sieht ungefähr so aus:

Connected to apigee at XX.XX.XX.XX:9042.
[cqlsh 5.0.1 | Cassandra 2.1.16 | CQL spec 3.2.1 | Native
protocol v3]
Use HELP for help.
cqlsh>

Führen Sie die folgenden CQLs aus, um die Komprimierungsstrategie zu ändern:

  • 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'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum user_settings:
    ALTER TABLE user_settings.user_settings WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum keyvaluemap:
       
    ALTER TABLE keyvaluemap.keyvaluemaps_r21 WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  • 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'};
  • 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'};
  • 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'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum ax_custom_report_model:
    ALTER TABLE ax_custom_report_model.report_description WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.report_id_lookup WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.org_metadata WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.org_report_lookup WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.report_created_view WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.report_viewed_view WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum auth:
    ALTER TABLE auth.totp WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  • 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'};
  • 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'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum apimodel:
    ALTER TABLE apimodel.apis WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.apis_revision WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.resource WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.method WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.revision_counters WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.template_counters WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.template WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.credentials WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.credentialsv2 WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.schemas WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.security WITH compaction = {'class' : 'LeveledCompactionStrategy'};
    ALTER TABLE apimodel.template_auth WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  • 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'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum dek:
    ALTER TABLE dek.keys WITH compaction = {'class' : 'LeveledCompactionStrategy'};
  • 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'};

Indexe neu erstellen

Sie müssen diesen Schritt nach der Änderung der Verdichtungsstrategie ausführen. Führen Sie die folgenden nodetool-Befehle nacheinander auf jedem Cassandra-Knoten aus.

Führen Sie die folgenden nodetool-Befehle aus, um Indexe neu zu erstellen:

  • Indexe für Schlüsselbereich kms neu erstellen:
    nodetool rebuild_index kms maps maps_organization_name_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 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 api_products api_products_organization_name_idx
    nodetool rebuild_index kms app_end_user app_end_user_app_id_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
    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_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_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_verifiers oauth_10_verifiers_organization_name_idx
    nodetool rebuild_index kms oauth_10_verifiers oauth_10_verifiers_request_token_idx
  • Indexe für Schlüsselbereich devconnect neu erstellen:
    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
  • Indexe für Schlüsselbereich cache neu erstellen:
        
    nodetool rebuild_index cache cache_entries cache_entries_cache_name_idx
  • Indexe für Schlüsselbereich audit neu erstellen:
    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
  • Indexe für Schlüsselbereich apprepo neu erstellen:
    nodetool rebuild_index apprepo environments environments_organization_name_idx
  • Indexe für Schlüsselbereich apimodel neu erstellen:
    nodetool rebuild_index apimodel apis a_name
    nodetool rebuild_index apimodel apis a_org_name
    nodetool rebuild_index apimodel apis_revision ar_a_name
    nodetool rebuild_index apimodel apis_revision ar_a_uuid
    nodetool rebuild_index apimodel apis_revision ar_base_url
    nodetool rebuild_index apimodel apis_revision ar_is_active
    nodetool rebuild_index apimodel apis_revision ar_is_latest
    nodetool rebuild_index apimodel apis_revision ar_org_name
    nodetool rebuild_index apimodel apis_revision ar_rel_ver
    nodetool rebuild_index apimodel apis_revision ar_rev_num
    nodetool rebuild_index apimodel resource r_a_name
    nodetool rebuild_index apimodel resource r_api_uuid
    nodetool rebuild_index apimodel resource r_ar_uuid
    nodetool rebuild_index apimodel resource r_base_url
    nodetool rebuild_index apimodel resource r_name
    nodetool rebuild_index apimodel resource r_org_name
    nodetool rebuild_index apimodel resource r_res_path
    nodetool rebuild_index apimodel resource r_rev_num
    nodetool rebuild_index apimodel method m_a_name
    nodetool rebuild_index apimodel method m_api_uuid
    nodetool rebuild_index apimodel method m_ar_uuid
    nodetool rebuild_index apimodel method m_base_url
    nodetool rebuild_index apimodel method m_name
    nodetool rebuild_index apimodel method m_org_name
    nodetool rebuild_index apimodel method m_r_name
    nodetool rebuild_index apimodel method m_r_uuid
    nodetool rebuild_index apimodel method m_res_path
    nodetool rebuild_index apimodel method m_rev_num
    nodetool rebuild_index apimodel method m_verb
    nodetool rebuild_index apimodel template t_a_name
    nodetool rebuild_index apimodel template t_a_uuid
    nodetool rebuild_index apimodel template t_entity
    nodetool rebuild_index apimodel template t_name
    nodetool rebuild_index apimodel template t_org_name
    nodetool rebuild_index apimodel schemas s_api_uuid
    nodetool rebuild_index apimodel schemas s_ar_uuid
    nodetool rebuild_index apimodel security sa_api_uuid
    nodetool rebuild_index apimodel security sa_ar_uuid
    nodetool rebuild_index apimodel template_auth au_api_uuid
  • Indexe für Schlüsselbereich dek neu erstellen:
    nodetool rebuild_index dek keys usecase_index

Überprüfung

  1. Prüfen Sie, ob die Änderung der Komprimierungsstrategie für das Schema wirksam wurde. Folgen Sie dazu der Anleitung unter Verdichtungsstrategie prüfen.
  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 prüfen, ob alle Verdichtungen abgeschlossen sind und nichts aussteht:
      nodetool compactionstats
    2. Nachdem Sie mit dem obigen Befehl überprüft haben, ob Verdichtungen anstehen, prüfen Sie den zuletzt geänderten Zeitstempel der Datendateien (unter /opt/apigee/data/apigee-cassandra/data/), damit er nach dem Zeitstempel liegt, an dem die CQL-Datei zur Änderung der Komprimierungsstrategie ausgeführt wurde.

Rollback durchführen

Für den Fall, dass Sie ein Rollback durchführen möchten, haben Sie folgende Möglichkeiten:

Option 1: Änderung rückgängig machen

Führen Sie ein Rollback der Verdichtungsstrategie auf SizeTieredCompactionStrategy durch.

Führen Sie die folgenden CQLs auf einem beliebigen Cassandra-Knoten aus, der die Strategie für jeweils einen Schlüsselbereich ändert. Sie können CQLs an der cql-Eingabeaufforderung ausführen. So rufen Sie die cql-Eingabeaufforderung auf:

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

Die Antwort sieht ungefähr so aus:

Connected to apigee at XX.XX.XX.XX:9042.
[cqlsh 5.0.1 | Cassandra 2.1.16 | CQL spec 3.2.1 | Native
protocol v3]
Use HELP for help.
cqlsh>

Führen Sie die folgenden CQLs aus, um die Komprimierungsstrategie zu ändern:

  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum kms:
    ALTER TABLE kms.organizations WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.maps WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.apps WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.app_credentials WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.api_products WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.apiproducts_appslist WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.api_resources WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.app_end_user WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.oauth_20_authorization_codes WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.oauth_20_access_tokens WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.oauth_10_request_tokens WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.oauth_10_access_tokens WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.oauth_10_verifiers WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE kms.app_enduser_tokens WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum user_settings:
    ALTER TABLE user_settings.user_settings WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum keyvaluemap:
    ALTER TABLE keyvaluemap.keyvaluemaps_r21 WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum devconnect:
    ALTER TABLE devconnect.developers WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE devconnect.companies WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE devconnect.company_developers WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum counter:
    ALTER TABLE counter.counters_current_version WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE counter.counters_with_expiry WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE counter.counters WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE counter.key_timestamp_count WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE counter.timestamp_key WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE counter.period_timestamp WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE counter.gateway_quota WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum cache:
    ALTER TABLE cache.cache_entries WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE cache.cache_sequence_id_r24 WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum ax_custom_report_model:
    ALTER TABLE ax_custom_report_model.report_description WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.report_id_lookup WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.org_metadata WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.org_report_lookup WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.report_created_view WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE ax_custom_report_model.report_viewed_view WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum auth:
    ALTER TABLE auth.totp WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum audit:
    ALTER TABLE audit.audits WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE audit.audits_ref WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum apprepo:
    ALTER TABLE apprepo.organizations WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apprepo.environments WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apprepo.apiproxies WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apprepo.apiproxy_revisions WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apprepo.api_proxy_revisions_r21 WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum apimodel:
    ALTER TABLE apimodel.apis WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.apis_revision WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.resource WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.method WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.revision_counters WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.template_counters WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.template WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.credentials WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.credentialsv2 WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.schemas WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.security WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE apimodel.template_auth WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum identityzone:
    ALTER TABLE identityzone.IdentityZones WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE identityzone.OrgToIdentityZone WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum dek:
        
    ALTER TABLE dek.keys WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
  • CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum analytics:
    ALTER TABLE analytics.custom_aggregates_defn WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE analytics.custom_rules_defn WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE analytics.custom_aggregates_defn_updates WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
    ALTER TABLE analytics.custom_rules_defn_updates WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};

Wenn Sie alle Spaltenfamilien geändert haben und die Indexe bereits neu erstellt und gleichzeitig die Komprimierungsstrategie in LeveledCompactionStrategy geändert haben, müssen Sie die Indexe noch einmal neu erstellen. Führen Sie dieselben Schritte wie zuvor unter Alle Indexe neu erstellen aus. Wenn Sie die Indexe nicht zuvor neu erstellt haben, müssen Sie die Indexe während des Rollbacks nicht neu erstellen.

Option 2: Vollständige Datenwiederherstellung aus einem Back-up

Informationen zum Durchführen einer vollständigen Datenwiederherstellung finden Sie unter Aus Sicherung wiederherstellen.

Verdichtungsstrategie prüfen

Verdichtungsstrategien werden in Cassandra auf Spaltenfamilienebene (Tabellenebene) festgelegt. Mit den folgenden CQL-Abfragen können Sie die Komprimierungsstrategie für jede Spaltenfamilie prüfen.

Sie können CQLs an der cql-Eingabeaufforderung ausführen. So rufen Sie die cql-Aufforderung auf:

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

Die Antwort sieht ungefähr so aus:

Connected to apigee at XX.XX.XX.XX:9042.
[cqlsh 5.0.1 | Cassandra 2.1.16 | CQL spec 3.2.1 | Native
protocol v3]
Use HELP for help.
cqlsh>

Sie können die aktuelle Verdichtungsstrategie so bestimmen:

  • Wenn die Verdichtungsstrategie auf SizeTieredCompactionStrategy gesetzt ist, ist die Ausgabe der folgenden Abfragen org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy.
  • Wenn die Komprimierungsstrategie auf LeveledCompactionStrategy gesetzt ist, ist die Ausgabe der folgenden Abfragen org.apache.cassandra.db.compaction.LeveledCompactionStrategy.

Führen Sie die folgenden CQLs aus, um die Komprimierungsstrategie zu prüfen:

  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum kms:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'organizations';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'maps';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'apps';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'app_credentials';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'api_products';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'apiproducts_appslist';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'api_resources';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'app_end_user';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'oauth_20_authorization_codes';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'oauth_20_access_tokens';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'oauth_10_request_tokens';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'oauth_10_access_tokens';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'oauth_10_verifiers';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name ='kms' and columnfamily_name = 'app_enduser_tokens';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum user_settings:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'user_settings' and columnfamily_name = 'user_settings';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum keyvaluemap:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'keyvaluemap' and columnfamily_name = 'keyvaluemaps_r21';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum devconnect:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'devconnect' and columnfamily_name = 'developers';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'devconnect' and columnfamily_name = 'companies';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'devconnect' and columnfamily_name = 'company_developers';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum counter:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'counter' and columnfamily_name = 'counters_current_version';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'counter' and columnfamily_name = 'counters_with_expiry';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'counter' and columnfamily_name = 'counters';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'counter' and columnfamily_name = 'key_timestamp_count';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'counter' and columnfamily_name = 'timestamp_key';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'counter' and columnfamily_name = 'period_timestamp';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'counter' and columnfamily_name = 'gateway_quota';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum cache:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'cache' and columnfamily_name = 'cache_entries';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'cache' and columnfamily_name = 'cache_sequence_id_r24';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum ax_custom_report_model:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'ax_custom_report_model' and columnfamily_name = 'report_description';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'ax_custom_report_model' and columnfamily_name = 'report_id_lookup';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'ax_custom_report_model' and columnfamily_name = 'org_metadata';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'ax_custom_report_model' and columnfamily_name = 'org_report_lookup';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'ax_custom_report_model' and columnfamily_name = 'report_created_view';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'ax_custom_report_model' and columnfamily_name = 'report_viewed_view';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum auth:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'auth' and columnfamily_name = 'totp';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum audit:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'audit' and columnfamily_name = 'audits';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'audit' and columnfamily_name = 'audits_ref';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum apprepo:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apprepo' and columnfamily_name = 'organizations';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apprepo' and columnfamily_name = 'environments';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apprepo' and columnfamily_name = 'apiproxies';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apprepo' and columnfamily_name = 'apiproxy_revisions';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apprepo' and columnfamily_name = 'api_proxy_revisions_r21';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum apimodel:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'apis';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'apis_revision';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'resource';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'method';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'revision_counters';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'template_counters';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'template';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'credentials';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'credentialsv2';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'schemas';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'security';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'apimodel' and columnfamily_name = 'template_auth';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum identityzone:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'identityzone' and columnfamily_name = 'identityzones';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'identityzone' and columnfamily_name = 'orgtoidentityzone';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum dek:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'dek' and columnfamily_name = 'keys';
  • CQLs zur Überprüfung der Komprimierungsstrategie für den Schlüsselraum analytics:
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'analytics' and columnfamily_name = 'custom_aggregates_defn';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'analytics' and columnfamily_name = 'custom_rules_defn';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'analytics' and columnfamily_name = 'custom_aggregates_defn_updates';
    SELECT compaction_strategy_class from system.schema_columnfamilies where keyspace_name = 'analytics' and columnfamily_name = 'custom_rules_defn_updates';