Moving Pulsar looks simple until you list what lives inside it:

  • ⚡ Functions that someone deployed from a laptop last spring
  • 🔌 Sources and sinks quietly moving data in and out
  • 🔐 Permissions on namespaces and topics
  • ⚙️ Policies: retention, TTL, deduplication, backlog quotas, schema compatibility

Kurkik writes all of it into one AsyncAPI document you can compare with and sync from

curl -fsSL https://kurkik.pavelon.dev/install.sh | sh 

The scenario

Two clusters from the demo sandbox: shop-prod is the old home, shop-dr is the new one. The new cluster has the shop/orders namespace and not much else: no policies, no permissions, no processors, 8 partitions where there should be 6, and a leftover legacy topic

I added to the demo for this post: an audit-log sink on shop-prod, and package management on shop-dr

Step 1: say which package each processor runs

This is the part everybody misses. Pulsar never tells which package a function, source or sink was deployed from. So write it down once, in packages.txt (your build pipeline knows it):

function:shop/orders/enrich=function://shop/orders/enrich@1 function:shop/orders/normalise=function://shop/orders/normalise@1 source:shop/orders/ticks=source://shop/orders/ticks@1 sink:shop/orders/audit-log=sink://shop/orders/audit-log@1 

And publish those packages to the new cluster, for example:

pulsar-admin packages upload function://shop/orders/enrich@1 --path processors.jar --description enrich 

Step 2: write the old cluster down

kurkik pulsar export shop-prod --acls --consumers --packages packages.txt 

The servers part keeps policies, permissions, functions and sinks:

servers: standalone: host: localhost:6650 protocol: pulsar protocolVersion: "5.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://localhost:28080 schemaRegistryVendor: pulsar namespacePolicies: public/default: schema-autoupdate: "on" shop/orders: backlog-quota destination_storage: "limit 536870912 bytes, producer_request_hold" deduplication: true message-ttl: 600 retention: timeInMinutes: 60 sizeInMB: 1024 schema-autoupdate: "on" schema-compatibility-strategy: BACKWARD # ... tenants and security ...  acl: - role: billing resourceType: namespace name: shop/orders actions: - consume - role: checkout resourceType: namespace name: shop/orders actions: - produce - role: audit resourceType: topic name: persistent://shop/orders/created actions: - consume # ... subscriptions ...  functions: - tenant: shop namespace: orders name: enrich runtime: JAVA className: com.github.pakisan.kurkik.pulsar.fixtures.Enrich archive: function://shop/orders/enrich@1 inputs: - persistent://shop/orders/created output: persistent://shop/orders/enriched subscriptionName: enrich parallelism: 2 processingGuarantees: ATLEAST_ONCE # ... the normalise function and the ticks source ...  sinks: - tenant: shop namespace: orders name: audit-log className: com.github.pakisan.kurkik.pulsar.fixtures.AuditLog archive: sink://shop/orders/audit-log@1 inputs: - persistent://shop/orders/enriched subscriptionName: audit-log parallelism: 1 processingGuarantees: ATLEAST_ONCE # ... broker settings ... 

In channels, each topic keeps its schema and policies:

channels: persistent-shop-orders-created: address: persistent://shop/orders/created messages: persistent-shop-orders-created: payload: schemaFormat: application/vnd.apache.avro;version=1.9.0 schema: type: record name: OrderCreated namespace: com.shop fields: - name: id type: string - name: total type: long name: persistent-shop-orders-created title: persistent://shop/orders/created summary: "Schema read from Pulsar's own registry: AVRO, version 0." x-kurkik: pulsar: message: schemaType: AVRO schemaVersion: 0 schemaIdLocation: metadata schemaLookupStrategy: topic schemaCompatibility: BACKWARD key: type: string bindings: pulsar: bindingVersion: 0.1.0 namespace: orders persistence: persistent retention: time: 60 size: 1024 ttl: 600 deduplication: true 

And operations shows how permissions apply to each topic. send is who produces, receive is who consumes, with the subscriptions and the functions or sinks attached:

