DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

fewpounds avatar image
fewpounds asked ·

What is the difference between "nodetool decommission" and "nodetool drain"?

I am looking into changing the num_tokens (vnodes) for a cluster from 16 to 4. The procedure I have been given says to decommission a node before making the num_tokens change. Drain seems to do the same thing. What are the pros and cons of using decommission versus drain? Thanks.

decommission
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

The nodetool decommission command removes a node from the cluster. As the name suggests, it decommissions the node so that it will no longer be part of the Cassandra ring of nodes.

The nodetool drain command does 2 things:

  • it triggers a flush of memtables to disk (writes the data in memory to SSTable files)
  • it shuts down the native transport server meaning the node will no longer accept client requests on the CQL client port 9042

You would typically drain a node before shutting down Cassandra to carry out maintenance work. When all the memtables are flushed to disk, the commitlogs are also cleared so there are none to replay on startup. This makes restarting Cassandra a lot faster.

By now you should work out that these two commands do not do the same thing. They provide two completely unrelated functions.

For more information on decommissioning nodes, see Removing a Cassandra node. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.