Search code examples
apache-pulsar

how to shrink pulsar BookKeeper cluster


question

I add 2 bookie to pulsar a month ago, but I realized it was a waste of resources. how could i shrink the bookies from 7 to 3.

my effort

through bookkeeper's document, i find autorecover will bring all ledgers in BookKeeper cluster back to full replication while a bookie is crashed. but if i close four bookes in one time, i think some ledger may Lost forever.

bookkeeper-server/bin/bookkeeper shell recover \
zk1.example.com:2181 \ # IP and port for ZooKeeper
192.168.1.10:3181      # IP and port for the failed bookie

so i think i can close it one by one, but how could i know the recover is completed?


Solution

  • You can use the command

    bookkeeper shell decommissionbookie -bookieid $BOOKIE_ADDRESS
    

    This will wait until all ledgers for that bookie have been re-replicated in other bookies.