operations: receive_persistent-shop-orders-created: action: receive channel: $ref: "#/channels/persistent-shop-orders-created" x-kurkik: pulsar: operation: groupId: type: string enum: - audit - billing - enrich security: - audit - billing processors: - type: function name: shop/orders/enrich server: standalone consumerConfiguration: {} send_persistent-shop-orders-enriched: action: send channel: $ref: "#/channels/persistent-shop-orders-enriched" x-kurkik: pulsar: operation: security: - checkout processors: - type: function name: shop/orders/enrich server: standalone producerConfiguration: {} receive_persistent-shop-orders-enriched: action: receive channel: $ref: "#/channels/persistent-shop-orders-enriched" x-kurkik: pulsar: operation: groupId: type: string enum: - audit-log security: - billing processors: - type: sink name: shop/orders/audit-log server: standalone consumerConfiguration: {} 

So for created you see at once that the audit and billing roles may consume it, that it has the audit, billing and enrich subscriptions, and that the enrich function reads from it

The whole document is at the end

Step 3: look for yourself

kurkik pulsar scan shop-prod --acls shop-prod - Apache Pulsar 5.0.0, clusters standalone public default pulsar shop orders grants billing: consume grants checkout: produce created retention 60m/1024MB, ttl 600s, deduplication on, replicated to standalone grants audit: consume read by function shop/orders/enrich enriched retention 60m/1024MB, ttl 600s, deduplication on, replicated to standalone written by function shop/orders/enrich read by sink shop/orders/audit-log normalised retention 60m/1024MB, ttl 600s, deduplication on, replicated to standalone written by function shop/orders/normalise paid 6 partition(s), retention 60m/1024MB, ttl 600s, deduplication on, replicated to standalone raw retention 60m/1024MB, ttl 600s, deduplication on, replicated to standalone read by function shop/orders/normalise refunds retention 60m/1024MB, ttl 600s, deduplication on, replicated to standalone ticks retention 60m/1024MB, ttl 600s, deduplication on, replicated to standalone written by source shop/orders/ticks fn enrich shop/orders/created → shop/orders/enriched (sub: enrich) fn normalise shop/orders/raw → shop/orders/normalised (sub: normalise) source ticks → shop/orders/ticks sink audit-log ← shop/orders/enriched (sub: audit-log) subscriptions: not read (--consumers) 
kurkik pulsar diff shop-prod shop-dr --all shop-prod vs shop-dr Topics ! persistent://shop/orders/created topic - Topic persistent://shop/orders/created is not on shop-dr. (shop-prod: persistent://shop/orders/created) ! persistent://shop/orders/enriched topic - Topic persistent://shop/orders/enriched is not on shop-dr. (shop-prod: persistent://shop/orders/enriched) + persistent://shop/orders/legacy topic - Topic persistent://shop/orders/legacy is not on shop-prod. (shop-dr: persistent://shop/orders/legacy) ! persistent://shop/orders/normalised topic - Topic persistent://shop/orders/normalised is not on shop-dr. (shop-prod: persistent://shop/orders/normalised) ! persistent://shop/orders/raw topic - Topic persistent://shop/orders/raw is not on shop-dr. (shop-prod: persistent://shop/orders/raw) ! persistent://shop/orders/refunds topic - Topic persistent://shop/orders/refunds is not on shop-dr. (shop-prod: persistent://shop/orders/refunds) ! persistent://shop/orders/ticks topic - Topic persistent://shop/orders/ticks is not on shop-dr. (shop-prod: persistent://shop/orders/ticks) Partitions and persistence ~ persistent://shop/orders/paid partitions - Its partitions differ. (shop-prod: 6, shop-dr: 8) Namespace policies ~ shop/orders backlog-quota destination_storage - shop/orders sets backlog-quota destination_storage on shop-prod and not on shop-dr. (shop-prod: limit 536870912 bytes, producer_request_hold, shop-dr: (not set)) ~ shop/orders deduplication - shop/orders sets deduplication on shop-prod and not on shop-dr. (shop-prod: true, shop-dr: (not set)) ~ shop/orders message-ttl - shop/orders sets message-ttl on shop-prod and not on shop-dr. (shop-prod: 600, shop-dr: (not set)) ~ shop/orders retention - shop/orders sets retention on shop-prod and not on shop-dr. (shop-prod: timeInMinutes=60, sizeInMB=1024, shop-dr: (not set)) ~ shop/orders schema-compatibility-strategy - shop/orders sets schema-compatibility-strategy on shop-prod and not on shop-dr. (shop-prod: BACKWARD, shop-dr: (not set)) Topic policies ~ persistent://shop/orders/paid backlog-quota destination_storage - backlog-quota destination_storage is in force on shop-prod and not set on shop-dr. (shop-prod: limit 536870912 bytes, producer_request_hold, shop-dr: (not set)) ~ persistent://shop/orders/paid deduplication - deduplication is in force on shop-prod and not set on shop-dr. (shop-prod: true, shop-dr: (not set)) ~ persistent://shop/orders/paid message-ttl - message-ttl is in force on shop-prod and not set on shop-dr. (shop-prod: 600, shop-dr: (not set)) ~ persistent://shop/orders/paid retention - retention is in force on shop-prod and not set on shop-dr. (shop-prod: timeInMinutes=60, sizeInMB=1024, shop-dr: (not set)) ~ persistent://shop/orders/paid schema-compatibility-strategy - schema-compatibility-strategy is in force on shop-prod and not set on shop-dr. (shop-prod: BACKWARD, shop-dr: (not set)) Subscriptions ! audit subscription - Subscription audit is on shop-prod and not on shop-dr. (shop-prod: audit) ! audit-log subscription - Subscription audit-log is on shop-prod and not on shop-dr. (shop-prod: audit-log) ! billing subscription - Subscription billing is on shop-prod and not on shop-dr. (shop-prod: billing) ! normalise subscription - Subscription normalise is on shop-prod and not on shop-dr. (shop-prod: normalise) Functions, sources and sinks ! function shop/orders/enrich function - The function shop/orders/enrich runs on shop-prod and not on shop-dr. (shop-prod: shop/orders/enrich) ! function shop/orders/normalise function - The function shop/orders/normalise runs on shop-prod and not on shop-dr. (shop-prod: shop/orders/normalise) ! source shop/orders/ticks source - The source shop/orders/ticks runs on shop-prod and not on shop-dr. (shop-prod: shop/orders/ticks) ! sink shop/orders/audit-log sink - The sink shop/orders/audit-log runs on shop-prod and not on shop-dr. (shop-prod: shop/orders/audit-log) ACLs ! audit - shop-prod grants audit consume on topic persistent://shop/orders/created; shop-dr does not. ! billing - shop-prod grants billing consume on namespace shop/orders; shop-dr does not. ! checkout - shop-prod grants checkout produce on namespace shop/orders; shop-dr does not. Notes - Broker settings that name a machine or a cluster were not compared: advertisedAddress, clusterName, metadataStoreUrl, statusFilePath. Drift: 11 changed · 1 unmanaged · 17 missing (drift) - 33 matched 

