Skip to content

Compare Pulsar namespace and topic policies

TTL, retention, broker settings: see what differs.

Terminal recording of kurkik pulsar diff

The recording shows kurkik pulsar diff on the demo sandbox; its data differs from this example.

Shown here: one cluster. Other broker setups are further down.

Terminal window
kurkik pulsar diff a b --configs --consumers
a vs b
Broker configuration
~ standalone dispatchThrottlingRatePerTopicInMsg - dispatchThrottlingRatePerTopicInMsg is set on a and left at the default on b. (a: 1000, b: (default))
Namespace policies
~ shop/orders message-ttl - message-ttl differs. (a: 3600, b: 7200)
~ shop/orders retention - shop/orders sets retention on b and not on a. (a: (not set), b: timeInMinutes=60, sizeInMB=20480)
Topic policies
~ persistent://shop/orders/created message-ttl - message-ttl differs. (a: 3600, b: 7200)
~ persistent://shop/orders/created retention origin - retention is set on the topic on a and inherited from its namespace on b. (a: topic, b: namespace)
~ persistent://shop/orders/paid deduplication - deduplication is in force on a and not set on b. (a: true, b: (not set))
~ persistent://shop/orders/paid message-ttl - message-ttl differs. (a: 3600, b: 7200)
~ persistent://shop/orders/paid retention - retention is in force on b and not set on a. (a: (not set), b: timeInMinutes=60, sizeInMB=20480)
Subscriptions
~ billing type - Its type differs. (a: Shared, b: Failover)
Notes
- Broker settings that name a machine or a cluster were not compared: advertisedAddress, clusterName, metadataStoreUrl, statusFilePath.
- Not compared: ACLs, schemas, functions, connectors. Add --acls --schemas --functions --connectors, or --all, to compare them.
Drift: 9 changed · 0 unmanaged · 0 missing (drift) - 37 matched
exit 2

Exit code 2: drift found, so a CI job can stop here.

Mark Means
~ both sides have it, but it differs
! only the first side has it
+ only the second side has it
Compare Command Result
two clusters kurkik pulsar diff a b --configs --consumers Drift: 9 changed · 0 unmanaged · 0 missing (drift) - 37 matched
a document and a cluster kurkik pulsar diff a.yaml b --configs --consumers Drift: 9 changed · 0 unmanaged · 0 missing (drift) - 37 matched
two documents kurkik pulsar diff a.yaml b.yaml --configs --consumers Drift: 9 changed · 0 unmanaged · 0 missing (drift) - 37 matched

Download the JSON report (-o json)

