Sync Pulsar subscriptions
Which subscriptions can be created or deleted, and which cannot.

The recording shows kurkik pulsar sync on the demo sandbox; its data differs from this example.
Shown here: one cluster. Other broker setups are further down.
Without the extra flags
Section titled “Without the extra flags”What you get if you do not ask for the risky part:
$ kurkik pulsar sync a.yaml b --consumers --dry-runSync a.yaml into b - Apache Pulsar, cluster b (http://pulsar-b:8080)owns: namespaces shop/orders - the ones its channels live in; permissions, as x-kurkik.pulsar.server.acl declares themplan: <digest>Run one sync per cluster at a time: two at once each plan against a state the other is changing.
Nothing to change.
left alone (5) differs persistent://shop/orders/paid subscription --overwrite cannot change billing type Subscription billing is Failover on the cluster and Shared in the document. A subscription's type is chosen by the consumer that subscribes, and Pulsar has no admin call to set it: change the application, or delete the subscription so the next consumer makes it anew. cannot change billing consumers Who is connected to billing is up to the applications: sync makes subscriptions, not consumers. and 2 differences sync does not act on - servers, messages, undeclared settings; kurkik pulsar diff shows them
0 changes - 3 still differexit 2The plan
Section titled “The plan”Nothing changes yet. --dry-run only shows what would happen.
$ kurkik pulsar sync a.yaml b --consumers --overwrite --delete --dry-runSync a.yaml into b - Apache Pulsar, cluster b (http://pulsar-b:8080)owns: namespaces shop/orders - the ones its channels live in; permissions, as x-kurkik.pulsar.server.acl declares themplan: <digest>Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2) + subscribe persistent://shop/orders/paid subscription (not set) -> audit - unsubscribe persistent://shop/orders/paid [destroys messages] analytics loses its position on persistent://shop/orders/paid: made again, it starts at the end.
left alone (3) cannot change billing type Subscription billing is Failover on the cluster and Shared in the document. A subscription's type is chosen by the consumer that subscribes, and Pulsar has no admin call to set it: change the application, or delete the subscription so the next consumer makes it anew. cannot change billing consumers Who is connected to billing is up to the applications: sync makes subscriptions, not consumers. and 1 difference sync does not act on - servers, messages, undeclared settings; kurkik pulsar diff shows them
applying needs: tenant admin on shop
2 changes, 1 destroy - 2 still differ
Apache Pulsar has no rehearsal: the plan above is all of it. Nothing was changed.exit 2$ kurkik pulsar sync a.yaml b --consumers --overwrite --delete --yesSync a.yaml into b - Apache Pulsar, cluster b (http://pulsar-b:8080)owns: namespaces shop/orders - the ones its channels live in; permissions, as x-kurkik.pulsar.server.acl declares themplan: <digest>Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2) + subscribe persistent://shop/orders/paid subscription (not set) -> audit - unsubscribe persistent://shop/orders/paid [destroys messages] analytics loses its position on persistent://shop/orders/paid: made again, it starts at the end.
left alone (3) cannot change billing type Subscription billing is Failover on the cluster and Shared in the document. A subscription's type is chosen by the consumer that subscribes, and Pulsar has no admin call to set it: change the application, or delete the subscription so the next consumer makes it anew. cannot change billing consumers Who is connected to billing is up to the applications: sync makes subscriptions, not consumers. and 1 difference sync does not act on - servers, messages, undeclared settings; kurkik pulsar diff shows them
applying needs: tenant admin on shop
2 changes, 1 destroy - 2 still differ
applied [+] done subscribe persistent://shop/orders/paid subscription (not set) -> audit [+] done unsubscribe persistent://shop/orders/paid
Applied 2 of 2 changes - 3 left alonesnapshot: ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yamlrollback: ~/.local/state/kurkik/sync/b/b-<time>.rollback.yamlundo: kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yamlexit 2Rollback file
Section titled “Rollback file”Written before the first change.
rollback.yaml
system: "Apache Pulsar"target: "b (http://pulsar-b:8080)"createdAt: "<time>"document: "~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml"entries:- forAction: "create-subscription:persistent://shop/orders/paid:subscription" undo: "DELETE_CREATED_SUBSCRIPTION" target: "persistent://shop/orders/paid" field: "subscription" note: "sync created audit. Undoing it deletes it and its position." definition: subscription: "audit"- forAction: "delete-subscription:persistent://shop/orders/paid" undo: "RECREATE_DELETED_SUBSCRIPTION" target: "persistent://shop/orders/paid" note: "sync deleted analytics. It can be made again; its position cannot." definition: subscription: "analytics"Check afterwards
Section titled “Check afterwards”$ kurkik pulsar diff a.yaml b --consumersa.yaml vs b
Subscriptions ~ billing type - Its type differs. (a.yaml: Shared, b: Failover) ~ billing consumers - Who is connected differs. (a.yaml: billing-1, b: billing-2)
Notes - Not compared: ACLs, schemas, functions, connectors, configuration. Add --acls --schemas --functions --connectors --configs, or --all, to compare them.
Drift: 2 changed · 0 unmanaged · 0 missing (drift) - 13 matchedexit 2Revert
Section titled “Revert”$ kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yesRevert b to b-<time>.snapshot.yaml - Apache Pulsar, cluster b (http://pulsar-b:8080)owns: what the run being undone changed, as its rollback records itplan: <digest>Run one sync per cluster at a time: two at once each plan against a state the other is changing.
changes (2) + subscribe persistent://shop/orders/paid (not set) -> analytics - unsubscribe persistent://shop/orders/paid subscription audit -> (not set) [destroys messages] audit loses its position on persistent://shop/orders/paid.
applying needs: tenant admin on shop
2 changes, 1 destroy
holding a position in persistent://shop/orders/paid: audit - lost with it
applied [+] done subscribe persistent://shop/orders/paid (not set) -> analytics [+] done unsubscribe persistent://shop/orders/paid subscription audit -> (not set)
Applied 2 of 2 changessnapshot: ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yamlrollback: ~/.local/state/kurkik/sync/b/b-<time>.rollback.yamlundo: kurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yamlexit 0After the revert, compared with how it was before: Drift: 0 changed · 0 unmanaged · 0 missing (no drift) - 48 matched
The documents
Section titled “The documents”source.yaml, 182 lines
asyncapi: 3.0.0info: 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: schema-autoupdate: "on" tenants: - tenant: public adminRoles: [] allowedClusters: - standalone - tenant: shop adminRoles: - shop-admin allowedClusters: - standalone security: - security: NONE tls: false acl: [] consumers: - subscription: audit topics: - persistent://shop/orders/paid 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" brokerDeleteInactiveTopicsEnabled: "false" 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-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 x-kurkik: pulsar: channel: topic: persistent://shop/orders/created tenant: shop namespace: orders persistence: persistent partitions: 0 geo-replication: - standalone topicConfiguration: partitions: 0 persistence: persistent replication-clusters: - standalone schema-autoupdate: "on" persistent-shop-orders-paid: address: persistent://shop/orders/paid bindings: pulsar: bindingVersion: 0.1.0 namespace: orders persistence: persistent x-kurkik: pulsar: channel: topic: persistent://shop/orders/paid tenant: shop namespace: orders persistence: persistent partitions: 2 geo-replication: - standalone topicConfiguration: partitions: 2 persistence: persistent replication-clusters: - standalone 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: groupId: type: string enum: - audit 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: {}target.yaml, 182 lines
asyncapi: 3.0.0info: 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: schema-autoupdate: "on" tenants: - tenant: public adminRoles: [] allowedClusters: - standalone - tenant: shop adminRoles: - shop-admin allowedClusters: - standalone security: - security: NONE tls: false acl: [] consumers: - subscription: analytics topics: - persistent://shop/orders/paid consumers: [] - subscription: billing type: Failover topics: - persistent://shop/orders/created consumers: - billing-2 producers: [] functions: [] sources: [] sinks: [] brokerConfiguration: advertisedAddress: localhost backlogQuotaDefaultLimitGB: "10.0" bookkeeperClientMinNumRacksPerWriteQuorum: "1" bookkeeperClientReorderReadSequenceEnabled: "false" bookkeeperNumberOfChannelsPerBookie: "1" brokerDeleteInactiveTopicsEnabled: "false" 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 x-kurkik: pulsar: channel: topic: persistent://shop/orders/created tenant: shop namespace: orders persistence: persistent partitions: 0 geo-replication: - standalone topicConfiguration: partitions: 0 persistence: persistent replication-clusters: - standalone schema-autoupdate: "on" persistent-shop-orders-paid: address: persistent://shop/orders/paid bindings: pulsar: bindingVersion: 0.1.0 namespace: orders persistence: persistent x-kurkik: pulsar: channel: topic: persistent://shop/orders/paid tenant: shop namespace: orders persistence: persistent partitions: 2 geo-replication: - standalone topicConfiguration: partitions: 2 persistence: persistent replication-clusters: - standalone 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-2 security: [] consumerConfiguration: {} receive_persistent-shop-orders-paid: action: receive channel: $ref: "#/channels/persistent-shop-orders-paid" x-kurkik: pulsar: operation: groupId: type: string enum: - analytics 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: {}How to build this setup yourself
Clusters
Pulsar a
pulsar-admin --admin-url http://pulsar-a:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-adminpulsar-admin --admin-url http://pulsar-a:8080 namespaces create shop/orders --clusters standalonepulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/createdpulsar-admin --admin-url http://pulsar-a:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2pulsar-client --url pulsar://pulsar-a:6650 consume persistent://shop/orders/created -s billing -t Shared -n 0 & # connected as billing-1 while readpulsar-admin --admin-url http://pulsar-a:8080 topics create-subscription persistent://shop/orders/paid --subscription audit --messageId earliestPulsar b
pulsar-admin --admin-url http://pulsar-b:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-adminpulsar-admin --admin-url http://pulsar-b:8080 namespaces create shop/orders --clusters standalonepulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/createdpulsar-admin --admin-url http://pulsar-b:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2pulsar-client --url pulsar://pulsar-b:6650 consume persistent://shop/orders/created -s billing -t Failover -n 0 & # connected as billing-2 while readpulsar-admin --admin-url http://pulsar-b:8080 topics create-subscription persistent://shop/orders/paid --subscription analytics --messageId earliestSync
kurkik conn add pulsar a --admin-url http://pulsar-a:8080 --service-url pulsar://pulsar-a:6650 --client 4.0kurkik conn add pulsar b --admin-url http://pulsar-b:8080 --service-url pulsar://pulsar-b:6650 --client 4.0kurkik pulsar export a --this-cluster-only --acls --consumers --stdout > a.yaml # source.yaml (and b's, before: target.yaml)kurkik pulsar sync a.yaml b --consumers --dry-run # plan-without.txtkurkik pulsar sync a.yaml b --consumers --overwrite --delete --dry-run # plan.txt (and -o json: plan.json)kurkik pulsar sync a.yaml b --consumers --overwrite --delete --yes # apply.txt, and the reverse patch: rollback.yamlkurkik pulsar diff a.yaml b --consumers # after.txtkurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txtOther broker setups
Section titled “Other broker setups”Two geo-replicated clusters, alike
Section titled “Two geo-replicated clusters, alike”Same plan.
How to build this setup yourself
Clusters
Pulsar a
pulsar-admin --admin-url http://pulsar-a:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-adminpulsar-admin --admin-url http://pulsar-a:8080 namespaces create shop/orders --clusters standalonepulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/createdpulsar-admin --admin-url http://pulsar-a:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2pulsar-client --url pulsar://pulsar-a:6650 consume persistent://shop/orders/created -s billing -t Shared -n 0 & # connected as billing-1 while readpulsar-admin --admin-url http://pulsar-a:8080 topics create-subscription persistent://shop/orders/paid --subscription audit --messageId earliestPulsar b
pulsar-admin --admin-url http://pulsar-b:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-adminpulsar-admin --admin-url http://pulsar-b:8080 namespaces create shop/orders --clusters standalonepulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/createdpulsar-admin --admin-url http://pulsar-b:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2pulsar-client --url pulsar://pulsar-b:6650 consume persistent://shop/orders/created -s billing -t Failover -n 0 & # connected as billing-2 while readpulsar-admin --admin-url http://pulsar-b:8080 topics create-subscription persistent://shop/orders/paid --subscription analytics --messageId earliestSync
kurkik conn add pulsar a --admin-url http://pulsar-a:8080 --service-url pulsar://pulsar-a:6650 --client 4.0kurkik conn add pulsar b --admin-url http://pulsar-b:8080 --service-url pulsar://pulsar-b:6650 --client 4.0kurkik pulsar export a --this-cluster-only --acls --consumers --stdout > a.yaml # source.yaml (and b's, before: target.yaml)kurkik pulsar sync a.yaml b --consumers --dry-run # plan-without.txtkurkik pulsar sync a.yaml b --consumers --overwrite --delete --dry-run # plan.txt (and -o json: plan.json)kurkik pulsar sync a.yaml b --consumers --overwrite --delete --yes # apply.txt, and the reverse patch: rollback.yamlkurkik pulsar diff a.yaml b --consumers # after.txtkurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txtTwo geo-replicated clusters that differ
Section titled “Two geo-replicated clusters that differ”Same plan.
How to build this setup yourself
Clusters
Pulsar a
pulsar-admin --admin-url http://pulsar-a:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-adminpulsar-admin --admin-url http://pulsar-a:8080 namespaces create shop/orders --clusters standalonepulsar-admin --admin-url http://pulsar-a:8080 topics create persistent://shop/orders/createdpulsar-admin --admin-url http://pulsar-a:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2pulsar-client --url pulsar://pulsar-a:6650 consume persistent://shop/orders/created -s billing -t Shared -n 0 & # connected as billing-1 while readpulsar-admin --admin-url http://pulsar-a:8080 topics create-subscription persistent://shop/orders/paid --subscription audit --messageId earliestPulsar b
pulsar-admin --admin-url http://pulsar-b:8080 tenants create shop --allowed-clusters standalone --admin-roles shop-adminpulsar-admin --admin-url http://pulsar-b:8080 namespaces create shop/orders --clusters standalonepulsar-admin --admin-url http://pulsar-b:8080 topics create persistent://shop/orders/createdpulsar-admin --admin-url http://pulsar-b:8080 topics create-partitioned-topic persistent://shop/orders/paid --partitions 2pulsar-client --url pulsar://pulsar-b:6650 consume persistent://shop/orders/created -s billing -t Failover -n 0 & # connected as billing-2 while readpulsar-admin --admin-url http://pulsar-b:8080 topics create-subscription persistent://shop/orders/paid --subscription analytics --messageId earliestSync
kurkik conn add pulsar a --admin-url http://pulsar-a:8080 --service-url pulsar://pulsar-a:6650 --client 4.0kurkik conn add pulsar b --admin-url http://pulsar-b:8080 --service-url pulsar://pulsar-b:6650 --client 4.0kurkik pulsar export a --this-cluster-only --acls --consumers --stdout > a.yaml # source.yaml (and b's, before: target.yaml)kurkik pulsar sync a.yaml b --consumers --dry-run # plan-without.txtkurkik pulsar sync a.yaml b --consumers --overwrite --delete --dry-run # plan.txt (and -o json: plan.json)kurkik pulsar sync a.yaml b --consumers --overwrite --delete --yes # apply.txt, and the reverse patch: rollback.yamlkurkik pulsar diff a.yaml b --consumers # after.txtkurkik pulsar sync revert ~/.local/state/kurkik/sync/b/b-<time>.snapshot.yaml b --force --yes # revert.txtAll flags: kurkik pulsar sync · more Apache Pulsar sync examples
Copyright © 2026 Pavel Bodiachevskii