Step 4: plan, apply, check

kurkik pulsar sync shop-prod-pulsar.yaml shop-dr --all --overwrite --force \ --delete-topic persistent://shop/orders/legacy --dry-run 

Read the plan. Here it recreates paid (its messages are lost) and deletes legacy, because I asked with --force and --delete-topic. Without those flags it leaves them alone

Then run it without --dry-run:

Terminal recording: kurkik pulsar export, diff, sync and diff again between two Pulsar clusters

applied [+] done grant shop/orders billing (not set) -> consume [+] done grant shop/orders checkout (not set) -> produce [+] done set shop/orders backlog-quota destination_storage (not set) -> limit 536870912 bytes, producer_request_hold [+] done set shop/orders deduplication (not set) -> true [+] done set shop/orders message-ttl (not set) -> 600 [+] done set shop/orders schema-compatibility-strategy (not set) -> BACKWARD [+] done set shop/orders retention (not set) -> timeInMinutes=60, sizeInMB=1024 [+] done create persistent://shop/orders/created [+] done create persistent://shop/orders/enriched [+] done create persistent://shop/orders/normalised [+] done create persistent://shop/orders/raw [+] done create persistent://shop/orders/refunds [+] done create persistent://shop/orders/ticks [+] done recreate persistent://shop/orders/paid partitions 8 -> 6 [+] done delete persistent://shop/orders/legacy [+] done grant persistent://shop/orders/created audit (not set) -> consume [+] done register persistent://shop/orders/created schema (not set) -> AVRO [+] done register persistent://shop/orders/enriched schema (not set) -> STRING [+] done register persistent://shop/orders/ticks schema (not set) -> STRING [+] done deploy function shop/orders/enrich function (not set) -> shop/orders/enrich [+] done deploy function shop/orders/normalise function (not set) -> shop/orders/normalise [+] done deploy source shop/orders/ticks source (not set) -> shop/orders/ticks [+] done deploy sink shop/orders/audit-log sink (not set) -> shop/orders/audit-log Applied 23 of 23 changes 
kurkik pulsar diff shop-prod shop-dr --all shop-prod vs shop-dr Schemas + persistent://shop/orders/normalised schema - shop-dr has a schema for persistent://shop/orders/normalised (STRING); shop-prod has none. (shop-dr: STRING) + persistent://shop/orders/raw schema - shop-dr has a schema for persistent://shop/orders/raw (STRING); shop-prod has none. (shop-dr: STRING) Notes - Broker settings that name a machine or a cluster were not compared: advertisedAddress, clusterName, metadataStoreUrl, statusFilePath. Drift: 0 changed · 2 unmanaged · 0 missing (no drift) - 168 matched 

