Currently commitlog directory is pointing to Directory1. I want to change it different directory D2. How should the migration be ?
2 Answers
This is how we did it. We have a load-balanced client that talks to Cassandra 1.1.2, and each client lives on each Cassandra node.
- Drain your service.
- Wait for the load balancer to remove the node.
- Stop your service on the local node to halt direct Client-Cassandra writes:
systemctl stop <your service name>
- At this point there should be no more writes and greatly reduced disk activity:
iostat 2
- Disk activity should be near zeronodetool gossipinfo
- Disable Cassandra gossip protocol to mark the node dead and halt Cassandra-Cassandra writes:
nodetool disablegossip
- Flush all contents of the commit log into SSTables:
nodetool flush
- Drain the node – this command is more important than nodetool flush, (and might include all the behaviour of nodetool flush):
nodetool drain
- Stop the cassandra process:
systemctl stop cassandra
- Modify Cassandra config file(s), e.g.
vi /etc/cassandra/default.conf/cassandra.yaml
- Start Cassandra:
systemctl start cassandra
- Wait 10-20 minutes. Tail Cassandra logs to follow along, e.g.
tail -F /var/log/cassandra/system.log
- Confirm ring is healthy before moving on to next node:
nodetool ring
- Re-start client service:
systemctl start <your service here>
Note that there was no need for us to do manual copying of the commitlog files themselves. Flushing and draining took care of that. The files then slowly reappeared in the new commitlog_dir
location.

- 2,062
- 4
- 22
- 28
You can change the commit log directory in cassandra.yaml
(key: "commitlog_directory") and copy all logs to the new destination (see docs) :
commitlog_directory
commitlog_directory
The directory where the commit log is stored. Default locations:Package installations: /var/lib/cassandra/commitlog Tarball installations: install_location/data/commitlog For optimal write performance, place the commit log be on a separate disk partition, or (ideally) a separate physical device from
the data file directories. Because the commit log is append only, an HDD is acceptable for this purpose.
If you are using bitnami/cassandra
containers, this should be done using this env var (see docs):
CASSANDRA_COMMITLOG_DIR
: Directory where the commit logs will be stored. Default: /bitnami/cassandra/data/commitlog
-
Let me try this .. The problem was that I have had both commit-logs and data directories in the same disk .. Now I want to separate this. Thanks itstata – phaigeim Feb 08 '17 at 18:08