a.yaml, 197 lines
asyncapi: 3.0.0
info:
title: a Apache Pulsar API
version: 1.0.0-SNAPSHOT
description: Generated by reading Apache Pulsar of a (http://pulsar-a:8080).
servers:
standalone:
host: pulsar-a:6650
protocol: pulsar
protocolVersion: "4.0"
description: Apache Pulsar cluster standalone.
bindings:
pulsar:
bindingVersion: 0.1.0
tenant: shop
x-kurkik:
pulsar:
server:
cluster: standalone
brokers:
- localhost:8080
schemaRegistryUrl: http://pulsar-a:8080
schemaRegistryVendor: pulsar
namespacePolicies:
public/default:
schema-autoupdate: "on"
shop/orders:
message-ttl: 3600
schema-autoupdate: "on"
tenants:
- tenant: public
adminRoles: []
allowedClusters:
- standalone
- tenant: shop
adminRoles:
- shop-admin
allowedClusters:
- standalone
security:
- security: NONE
tls: false
acl: []
consumers:
- subscription: billing
type: Shared
topics:
- persistent://shop/orders/created
consumers:
- billing-1
producers: []
functions: []
sources: []
sinks: []
brokerConfiguration:
advertisedAddress: localhost
backlogQuotaDefaultLimitGB: "10.0"
bookkeeperClientMinNumRacksPerWriteQuorum: "1"
bookkeeperClientReorderReadSequenceEnabled: "false"
bookkeeperNumberOfChannelsPerBookie: "1"
clusterName: standalone
dispatchThrottlingRatePerTopicInMsg: "1000"
enablePackagesManagement: "true"
forceDeleteNamespaceAllowed: "true"
functionsWorkerEnablePackageManagement: "true"
isRunningStandalone: "true"
loadBalancerEnabled: "false"
loadManagerClassName: org.apache.pulsar.broker.loadbalance.NoopLoadManager
managedLedgerCacheEvictionFrequency: "100.0"
managedLedgerDefaultAckQuorum: "1"
managedLedgerDefaultEnsembleSize: "1"
managedLedgerDefaultMarkDeleteRateLimit: "0.1"
managedLedgerDefaultWriteQuorum: "1"
metadataStoreUrl: rocksdb:///pulsar/data/metadata
packagesManagementStorageProvider: org.apache.pulsar.packages.management.storage.filesystem.FileSystemPackagesStorageProvider
statusFilePath: /usr/local/apache/htdocs
topicPublisherThrottlingTickTimeMillis: "2"
webSocketServiceEnabled: "true"
clientConfiguration:
serviceUrl: pulsar://pulsar-a:6650
webServiceUrl: http://pulsar-a:8080
producerConfiguration: {}
consumerConfiguration: {}
channels:
persistent-shop-orders-created:
address: persistent://shop/orders/created
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
retention:
time: 60
size: 20480
ttl: 3600
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/created
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
retention:
time: 60
size: 20480
ttl: 3600
topicConfiguration:
message-ttl: 3600
partitions: 0
persistence: persistent
replication-clusters:
- standalone
retention:
timeInMinutes: 60
sizeInMB: 20480
schema-autoupdate: "on"
setOnTopic:
- retention
persistent-shop-orders-paid:
address: persistent://shop/orders/paid
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
ttl: 3600
deduplication: true
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/paid
tenant: shop
namespace: orders
persistence: persistent
partitions: 2
deduplication: true
geo-replication:
- standalone
ttl: 3600
topicConfiguration:
deduplication: true
message-ttl: 3600
partitions: 2
persistence: persistent
replication-clusters:
- standalone
schema-autoupdate: "on"
setOnTopic:
- deduplication
operations:
receive_persistent-shop-orders-created:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-created"
x-kurkik:
pulsar:
operation:
groupId:
type: string
enum:
- billing
clientId:
type: string
enum:
- billing-1
security: []
consumerConfiguration: {}
receive_persistent-shop-orders-paid:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-paid"
x-kurkik:
pulsar:
operation:
security: []
consumerConfiguration: {}
send_persistent-shop-orders-created:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-created"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}
send_persistent-shop-orders-paid:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-paid"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}

Download a.yaml

b.yaml, 201 lines
asyncapi: 3.0.0
info:
title: b Apache Pulsar API
version: 1.0.0-SNAPSHOT
description: Generated by reading Apache Pulsar of b (http://pulsar-b:8080).
servers:
standalone:
host: pulsar-b:6650
protocol: pulsar
protocolVersion: "4.0"
description: Apache Pulsar cluster standalone.
bindings:
pulsar:
bindingVersion: 0.1.0
tenant: shop
x-kurkik:
pulsar:
server:
cluster: standalone
brokers:
- localhost:8080
schemaRegistryUrl: http://pulsar-b:8080
schemaRegistryVendor: pulsar
namespacePolicies:
public/default:
schema-autoupdate: "on"
shop/orders:
message-ttl: 7200
retention:
timeInMinutes: 60
sizeInMB: 20480
schema-autoupdate: "on"
tenants:
- tenant: public
adminRoles: []
allowedClusters:
- standalone
- tenant: shop
adminRoles:
- shop-admin
allowedClusters:
- standalone
security:
- security: NONE
tls: false
acl: []
consumers:
- subscription: billing
type: Failover
topics:
- persistent://shop/orders/created
consumers:
- billing-1
producers: []
functions: []
sources: []
sinks: []
brokerConfiguration:
advertisedAddress: localhost
backlogQuotaDefaultLimitGB: "10.0"
bookkeeperClientMinNumRacksPerWriteQuorum: "1"
bookkeeperClientReorderReadSequenceEnabled: "false"
bookkeeperNumberOfChannelsPerBookie: "1"
clusterName: standalone
enablePackagesManagement: "true"
forceDeleteNamespaceAllowed: "true"
functionsWorkerEnablePackageManagement: "true"
isRunningStandalone: "true"
loadBalancerEnabled: "false"
loadManagerClassName: org.apache.pulsar.broker.loadbalance.NoopLoadManager
managedLedgerCacheEvictionFrequency: "100.0"
managedLedgerDefaultAckQuorum: "1"
managedLedgerDefaultEnsembleSize: "1"
managedLedgerDefaultMarkDeleteRateLimit: "0.1"
managedLedgerDefaultWriteQuorum: "1"
metadataStoreUrl: rocksdb:///pulsar/data/metadata
packagesManagementStorageProvider: org.apache.pulsar.packages.management.storage.filesystem.FileSystemPackagesStorageProvider
statusFilePath: /usr/local/apache/htdocs
topicPublisherThrottlingTickTimeMillis: "2"
webSocketServiceEnabled: "true"
clientConfiguration:
serviceUrl: pulsar://pulsar-b:6650
webServiceUrl: http://pulsar-b:8080
producerConfiguration: {}
consumerConfiguration: {}
channels:
persistent-shop-orders-created:
address: persistent://shop/orders/created
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
retention:
time: 60
size: 20480
ttl: 7200
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/created
tenant: shop
namespace: orders
persistence: persistent
partitions: 0
geo-replication:
- standalone
retention:
time: 60
size: 20480
ttl: 7200
topicConfiguration:
message-ttl: 7200
partitions: 0
persistence: persistent
replication-clusters:
- standalone
retention:
timeInMinutes: 60
sizeInMB: 20480
schema-autoupdate: "on"
persistent-shop-orders-paid:
address: persistent://shop/orders/paid
bindings:
pulsar:
bindingVersion: 0.1.0
namespace: orders
persistence: persistent
retention:
time: 60
size: 20480
ttl: 7200
x-kurkik:
pulsar:
channel:
topic: persistent://shop/orders/paid
tenant: shop
namespace: orders
persistence: persistent
partitions: 2
geo-replication:
- standalone
retention:
time: 60
size: 20480
ttl: 7200
topicConfiguration:
message-ttl: 7200
partitions: 2
persistence: persistent
replication-clusters:
- standalone
retention:
timeInMinutes: 60
sizeInMB: 20480
schema-autoupdate: "on"
operations:
receive_persistent-shop-orders-created:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-created"
x-kurkik:
pulsar:
operation:
groupId:
type: string
enum:
- billing
clientId:
type: string
enum:
- billing-1
security: []
consumerConfiguration: {}
receive_persistent-shop-orders-paid:
action: receive
channel:
$ref: "#/channels/persistent-shop-orders-paid"
x-kurkik:
pulsar:
operation:
security: []
consumerConfiguration: {}
send_persistent-shop-orders-created:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-created"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}
send_persistent-shop-orders-paid:
action: send
channel:
$ref: "#/channels/persistent-shop-orders-paid"
x-kurkik:
pulsar:
operation:
security: []
producerConfiguration: {}

Download b.yaml

How to build this setup yourself

Clusters

Fixture

Terminal window
pulsar-admin tenants create shop --allowed-clusters <its cluster> --admin-roles shop-admin
pulsar-admin namespaces create shop/orders --clusters <its cluster>
pulsar-admin topics create persistent://shop/orders/created
pulsar-admin topics create-partitioned-topic persistent://shop/orders/paid --partitions 2

Side a

Terminal window
pulsar-admin --admin-url http://pulsar-a:8080 brokers update-dynamic-config --config dispatchThrottlingRatePerTopicInMsg --value 1000
pulsar-client --url pulsar://pulsar-a:6650 consume persistent://shop/orders/created -s billing -t Shared -n 0 & # connected as billing-1 while read
pulsar-admin --admin-url http://pulsar-a:8080 namespaces set-message-ttl shop/orders --messageTTL 3600
pulsar-admin --admin-url http://pulsar-a:8080 topicPolicies set-retention persistent://shop/orders/created --time 60m --size 20480M
pulsar-admin --admin-url http://pulsar-a:8080 topicPolicies set-deduplication persistent://shop/orders/paid --enable

Side b

Terminal window
pulsar-client --url pulsar://pulsar-b:6650 consume persistent://shop/orders/created -s billing -t Failover -n 0 & # connected as billing-1 while read
pulsar-admin --admin-url http://pulsar-b:8080 namespaces set-message-ttl shop/orders --messageTTL 7200
pulsar-admin --admin-url http://pulsar-b:8080 namespaces set-retention shop/orders --time 60m --size 20480M

Compare

Terminal window
kurkik conn add pulsar a --admin-url http://pulsar-a:8080 --service-url pulsar://pulsar-a:6650
kurkik conn add pulsar b --admin-url http://pulsar-b:8080 --service-url pulsar://pulsar-b:6650
kurkik pulsar export a --this-cluster-only --acls --consumers --stdout > a.yaml
kurkik pulsar export b --this-cluster-only --acls --consumers --stdout > b.yaml
kurkik pulsar diff a b --configs --consumers # cluster-vs-cluster
kurkik pulsar diff a.yaml b --configs --consumers # document-vs-cluster
kurkik pulsar diff a.yaml b.yaml --configs --consumers # document-vs-document
Show the output
east vs west
Broker configuration
~ east/west dispatchThrottlingRatePerTopicInMsg - dispatchThrottlingRatePerTopicInMsg is set on east and left at the default on west. (east: 1000, west: (default))
Namespace policies
~ shop/orders message-ttl - message-ttl differs. (east: 3600, west: 7200)
~ shop/orders retention - shop/orders sets retention on west and not on east. (east: (not set), west: timeInMinutes=60, sizeInMB=20480)
Topic policies
~ persistent://shop/orders/created message-ttl - message-ttl differs. (east: 3600, west: 7200)
~ persistent://shop/orders/created retention origin - retention is set on the topic on east and inherited from its namespace on west. (east: topic, west: namespace)
~ persistent://shop/orders/paid deduplication - deduplication is in force on east and not set on west. (east: true, west: (not set))
~ persistent://shop/orders/paid message-ttl - message-ttl differs. (east: 3600, west: 7200)
~ persistent://shop/orders/paid retention - retention is in force on west and not set on east. (east: (not set), west: timeInMinutes=60, sizeInMB=20480)
Subscriptions
~ billing type - Its type differs. (east: Shared, west: Failover)
Notes
- Broker settings that name a machine or a cluster were not compared: advertisedAddress, clusterName, metadataStoreUrl, statusFilePath.
- Not compared: ACLs, schemas, functions, connectors. Add --acls --schemas --functions --connectors, or --all, to compare them.
Drift: 9 changed · 0 unmanaged · 0 missing (drift) - 37 matched
exit 2

Download

How to build this setup yourself

Clusters

Terminal window
pulsar-admin --admin-url http://pulsar-east:8080 clusters create west --url http://pulsar-west:8080 --broker-url pulsar://pulsar-west:6650
pulsar-admin --admin-url http://pulsar-west:8080 clusters create east --url http://pulsar-east:8080 --broker-url pulsar://pulsar-east:6650

Fixture

Terminal window
pulsar-admin tenants create shop --allowed-clusters east,west --admin-roles shop-admin
pulsar-admin namespaces create shop/orders --clusters east,west
pulsar-admin tenants update public --allowed-clusters east,west # Pulsar's own tenant, allowed on the pair as shop is
pulsar-admin topics create persistent://shop/orders/created
pulsar-admin topics create-partitioned-topic persistent://shop/orders/paid --partitions 2

Side east

Terminal window
pulsar-admin --admin-url http://pulsar-east:8080 brokers update-dynamic-config --config dispatchThrottlingRatePerTopicInMsg --value 1000
pulsar-client --url pulsar://pulsar-east:6650 consume persistent://shop/orders/created -s billing -t Shared -n 0 & # connected as billing-1 while read
pulsar-admin --admin-url http://pulsar-east:8080 namespaces set-message-ttl shop/orders --messageTTL 3600
pulsar-admin --admin-url http://pulsar-east:8080 topicPolicies set-retention persistent://shop/orders/created --time 60m --size 20480M
pulsar-admin --admin-url http://pulsar-east:8080 topicPolicies set-deduplication persistent://shop/orders/paid --enable

Side west

Terminal window
pulsar-client --url pulsar://pulsar-west:6650 consume persistent://shop/orders/created -s billing -t Failover -n 0 & # connected as billing-1 while read
pulsar-admin --admin-url http://pulsar-west:8080 namespaces set-message-ttl shop/orders --messageTTL 7200
pulsar-admin --admin-url http://pulsar-west:8080 namespaces set-retention shop/orders --time 60m --size 20480M

Compare

Terminal window
kurkik conn add pulsar east --admin-url http://pulsar-east:8080 --service-url pulsar://pulsar-east:6650
kurkik conn add pulsar west --admin-url http://pulsar-west:8080 --service-url pulsar://pulsar-west:6650
kurkik pulsar export east --this-cluster-only --acls --consumers --stdout > east.yaml
kurkik pulsar export west --this-cluster-only --acls --consumers --stdout > west.yaml
kurkik pulsar diff east west --configs --consumers # cluster-vs-cluster
kurkik pulsar diff east.yaml west --configs --consumers # document-vs-cluster
kurkik pulsar diff east.yaml west.yaml --configs --consumers # document-vs-document
Show the output
east vs west
Broker configuration
~ east/west dispatchThrottlingRatePerTopicInMsg - dispatchThrottlingRatePerTopicInMsg is set on east and left at the default on west. (east: 1000, west: (default))
Topics
! persistent://shop/east-only/records topic - Topic persistent://shop/east-only/records is not on west. (east: persistent://shop/east-only/records)
+ persistent://shop/west-only/records topic - Topic persistent://shop/west-only/records is not on east. (west: persistent://shop/west-only/records)
Namespace policies
! shop/east-only namespace - Namespace shop/east-only is on east and not on west. (east: shop/east-only)
~ shop/east-only schema-autoupdate - shop/east-only sets schema-autoupdate on east and not on west. (east: on, west: (not set))
~ shop/orders message-ttl - message-ttl differs. (east: 3600, west: 7200)
~ shop/orders retention - shop/orders sets retention on west and not on east. (east: (not set), west: timeInMinutes=60, sizeInMB=20480)
+ shop/west-only namespace - Namespace shop/west-only is on west and not on east. (west: shop/west-only)
Topic policies
~ persistent://shop/orders/created message-ttl - message-ttl differs. (east: 3600, west: 7200)
~ persistent://shop/orders/created retention origin - retention is set on the topic on east and inherited from its namespace on west. (east: topic, west: namespace)
~ persistent://shop/orders/paid deduplication - deduplication is in force on east and not set on west. (east: true, west: (not set))
~ persistent://shop/orders/paid message-ttl - message-ttl differs. (east: 3600, west: 7200)
~ persistent://shop/orders/paid retention - retention is in force on west and not set on east. (east: (not set), west: timeInMinutes=60, sizeInMB=20480)
Subscriptions
~ billing type - Its type differs. (east: Shared, west: Failover)
! east-reports subscription - Subscription east-reports is on east and not on west. (east: east-reports)
+ west-reports subscription - Subscription west-reports is on west and not on east. (west: west-reports)
Notes
- Broker settings that name a machine or a cluster were not compared: advertisedAddress, clusterName, metadataStoreUrl, statusFilePath.
- Not compared: ACLs, schemas, functions, connectors. Add --acls --schemas --functions --connectors, or --all, to compare them.
Drift: 10 changed · 3 unmanaged · 3 missing (drift) - 37 matched
exit 2

Download

How to build this setup yourself

Clusters

Terminal window
pulsar-admin --admin-url http://pulsar-east:8080 clusters create west --url http://pulsar-west:8080 --broker-url pulsar://pulsar-west:6650
pulsar-admin --admin-url http://pulsar-west:8080 clusters create east --url http://pulsar-east:8080 --broker-url pulsar://pulsar-east:6650

Fixture

Terminal window
pulsar-admin tenants create shop --allowed-clusters east,west --admin-roles shop-admin
pulsar-admin namespaces create shop/orders --clusters east,west
pulsar-admin tenants update public --allowed-clusters east,west # Pulsar's own tenant, allowed on the pair as shop is
pulsar-admin topics create persistent://shop/orders/created
pulsar-admin topics create-partitioned-topic persistent://shop/orders/paid --partitions 2
Terminal window
pulsar-admin --admin-url http://pulsar-east:8080 namespaces create shop/east-only --clusters east
pulsar-admin --admin-url http://pulsar-east:8080 topics create persistent://shop/east-only/records
pulsar-admin --admin-url http://pulsar-east:8080 namespaces grant-permission shop/east-only --role east-team --actions consume,produce
pulsar-admin --admin-url http://pulsar-east:8080 topics create-subscription persistent://shop/east-only/records --subscription east-reports
pulsar-admin --admin-url http://pulsar-west:8080 namespaces create shop/west-only --clusters west
pulsar-admin --admin-url http://pulsar-west:8080 topics create persistent://shop/west-only/records
pulsar-admin --admin-url http://pulsar-west:8080 namespaces grant-permission shop/west-only --role west-team --actions consume,produce
pulsar-admin --admin-url http://pulsar-west:8080 topics create-subscription persistent://shop/west-only/records --subscription west-reports

Side east

Terminal window
pulsar-admin --admin-url http://pulsar-east:8080 brokers update-dynamic-config --config dispatchThrottlingRatePerTopicInMsg --value 1000
pulsar-client --url pulsar://pulsar-east:6650 consume persistent://shop/orders/created -s billing -t Shared -n 0 & # connected as billing-1 while read
pulsar-admin --admin-url http://pulsar-east:8080 namespaces set-message-ttl shop/orders --messageTTL 3600
pulsar-admin --admin-url http://pulsar-east:8080 topicPolicies set-retention persistent://shop/orders/created --time 60m --size 20480M
pulsar-admin --admin-url http://pulsar-east:8080 topicPolicies set-deduplication persistent://shop/orders/paid --enable

Side west

Terminal window
pulsar-client --url pulsar://pulsar-west:6650 consume persistent://shop/orders/created -s billing -t Failover -n 0 & # connected as billing-1 while read
pulsar-admin --admin-url http://pulsar-west:8080 namespaces set-message-ttl shop/orders --messageTTL 7200
pulsar-admin --admin-url http://pulsar-west:8080 namespaces set-retention shop/orders --time 60m --size 20480M

Compare

Terminal window
kurkik conn add pulsar east --admin-url http://pulsar-east:8080 --service-url pulsar://pulsar-east:6650
kurkik conn add pulsar west --admin-url http://pulsar-west:8080 --service-url pulsar://pulsar-west:6650
kurkik pulsar export east --this-cluster-only --acls --consumers --stdout > east.yaml
kurkik pulsar export west --this-cluster-only --acls --consumers --stdout > west.yaml
kurkik pulsar diff east west --configs --consumers # cluster-vs-cluster
kurkik pulsar diff east.yaml west --configs --consumers # document-vs-cluster
kurkik pulsar diff east.yaml west.yaml --configs --consumers # document-vs-document

All flags: kurkik pulsar diff · more Apache Pulsar diff examples