Tuesday, February 02, 2016

Cassandra - Downgrade from 2.2 to 2.1


OS: Amazon Linux AMI release 2015.03
Instance type: m3.2xlarge
vCPUs: 8
Memory: 30G
Data disks: 4x300GB EBS (io1, 1000 IOPS)


1. You haven't done SSTable upgrade yet.
2. You have the pre-upgrade system wide snapshot.
Note: If you already done SSTable upgrade, this guide does not suit you.


1. Shutdown Cassandra process
# nodetool status - make sure no down nodes
# service cassandra stop

2. Restore from snapshot
# Delete SSTable and associated files from your keyspace and reload from snapshot,
# for example, you have a keyspace named "keyspace1" and snapshot called "preupgradebkp"
# ll /var/lib/cassandra/data00/keyspace1/cf1/snapshots/preupgradebkp
# mv /var/lib/cassandra/data00/keyspace1 /var/lib/cassandra/data00/keyspace1-org
# rsync -av --link-dest=/var/lib/cassandra/data00/keyspace1-org/cf1/snapshots/preupgradebkp /var/lib/cassandra/data00/keyspace1-org/cf1/snapshots/preupgradebkp /var/lib/cassandra/data00/keyspace1/cf1

If you don't like rsync, you can simplely remove all fiels in /var/lib/cassandra/data00/keyspace1/cf1 except snapshots and copy all files back from /var/lib/cassandra/data00/keyspace1/cf1/snapshots/preupgradebkp to /var/lib/cassandra/data00/keyspace1/cf1. This will take longer time if you have large amount of data

3. Repeat step2 for system, system_auth and system_traces

4. Remove everything from commitlog directory

5. Remove Cassandra22 and install Cassandra21
# yum remove cassandra22
# yum install cassandra21

6. Double check cassandra.yaml file and all settings (such as rackdc.properties)

7. Start Cassandra process and monitor log file, exception, read/write rates.

How to upgrade Cassandra(http://tonylixu.blogspot.ca/2015/08/cassandra-upgrade-from-1x-to-20.html)

No comments: