Detect missing ledgers
PCK gets all ledgers from a topic and then tries to find them in the storage. If a ledger is not found in the storage, the missing ledger is output on the terminal. You can use thedetect-missing-ledger command to detect the ledger that exists in the Pulsar metadata but not in the Bookie or the tiered storage.
Detect missing ledgers from Bookie
You can use thesn-pulsar-tools pck bookie detect-missing-ledger [options] command to detect the missing ledgers from the Bookie.
This table lists available options for the sn-pulsar-tools pck bookie detect-missing-ledger command.
This example shows how to detect missing ledgers in the
example topic of a locally-deployed cluster.
Input
Detect missing ledgers from tiered storage
You can use thesn-pulsar-tools pck ts detect-missing-ledger [options] command to detect the missing ledgers from the tiered storage.
This table lists available options for the sn-pulsar-tools pck ts detect-missing-ledger command.
If it is not a public bucket, you need to configure the credentials before executing the command.
This example shows how to detect missing ledgers in the
- For GCS, you need to configure the
GOOGLE_CLOUD_PROJECT_IDandGOOGLE_CLOUD_SERVICE_ACCOUNT_KEYFILEas the environment variables. For example, if the bucket located in the projectaffable-ray-226821and the key file path is/pulsar/key.json, you need to configure them as below:
- For AWS S3, you can configure the AWS credentials as the environment variables.
example topic of a locally-deployed cluster.
Input
Find orphan ledgers
PCK fetches the topic ledger information from the ZooKeeper and gets the range of the ledgers from the storage. Then, PCK compares them to find the orphan ledger that is not used in that topic. You can use thefind-orphan-ledger command to find the orphan ledger that is not used in the Pulsar topic.
- The
find-orphan-ledgercommand is only available for Pulsar 2.3.0 or higher. - The
find-orphan-ledgercommand is suitable for a Pulsar cluster that has a specific BookKeeper cluster. If multiple Pulsar clusters use the same BookKeeper cluster, do not use this command.
Find orphan ledgers from Bookie
You can use thesn-pulsar-tools pck bookie find-orphan-ledger [options] command to find the missing ledgers from the Bookie.
This table lists available options for the sn-pulsar-tools pck bookie find-orphan-ledger command.
-
This example shows how to find orphan ledgers from the Bookie of a locally-deployed cluster.
Input
The output is similar to: Output
365is the orphan ledger and[]is the metadata of the ledger. -
This example shows how to delete orphan ledgers from the Bookie of a locally-deployed cluster.
Input
The output is similar to: Output
Find orphan ledgers from tiered storage
You can use thesn-pulsar-tools pck ts find-orphan-ledger [options] command to find the missing ledgers from the tiered storage.
This table outlines available options for the sn-pulsar-tools pck ts find-orphan-ledger command.
If it is not a public bucket, you need to configure the credentials before executing the command.
This example shows how to find orphan ledgers in the GCS. Input
- For GCS, you need to configure the
GOOGLE_CLOUD_PROJECT_IDandGOOGLE_CLOUD_SERVICE_ACCOUNT_KEYFILEas the environment variables. For example, if the bucket located in the projectaffable-ray-226821and the key file path is/pulsar/key.json, you need to configure them as below:
- For AWS S3, you can configure the AWS credentials as the environment variables.
Delete under-replicated ledgers from the Bookie
You can use thesn-pulsar-tools bookie delete-underreplicate-ledgers [options] command to delete the under-replicated ledgers from the Bookie.
This table outlines available options for the sn-pulsar-tools bookie delete-underreplicate-ledgers command.
This example shows how to delete under-replicated ledgers from the Bookie.
Input
--dry-run option, the output is similar to:
Output
Load inactive topics
You can use thesn-pulsar-tools topics load-inactive-topic [options] command to load the inactive topics in the Pulsar broker. After loading, the Pulsar broker will check the ConsumedLedgers in every topic. This helps delete data that has already reached the retention limit.
This table outlines available options for the sn-pulsar-tools topics load-inactive-topic command.
This example shows how to load inactive topics for a locally-deployed cluster.