No drift. The two extra schemas on the new cluster are listed, so you know about them

Good to know:

  • Messages and subscription positions don't move
  • A function's user configuration and secrets are not in the document. Set them yourself
  • The demo cluster has authorization off, so it stores permissions without enforcing them
  • kurkik pulsar sync history shop-dr and sync revert undo a sync. Deleted messages stay deleted

Let your AI agent do the homework

kurkik mcp gives an AI agent Kurkik's tools over MCP. They read and compare. They can't apply anything

With Claude Code it is one line:

claude mcp add kurkik -- kurkik mcp 

I used Junie for this post. Put this in your project's .junie/mcp/mcp.json:

{ "mcpServers": { "kurkik": { "command": "kurkik", "args": ["mcp"] } } } 

Then give it the job. This is the exact task from the recording:

We are moving from the Pulsar connection "shop-prod" (old) to "shop-dr" (new). Use only the kurkik MCP tools: no terminal commands, no reading files. First list the connections. Compare shop-prod (expected) with shop-dr (actual), areas all. Export shop-prod to the workspace with these packages: function:shop/orders/enrich=function://shop/orders/enrich@1, function:shop/orders/normalise=function://shop/orders/normalise@1, source:shop/orders/ticks=source://shop/orders/ticks@1, sink:shop/orders/audit-log=sink://shop/orders/audit-log@1, with consumers read. Then ask for a sync plan of that document into shop-dr, areas all, overwrite on, force on. Do not apply anything. Finish with a short migration report in plain markdown, at most 35 lines: what differs, what to migrate, what sync will not do, what a person still has to check by hand, and the command to run. 

Terminal recording: an AI agent compares two Pulsar clusters through Kurkik MCP tools and writes a migration report

The recording is a real run, played back three times faster. Start-up errors from unrelated MCP servers on my machine are cut out

Here is the report it wrote:

Migration assessment complete; nothing was applied

Changes

  • DR lacks topics created, enriched, normalised, raw, refunds, ticks; subscriptions audit, audit-log, billing, normalise; and four processors
  • Namespace and inherited paid policies differ; paid has 8 partitions versus 6. DR-only legacy will remain
  • The plan sets policies, creates six topics, registers three schemas, and deploys enrich, normalise, ticks, and audit-log

Verification

  • Complete comparison: 11 changed, 14 missing, one DR-only. Export: asyncapi/shop-prod-pulsar.json; complete dry-run plan: 19 changes
  • Destructive: recreating paid loses messages and subscription positions; 600-second TTL can expire messages, including on other inheriting topics

Notes

  • The plan does not transfer message or cursor history, sync ACLs, or set processor configuration and secrets. Check these, package availability, broker settings, subscription positions, cutover, permissions and the function worker by hand
  • Person-run command, as reported by the tool; ensure the exported document resolves from the working directory: kurkik pulsar sync shop-prod-pulsar.json shop-dr --configs --consumers --schemas --functions --connectors --overwrite --force --expect-plan c1a6d7bec85a

The agent's export lands in the asyncapi/ folder, so run its command from there. --expect-plan makes sure you apply exactly the plan it looked at, and nothing newer

