Apigee verwendet die Cassandra-Datenbank, um die meisten Daten zu speichern, einschließlich Daten für Proxys, Caches und Tokens. Verdichtung ist ein wichtiger Prozess, um die Größe der in Datenbanken gespeicherten Daten zu reduzieren. Sie ist unerlässlich, um einen effizienten Datenbankbetrieb aufrechtzuerhalten. Cassandra unterstützt verschiedene Strategien für die Verdichtung. Apigee empfiehlt allen Edge for Private Cloud-Kunden, ihre Cassandra-Cluster für alle Tabellen mit der LeveledCompactionStrategy anstelle der Standardstrategie SizeTieredCompactionStrategy zu betreiben. LeveledCompactionStrategy bietet eine bessere Leistung, eine verbesserte Festplattennutzung und effizientere Verdichtungen und erfordert weniger freien Speicherplatz als SizeTieredCompactionStrategy.
Bei allen Neuinstallationen von Edge for Private Cloud 4.52.02 oder höher wird Cassandra automatisch
mit LeveledCompactionStrategy konfiguriert. Wenn Sie jedoch von einer früheren Version auf Edge for Private Cloud 4.54.00 aktualisiert haben, verwendet Ihre Installation möglicherweise weiterhin Cassandra mit SizeTieredCompactionStrategy.
Es wird zwar nicht empfohlen, die Verdichtungsstrategie in etwas anderes als LeveledCompactionStrategy zu ändern, in diesem Dokument wird jedoch beschrieben, wie Sie die Änderung bei Bedarf vornehmen und wie Sie Ihre aktuelle Verdichtungsstrategie prüfen können. Wenn Sie die Verdichtungsstrategie in eine nicht empfohlene Option ändern, werden Ihre Änderungen bei zukünftigen Cassandra-Softwareupgrades möglicherweise überschrieben. Wir empfehlen, Ihre Verdichtungsstrategie nach jedem Upgrade zu prüfen, wenn Sie einen nicht standardmäßigen Ansatz verwenden.
Vorbereitung
Vorbereitung
In Edge for Private Cloud 4.54.00 erfordert Cassandra 5.x JDK 17 (Java 17).
Bevor Sie nodetool oder cqlsh Befehle auf einem
Cassandra-Knoten ausführen, prüfen Sie, ob Java 17 als Standard-Java-Version konfiguriert ist
(z. B. durch Ausführen von
sudo alternatives --set java JAVA_17_PATH/bin/java oder
Festlegen von JAVA_HOME auf Ihre JDK 17-Installation).
Vorhandene Verdichtungsstrategie prüfen
Sie können die vorhandene Verdichtungsstrategie für Tabellen prüfen. Folgen Sie dazu der
Anleitung in Anhang 1.
Wenn die Verdichtungsstrategie bereits LeveledCompactionStrategy,
ist, liegt das möglicherweise daran, dass Sie mit einer Installation von Edge for Private Cloud
4.51 oder höher begonnen haben oder zuvor zu
LeveledCompactionStrategy gewechselt sind, wie von Apigee empfohlen. Wenn Sie
bereits LeveledCompactionStrategy verwenden, empfiehlt Apigee
diese Strategie beizubehalten und keine Änderungen vorzunehmen. Da Edge for
Private Cloud jedoch von Ihnen betrieben wird, wird in der folgenden Anleitung beschrieben, wie Sie die Verdichtungsstrategie bei Bedarf ändern.
Backup
Da das Ändern der Verdichtungsstrategie einen vollständigen Verdichtungszyklus auf Cassandra-Knoten auslöst, kann es aufgrund der Last von Verdichtungen und gleichzeitigem Anwendungstraffic zu Latenzen kommen. Für das Rollback dieser Änderung ist keine Wiederherstellung aus einer Sicherung erforderlich. Sie können die Verdichtungsstrategie direkt zurücksetzen, wie unter Option 1: Änderung rückgängig machen beschrieben. Sichern Sie jedoch vorsichtshalber Ihre Daten, bevor Sie die Verdichtungsstrategie ändern. Weitere Informationen finden Sie unter Backup erstellen.
Verdichtungsdurchsatz
Nachdem die Verdichtungsstrategie in LeveledCompactionStrategy geändert wurde, können Verdichtungen lange dauern. Die Laufzeit kann je nach Größe der Datenverdichtung variieren. Während des Verdichtungszyklus
verwendet Cassandra möglicherweise mehr Systemressourcen. Damit die Verdichtung nicht viele
Systemressourcen beansprucht, was API-Laufzeitanfragen stören könnte, empfehlen wir, Grenzwerte für
den Verdichtungsdurchsatz festzulegen.
Führen Sie den folgenden nodetool Befehl auf jedem Knoten aus, um den Verdichtungsdurchsatz auf allen Cassandra-Knoten auf maximal
128 MB festzulegen:
nodetool setcompactionthroughput 128
Größe von VMs für Verdichtungen festlegen
Bevor Sie diese Änderung ausführen, prüfen Sie, ob die Cassandra-Knoten über genügend CPU- und Speicherressourcen verfügen und die CPU-Auslastung nicht mehr als 25% beträgt.
Nach einer Änderung der Verdichtungsstrategie wird voraussichtlich ein vollständiger Verdichtungszyklus ausgeführt. Daher empfiehlt es sich, die Verdichtungsstrategie in Zeiten mit geringem Traffic zu ändern.
Gestaffelte Ausführungen
Möglicherweise können Sie die Änderung nicht innerhalb eines Tages auf allen Knoten vornehmen, insbesondere wenn Sie große Cassandra-Cluster betreiben, da die Indexe auf jedem Knoten einzeln neu erstellt werden müssen. Sie können die Verdichtungsstrategie jeweils für ein Schema oder eine Tabelle ändern. Ändern Sie dazu die Tabelle, um die Verdichtungsstrategie zu ändern, und erstellen Sie dann alle Indexe in der Tabelle (falls vorhanden) auf allen Knoten neu. Wiederholen Sie dann die obige Vorgehensweise für jede Tabelle oder jeden Schlüsselraum. Solche Ausführungen für eine Tabelle oder einen Schlüsselraum können auf verschiedene Tage aufgeteilt werden.
Wenn Sie beispielsweise die Verdichtungsstrategie der Tabelle oauth_20_access_tokens im Schema kms in LeveledCompactionStrategy ändern möchten, können Sie so vorgehen:
-
Ä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'}; -
Erstellen Sie alle Indexe nur für diese 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
Im Großen und Ganzen ist das Ändern der Verdichtungsstrategie ein zweistufiger Prozess:
- Ändern Sie die Verdichtungsstrategie jeder Tabelle.
- Erstellen Sie alle Indexe auf jedem Knoten einzeln neu.
Um die Verdichtungsstrategie zu ändern, müssen Sie für jede Tabelle einzeln einen ALTER TABLE-Befehl ausführen. Ein Beispiel für einen ALTER TABLE-Befehl sieht so aus:
# To change to LeveledCompactionStrategyALTER TABLEkms.oauth_20_access_tokens WITH compaction = {'class' : 'LeveledCompactionStrategy'}; # To change to SizeTieredCompactionStrategyALTER TABLEkms.oauth_20_access_tokens WITH compaction = {'class' : 'SizeTieredCompactionStrategy'};
Tabelle ändern, um neue Verdichtungsstrategie festzulegen
Führen Sie die folgenden CQLs auf einem beliebigen Cassandra-Knoten aus, um die Strategie jeweils für einen Schlüsselraum zu ändern. CQLs können an der CQL-Eingabeaufforderung ausgeführt werden. Anleitung zum Aufrufen der CQL-Eingabeaufforderung:
/opt/apigee/apigee-cassandra/bin/cqlsh `hostname -i`
Verbunden mit Apigee unter XXXXXXXX:9042.
[cqlsh 6.2.0 | Cassandra 5.0.8 | CQL spec 3.4.7 | Native protocol v5] Use HELP for help. cqlsh>
Die folgenden Befehle beziehen sich auf das Ändern der Verdichtungsstrategie in LeveledCompactionStrategy. Ähnliche Befehle können jedoch verwendet werden, um zu anderen Verdichtungsstrategien zu wechseln.
Die Schritte 14 bis 16 unten gelten nur, wenn Sie die Monetarisierung verwenden.
- CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
kmsALTER 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_settingsALTER TABLE user_settings.user_settings WITH compaction = {'class' : 'LeveledCompactionStrategy'}; - CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
keyvaluemapALTER TABLE keyvaluemap.keyvaluemaps_r21 WITH compaction = {'class' : 'LeveledCompactionStrategy'}; - CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
devconnectALTER 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:
counterALTER 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:
cacheALTER 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:
authALTER TABLE auth.totp WITH compaction = {'class' : 'LeveledCompactionStrategy'}; - CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
auditALTER 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:
apprepoALTER 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_v2ALTER 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'}; - CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
identityzoneALTER 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:
dekALTER TABLE dek.keys WITH compaction = {'class' : 'LeveledCompactionStrategy'}; - CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
analyticsALTER 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'}; - [Nur Monetarisierung] CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
mintALTER 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'}; - [Nur Monetarisierung] CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
taurusALTER 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'}; - [Nur Monetarisierung] CQLs zum Ändern der Verdichtungsstrategie für den Schlüsselraum:
notificationALTER 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'};
Indexe neu erstellen
Dieser Schritt muss nach jeder Änderung der Verdichtungsstrategie ausgeführt werden. Führen Sie die
folgenden nodetool Befehle einzeln auf jedem Cassandra-Knoten aus.
Die Schritte 7 bis 9 unten gelten nur, wenn Sie die Monetarisierung verwenden.
-
Indexe für den Schlüsselraum
kmsneu erstellennodetool 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
-
Indexe für den Schlüsselraum
devconnectneu erstellennodetool 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 den Schlüsselraum
cacheneu erstellennodetool rebuild_index cache cache_entries cache_entries_cache_name_idx
-
Indexe für den Schlüsselraum
auditneu erstellennodetool 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 den Schlüsselraum
apimodel_v2neu erstellennodetool 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
-
Indexe für den Schlüsselraum
dekneu erstellennodetool rebuild_index dek keys usecase_index
-
[Nur Monetarisierung] Indexe für den Schlüsselraum
mintneu erstellennodetool 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
-
[Nur Monetarisierung] Indexe für den Schlüsselraum
taurusneu erstellennodetool 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
-
[Nur Monetarisierung] Indexe für den Schlüsselraum
notificationneu erstellennodetool 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
- Prüfen Sie anhand der Anleitung in Anhang 1, ob die Änderung der Verdichtungsstrategie für das Schema wirksam geworden ist.
- Prüfen Sie, ob die Verdichtung nach der Änderung der Strategie erfolgreich ausgeführt wurde und die Daten verdichtet wurden:
- 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
- Nachdem Sie mit dem obigen Befehl geprüft haben, dass keine Verdichtungen ausstehen, prüfen Sie den Zeitstempel der letzten Änderung der Datendateien (unter
/opt/apigee/data/apigee-cassandra/data/). Er muss nach dem Zeitstempel liegen, an dem die CQL zur Änderung der Verdichtungsstrategie ausgeführt wurde.
- Führen Sie auf jedem Cassandra-Knoten den folgenden nodetool-Befehl aus, um zu prüfen, ob alle Verdichtungen abgeschlossen sind und nichts aussteht:
Rollback
Wenn Sie ein Rollback durchführen müssen, können Sie eine der folgenden Optionen auswählen:
Option 1: Änderung rückgängig machen
Setzen Sie die Verdichtungsstrategie auf die ursprüngliche Strategie zurück.
Führen Sie an der CQL-Eingabeaufforderung ähnliche ALTER TABLE-Befehle aus, die Sie zuvor ausgeführt haben, um die Verdichtungsstrategie zu ändern.
Wenn Sie bereits Indexe neu erstellt haben, als Sie die Verdichtungsstrategie in LeveledCompactionStrategy geändert haben, müssen Sie die Indexe noch einmal neu erstellen. Folgen Sie dazu derselben Anleitung wie zuvor für den Neuaufbau aller Indizes. Wenn Sie die Indexe zuvor nicht neu erstellt haben, müssen Sie sie während des Rollbacks nicht neu erstellen.
Option 2: Vollständige Datenwiederherstellung aus einer Sicherung
Stellen Sie Daten aus einer Sicherung für alle Schlüsselräume wieder her:
Folgen Sie der Anleitung unter Aus einer Sicherung wiederherstellen.
Anhang 1: Verdichtungsstrategie prüfen
Verdichtungsstrategien werden in Cassandra auf Tabellenebene festgelegt. Mit den folgenden Abfragen können Sie die Verdichtungsstrategie für jede Tabelle prüfen.
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`
Sie sehen eine Antwort wie die folgende:
Connected to apigee at XX.XX.XX.XX:9042. [cqlsh 6.2.0 | Cassandra 5.0.8 | CQL spec 3.4.7 | Native protocol v5] Use HELP for help. cqlsh>
So ermitteln Sie die aktuelle Verdichtungsstrategie:
Jede Zeile in der Ausgabe bezieht sich auf eine Tabelle in einem Schlüsselraum. In jeder Zeile gibt die Spalte compaction die Verdichtungsstrategie an, die von der Tabelle verwendet wird.
- Wenn die Verdichtungsstrategie auf SizeTieredCompactionStrategy festgelegt ist, sieht die Spalte compaction in den folgenden Abfragen so aus:
- Wenn die Verdichtungsstrategie auf LeveledCompactionStrategy festgelegt ist, sieht die Spalte compaction in den folgenden Abfragen so aus:
{'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}{'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}Mit den folgenden Abfragen können Sie die Verdichtungsstrategie für jede Tabelle in einem bestimmten Schlüsselraum ermitteln:
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';