Database / Apache Cassandra Intermediate and Advanced interview questions
What is nodetool cleanup used for?
nodetool cleanup removes data that a node is no longer responsible for, reclaiming disk space after the cluster's token ownership has changed.
- When a new node joins (or an existing node's token ranges otherwise shift), other nodes may keep serving reads/writes correctly for a while, but they still physically hold on-disk data for ranges they've handed off, until cleanup removes it.
- Cleanup rewrites SSTables, discarding rows whose partition key hashes to a token range the node no longer owns.
- It is not run automatically — operators must trigger it manually on the affected nodes after a topology change like adding nodes.
- Cleanup can be I/O and CPU intensive, so it's typically throttled (
nodetool setcompactionthroughput-style controls apply similarly) and run during low-traffic windows, one node at a time.
nodetool cleanup my_keyspace
Skipping cleanup after scaling a cluster doesn't cause correctness problems by itself, but it does waste disk space indefinitely, since the orphaned data just sits there unused until cleanup (or a future compaction that happens to touch those SSTables) removes it.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