Remember that permissions never reach the agent. It can reason about topics, policies, schemas, functions and connectors. Check access yourself with diff --all or scan --acls

The whole document

The whole document: shop-prod-pulsar.yaml (691 lines)
asyncapi: 3.0.0 info: title: shop-prod Apache Pulsar API version: 1.0.0-SNAPSHOT description: Generated by reading Apache Pulsar of shop-prod (http://localhost:28080). servers: standalone: host: localhost:6650 protocol: pulsar protocolVersion: "5.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://localhost:28080 schemaRegistryVendor: pulsar namespacePolicies: public/default: schema-autoupdate: "on" shop/orders: backlog-quota destination_storage: "limit 536870912 bytes, producer_request_hold" deduplication: true message-ttl: 600 retention: timeInMinutes: 60 sizeInMB: 1024 schema-autoupdate: "on" schema-compatibility-strategy: BACKWARD tenants: - tenant: public adminRoles: [] allowedClusters: - standalone - tenant: shop adminRoles: [] allowedClusters: - standalone security: - security: NONE tls: false acl: - role: billing resourceType: namespace name: shop/orders actions: - consume - role: checkout resourceType: namespace name: shop/orders actions: - produce - role: audit resourceType: topic name: persistent://shop/orders/created actions: - consume consumers: - subscription: audit topics: - persistent://shop/orders/created consumers: [] - subscription: audit-log type: Shared topics: - persistent://shop/orders/enriched processor: sink shop/orders/audit-log - subscription: billing topics: - persistent://shop/orders/created consumers: [] - subscription: normalise type: Shared topics: - persistent://shop/orders/raw processor: function shop/orders/normalise producers: [] functions: - tenant: shop namespace: orders name: enrich runtime: JAVA className: com.github.pakisan.kurkik.pulsar.fixtures.Enrich archive: function://shop/orders/enrich@1 inputs: - persistent://shop/orders/created output: persistent://shop/orders/enriched subscriptionName: enrich parallelism: 2 processingGuarantees: ATLEAST_ONCE channels: - $ref: "#/channels/persistent-shop-orders-created" - $ref: "#/channels/persistent-shop-orders-enriched" roles: [] - tenant: shop namespace: orders name: normalise runtime: JAVA className: com.github.pakisan.kurkik.pulsar.fixtures.Normalise archive: function://shop/orders/normalise@1 inputs: - persistent://shop/orders/raw output: persistent://shop/orders/normalised subscriptionName: normalise parallelism: 1 processingGuarantees: ATLEAST_ONCE channels: - $ref: "#/channels/persistent-shop-orders-raw" - $ref: "#/channels/persistent-shop-orders-normalised" roles: [] sources: - tenant: shop namespace: orders name: ticks className: com.github.pakisan.kurkik.pulsar.fixtures.Ticks archive: source://shop/orders/ticks@1 output: persistent://shop/orders/ticks parallelism: 1 processingGuarantees: ATLEAST_ONCE channels: - $ref: "#/channels/persistent-shop-orders-ticks" roles: [] sinks: - tenant: shop namespace: orders name: audit-log className: com.github.pakisan.kurkik.pulsar.fixtures.AuditLog archive: sink://shop/orders/audit-log@1 inputs: - persistent://shop/orders/enriched subscriptionName: audit-log parallelism: 1 processingGuarantees: ATLEAST_ONCE channels: - $ref: "#/channels/persistent-shop-orders-enriched" roles: [] brokerConfiguration: advertisedAddress: localhost backlogQuotaDefaultLimitGB: "10.0" bookkeeperClientMinNumRacksPerWriteQuorum: "1" bookkeeperClientReorderReadSequenceEnabled: "false" bookkeeperNumberOfChannelsPerBookie: "1" brokerDeleteInactiveTopicsEnabled: "false" clusterName: standalone enablePackagesManagement: "true" functionsWorkerEnablePackageManagement: "true" isRunningStandalone: "true" loadBalancerEnabled: "false" loadManagerClassName: org.apache.pulsar.broker.loadbalance.NoopLoadManager managedLedgerCacheEvictionFrequency: "100.0" Source:https://dev.to/pakisan/moving-apache-pulsar-to-a-new-cluster-without-losing-functions-sources-and-sinks-48ni

Related posts