查看租户
./pulsar-admin tenants list
查看命名空间
./bin/pulsar-admin namespaces list my-tenant
查看topic
./bin/pulsar-admin topics list my-tenant/my-namespace
创建topic
./bin/pulsar-admin topics create persistent://my-tenant/my-namespace/by-dev-rootcoord-dml_4
查看topic分区状态
./bin/pulsar-admin topics partitioned-stats persistent://my-tenant/my-namespace/my-topic
# ./pulsar-admin namespaces list public
"public/default"
# ./pulsar-admin topics list public/default
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_9"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_8"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_5"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_4"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_10"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_7"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_6"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_1"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_0"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_3"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_2"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_15"
"persistent://public/default/milvus-operator-topic"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_12"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_11"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_14"
"persistent://public/default/milvus-cluster-sit-rootcoord-dml_13"
查看topic 分区数
# ./pulsar-admin topics get-partitioned-topic-metadata public/default/milvus-cluster-sit-rootcoord-dml_9
{
"partitions" : 0
}
[root@k8s-master01 server]# ./bin/pulsar-admin topics
Usage: pulsar-admin topics [command] [command options]
Commands:
list Get the list of topics under a namespace.
Usage: list [options] tenant/namespace
Options:
-b, --bundle
Namespace bundle to get list of topics
-td, --topic-domain
Allowed topic domain (persistent, non_persistent).
Possible Values: [persistent, non-persistent]
list-partitioned-topics Get the list of partitioned topics under a
namespace.
Usage: list-partitioned-topics tenant/namespace
permissions Get the permissions on a topic. Retrieve the effective
permissions for a topic. These permissions are defined by the
permissions set at the namespace level combined (union) with any
eventual specific permission set on the topic.
Usage: permissions persistent://tenant/namespace/topic
grant-permission Grant a new permission to a client role on a single
topic.
Usage: grant-permission [options] persistent://tenant/namespace/topic
Options:
* --actions
Actions to be granted
(produce,consume,sources,sinks,functions,packages)
* --role
Client role to which grant permissions
revoke-permission Revoke permissions on a topic. Revoke permissions
to a client role on a single topic. If the permission was not set
at the topic level, but rather at the namespace level, this
operation will return an error (HTTP status code 412).
Usage: revoke-permission [options] persistent://tenant/namespace/topic
Options:
* --role
Client role to which revoke permissions
lookup Lookup a topic from the current serving broker
Usage: lookup persistent://tenant/namespace/topic
partitioned-lookup Lookup a partitioned topic from the current
serving broker
Usage: partitioned-lookup [options]
persistent://tenant/namespace/partitionedTopic
Options:
-s, --sort-by-broker
Sort partitioned-topic by Broker Url
Default: false
bundle-range Get Namespace bundle range of a topic
Usage: bundle-range persistent://tenant/namespace/topic
delete Delete a topic. The topic cannot be deleted if there's any
active subscription or producers connected to it.
Usage: delete [options] persistent://tenant/namespace/topic
Options:
-d, --deleteSchema
Delete schema while deleting topic
Default: false
-f, --force
Close all producer/consumer/replicator and delete topic forcefully
Default: false
truncate Truncate a topic.
The truncate operation will move all
cursors to the end of the topic and delete all inactive ledgers.
Usage: truncate persistent://tenant/namespace/topic
unload Unload a topic.
Usage: unload persistent://tenant/namespace/topic
subscriptions Get the list of subscriptions on the topic
Usage: subscriptions persistent://tenant/namespace/topic
unsubscribe Delete a durable subscriber from a topic. The
subscription cannot be deleted if there are any active consumers
attached to it
Usage: unsubscribe [options] persistent://tenant/namespace/topic
Options:
-f, --force
Disconnect and close all consumers and delete subscription
forcefully
Default: false
* -s, --subscription
Subscription to be deleted
create-subscription Create a new subscription on a topic
Usage: create-subscription [options] persistent://tenant/namespace/topic
Options:
--messageId, -m
messageId where to create the subscription. It can be either
'latest', 'earliest' or (ledgerId:entryId)
Default: latest
* -s, --subscription
Subscription to reset position on
stats Get the stats for the topic and its connected producers and
consumers. All the rates are computed over a 1 minute window and
are relative the last completed 1 minute period.
Usage: stats [options] persistent://tenant/namespace/topic
Options:
-etb, --get-earliest-time-in-backlog
Set true to get earliest time in backlog
Default: false
-gpb, --get-precise-backlog
Set true to get precise backlog
Default: false
-sbs, --get-subscription-backlog-size
Set true to get backlog size for each subscription, locking
required.
Default: false
stats-internal Get the internal stats for the topic
Usage: stats-internal [options] persistent://tenant/namespace/topic
Options:
-m, --metadata
Flag to include ledger metadata
Default: false
info-internal Get the internal metadata info for the topic
Usage: info-internal persistent://tenant/namespace/topic
partitioned-stats Get the stats for the partitioned topic and its
connected producers and consumers. All the rates are computed over
a 1 minute window and are relative the last completed 1 minute
period.
Usage: partitioned-stats [options] persistent://tenant/namespace/topic
Options:
-gpb, --get-precise-backlog
Set true to get precise backlog
Default: false
-sbs, --get-subscription-backlog-size
Set true to get backlog size for each subscription, locking
required.
Default: false
--per-partition
Get per partition stats
Default: false
partitioned-stats-internal Get the internal stats for the partitioned
topic and its connected producers and consumers. All the rates are
computed over a 1 minute window and are relative the last
completed 1 minute period.
Usage: partitioned-stats-internal persistent://tenant/namespace/topic
skip Skip some messages for the subscription
Usage: skip [options] persistent://tenant/namespace/topic
Options:
* -n, --count
Number of messages to skip
Default: 0
* -s, --subscription
Subscription to be skip messages on
clear-backlog Skip all the messages for the subscription
Usage: clear-backlog [options] persistent://tenant/namespace/topic
Options:
* -s, --subscription
Subscription to be cleared
expire-messages Expire messages that older than given expiry time (in
seconds) for the subscription
Usage: expire-messages [options] persistent://tenant/namespace/topic
Options:
-e, --exclude-reset-position
Exclude the reset position, start consume messages from the next
position.
Default: false
-t, --expireTime
Expire messages older than time in seconds
Default: -1
--position, -p
message position to reset back to (ledgerId:entryId)
* -s, --subscription
Subscription to be skip messages on
expire-messages-all-subscriptions Expire messages that older than
given expiry time (in seconds) for all subscriptions
Usage: expire-messages-all-subscriptions [options]
persistent://tenant/namespace/topic
Options:
* -t, --expireTime
Expire messages older than time in seconds
Default: 0
create-partitioned-topic Create a partitioned topic. The partitioned
topic has to be created before creating a producer on it.
Usage: create-partitioned-topic [options]
persistent://tenant/namespace/topic
Options:
--metadata, -m
key value pair properties(a=a,b=b,c=c)
* -p, --partitions
Number of partitions for the topic
Default: 0
create-missed-partitions Try to create partitions for partitioned
topic. The partitions of partition topic has to be created, can be
used by repair partitions when topic auto creation is disabled
Usage: create-missed-partitions persistent://tenant/namespace/topic
create Create a non-partitioned topic.
Usage: create [options] persistent://tenant/namespace/topic
Options:
--metadata, -m
key value pair properties(a=a,b=b,c=c)
update-partitioned-topic Update existing non-global partitioned
topic. New updating number of partitions must be greater than
existing number of partitions.
Usage: update-partitioned-topic [options]
persistent://tenant/namespace/topic
Options:
-f, --force
Update forcefully without validating existing partitioned topic
Default: false
* -p, --partitions
Number of partitions for the topic
Default: 0
get-partitioned-topic-metadata Get the partitioned topic metadata. If
the topic is not created or is a non-partitioned topic, it returns
empty topic with 0 partitions
Usage: get-partitioned-topic-metadata
persistent://tenant/namespace/topic
delete-partitioned-topic Delete a partitioned topic. It will also
delete all the partitions of the topic if it exists.
Usage: delete-partitioned-topic [options]
persistent://tenant/namespace/topic
Options:
-d, --deleteSchema
Delete schema while deleting topic
Default: false
-f, --force
Close all producer/consumer/replicator and delete topic forcefully
Default: false
peek-messages Peek some messages for the subscription
Usage: peek-messages [options] persistent://tenant/namespace/topic
Options:
-n, --count
Number of messages (default 1)
Default: 1
* -s, --subscription
Subscription to get messages from
examine-messages Examine a specific message on a topic by position
relative to the earliest or the latest message.
Usage: examine-messages [options] persistent://tenant/namespace/topic
Options:
-i, --initialPosition
Relative start position to examine message.It can be 'latest' or
'earliest', default is latest
Default: latest
-m, --messagePosition
The position of messages (default 1)
Default: 1
get-message-by-id Get message by its ledgerId and entryId
Usage: get-message-by-id [options] persistent://tenant/namespace/topic
Options:
* -e, --entryId
entry id pointing to the desired entry
Default: 0
* -l, --ledgerId
ledger id pointing to the desired ledger
Default: 0
get-message-id Get message ID
Usage: get-message-id [options] persistent://tenant/namespace/topic
Options:
* -d, --datetime
datetime at or before this messageId. This datetime is in format
of ISO_OFFSET_DATE_TIME, e.g. 2021-06-28T16:53:08Z or
2021-06-28T16:53:08.123456789+08:00
reset-cursor Reset position for subscription to a position that is
closest to timestamp or messageId.
Usage: reset-cursor [options] persistent://tenant/namespace/topic
Options:
-e, --exclude-reset-position
Exclude the reset position, start consume messages from the next
position.
Default: false
--messageId, -m
messageId to reset back to ('latest', 'earliest', or
'ledgerId:entryId')
* -s, --subscription
Subscription to reset position on
--time, -t
time in minutes to reset back to (or minutes, hours, days, weeks
eg: 100m, 3h, 2d, 5w)
terminate Terminate a topic and don't allow any more messages to be
published
Usage: terminate persistent://tenant/namespace/topic
partitioned-terminate Terminate a partitioned topic and don't allow
any more messages to be published
Usage: partitioned-terminate persistent://tenant/namespace/topic
compact Compact a topic
Usage: compact persistent://tenant/namespace/topic
compaction-status Status of compaction on a topic
Usage: compaction-status [options] persistent://tenant/namespace/topic
Options:
-w, --wait-complete
Wait for compaction to complete
Default: false
offload Trigger offload of data from a topic to long-term storage
(e.g. Amazon S3)
Usage: offload [options] persistent://tenant/namespace/topic
Options:
* -s, --size-threshold
Maximum amount of data to keep in BookKeeper for the specified
topic (e.g. 10M, 5G).
offload-status Check the status of data offloading from a topic to
long-term storage
Usage: offload-status [options] persistent://tenant/namespace/topic
Options:
-w, --wait-complete
Wait for offloading to complete
Default: false
last-message-id get the last commit message id of topic
Usage: last-message-id persistent://tenant/namespace/topic
get-max-unacked-messages-per-subscription Get max unacked messages
policy on subscription for a topic
Usage: get-max-unacked-messages-per-subscription [options]
persistent://tenant/namespace/topic
Options:
-ap, --applied
Get the applied policy of the topic
Default: false
set-max-unacked-messages-per-subscription Set max unacked messages
policy on subscription for a topic
Usage: set-max-unacked-messages-per-subscription [options]
persistent://tenant/namespace/topic
Options:
* -m, --maxNum
max unacked messages num on subscription
Default: 0
remove-max-unacked-messages-per-subscription Remove max unacked
messages policy on subscription for a topic
Usage: remove-max-unacked-messages-per-subscription
persistent://tenant/namespace/topic
get-max-subscriptions Get max number of subscriptions for a topic
Usage: get-max-subscriptions persistent://tenant/namespace/topic
set-max-subscriptions Set max number of subscriptions for a topic
Usage: set-max-subscriptions [options]
persistent://tenant/namespace/topic
Options:
* --max-subscriptions-per-topic, -m
Maximum subscription limit for a topic
Default: 0
remove-max-subscriptions Remove max number of subscriptions for a
topic
Usage: remove-max-subscriptions persistent://tenant/namespace/topic
set-replicated-subscription-status Enable or disable a replicated
subscription on a topic
Usage: set-replicated-subscription-status [options]
persistent://tenant/namespace/topic
Options:
--disable, -d
Disable replication
Default: false
--enable, -e
Enable replication
Default: false
* -s, --subscription
Subscription name to enable or disable replication
get-replicated-subscription-status Get replicated subscription status
on a topic
Usage: get-replicated-subscription-status [options]
persistent://tenant/namespace/topic
Options:
* -s, --subscription
Subscription name
get-backlog-size Calculate backlog size by a message ID (in bytes).
Usage: get-backlog-size [options] persistent://tenant/namespace/topic
Options:
--messageId, -m
messageId used to calculate backlog size. It can be
(ledgerId:entryId).
Default: -1:-1
get-replication-clusters Get the replication clusters for a topic
Usage: get-replication-clusters [options]
persistent://tenant/namespace/topic
Options:
-ap, --applied
Get the applied policy of the topic
Default: false
set-replication-clusters Set the replication clusters for a topic
Usage: set-replication-clusters [options]
persistent://tenant/namespace/topic
Options:
* --clusters, -c
Replication Cluster Ids list (comma separated values)
remove-replication-clusters Remove the replication clusters for a
topic
Usage: remove-replication-clusters persistent://tenant/namespace/topic