惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
I
InfoQ
The Register - Security
The Register - Security
L
LangChain Blog
H
Help Net Security
The GitHub Blog
The GitHub Blog
S
Schneier on Security
博客园 - 【当耐特】
W
WeLiveSecurity
Attack and Defense Labs
Attack and Defense Labs
IT之家
IT之家
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
H
Heimdal Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Y
Y Combinator Blog
雷峰网
雷峰网
N
Netflix TechBlog - Medium
Security Archives - TechRepublic
Security Archives - TechRepublic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
Lohrmann on Cybersecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Exploit Database - CXSecurity.com
P
Privacy & Cybersecurity Law Blog
G
GRAHAM CLULEY
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
博客园 - 聂微东
PCI Perspectives
PCI Perspectives
Last Week in AI
Last Week in AI
A
Arctic Wolf
宝玉的分享
宝玉的分享
T
The Blog of Author Tim Ferriss
S
Secure Thoughts
T
Threat Research - Cisco Blogs
GbyAI
GbyAI
云风的 BLOG
云风的 BLOG
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
SecWiki News
SecWiki News
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏
Schneier on Security
Schneier on Security
P
Proofpoint News Feed
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
AI
AI
Engineering at Meta
Engineering at Meta

博客园 - koushr

hls k8s常用命令 k8s 1.18.0安装 mysql json函数 group by的列、where的列的有效性 go基础第六篇:sync包 doris脚本 es es语法 veo ride nacos 枫叶互动 极光矩阵 富途 移卡科技 nginx高可用 k8s第一篇:k8s集群架构组件 架构设计第二篇:支付模块架构设计 可观测性体系设计第一篇:可观测性体系基本概念 架构设计第一篇:点赞模块功能设计 ES高级第一篇:倒排索引 山海星辰 python第一篇:基础语法 pulsar基础第一篇:pulsar安装及基本概念 clickhouse第三篇:安装 clickhouse第二篇:MergeTree引擎 clickhouse第一篇:引擎 redis高阶第一篇:令牌桶算法限流 http2.0 gin入参多次获取 docker第二篇:docker安装常用中间件
pulsar基础第二篇:命令行
koushr · 2025-05-15 · via 博客园 - koushr

pulsar-admin --admin-url http://xxx:8080

1、tenant管理(租户管理)

查看列表:pulsar-admin tenants list

创建:pulsar-admin tenants create xndm

2、namespace管理

查看某租户的namespace列表:pulsar-admin namespaces list xndm

在某租户下创建:pulsar-admin namespaces create xndm/blackbox

查看某namespace下topic的副本数:

查看namespace的配置策略:pulsar-admin namespaces policies xndm/blackbox,可以看到bundles、replication_clusters信息

配置堆积限额策略:pulsar-admin namespaces set-backlog-quota --limit 10G --limitTime 36000 --policy producer_exception xndm/blackbox。限制namespace下的存储。producer_exception表示生产者抛异常。

查看ttl:pulsar-admin namespaces get-message-ttl xndm/blackbox

设置ttl:pulsar-admin namespaces set-message-ttl -ttl 1d xndm/blackbox,未消费的消息的保留时间,如1d表示仅保留一天。默认是永久保留。

查看保留策略:pulsar-admin namespaces get-retention xndm/blackbox,默认返回null,代表消费过的消息不保存。

设置保留策略:pulsar-admin namespaces set-retention -s 10g -t -1 xndm/blackbox 

3、topic管理

查看某namespace下所有topic:pulsar-admin topics list xndm/blackbox

禁止自动创建:broker.conf文件(如果是standalone模式,则是standalone.conf文件)中的allowAutoTopicCreation,修改为false。

①不分区topic

创建:pulsar-admin topics create persistent://xndm/blackbox/my-unpartitioned-topic。pulsar会自动删除一定时间内不活跃(没有生产者、没有订阅)的不分区topic,要想不自动删除,需要修改broker.conf文件(如果是standalone模式,则是standalone.conf文件)中的brokerDeleteInactiveTopicsEnabled,修改为false。

查看topic状态:pulsar-admin topics stats persistent://xndm/blackbox/my-unpartitioned-topic

删除:pulsar-admin topics delete persistent://xndm/blackbox/my-unpartitioned-topic

查看stats:pulsar-admin topics stats persistent://xndm/blackbox/my-unpartitioned-topic --get-precise-backlog

②分区topic

创建:pulsar-admin topics create-partitioned-topic persistent://xndm/blackbox/my-topic -p 4

查看某namespace下所有分区topic:pulsar-admin topics list-partitioned-topics xndm/blackbox

删除:pulsar-admin topics delete-partitioned-topic persistent://xndm/blackbox/my-topic

查看stats:pulsar-admin topics partitioned-stats persistent://xndm/blackbox/my-topic --per-partition,可以查看topic的分区数、topic的生产者列表(客户端ip、客户端类型(是java客户端,还是go客户端)、连接时间)、topic及各分区的消费者列表、topic及各分区的消息总数(msgInCounter字段值)、topic的订阅列表及各订阅的消费者列表(各消费者客户端ip、客户端类型(是java客户端,还是go客户端)、连接时间、已消费的消息数(msgOutCounter字段值,这个值不太准))。在各分区的publishers中可以看到producerName,在各分区的subscription的consumers中可以看到consumerName。

subscription中:

1、msgBacklog:订阅堆积(未消费)的消息数,即当前topic被当前订阅订阅后,还有多少消息没有被消费。包括那些还没到时间的延时消息。

2、msgBacklogNoDelayed:订阅堆积(未消费)的消息中,非延时消息以及到时间的延时消息的数量。msgBacklog与msgBacklogNoDelayed的差值,即为还没到时间的延时消息数。

3、msgDelayed:还没到时间的延时消息数。

4、unackedMessages:当前订阅的未ack的消息数。还没receive的消息也算。

consumer中:

1、unackedMessages:当前消费者的未ack的消息数。还没receive的消息也算。

查看内部stats:pulsar-admin topics partitioned-stats-internal persistent://xndm/blackbox/my-topic,可以看到cursor相关信息。

pulsar-client --url pulsar://xxx:6650