hi all,
I guess this is a good common function that will help a lot of engineers who will work on cassandra upgrade. Personally, I coded a sstableupgrade function which I think it is neat and stable. So, I would like to share it to all. I have used it for my cassandra upgrade from version 1.2.8 to 2.0.14.
function sstable_upgrade()
{
echo_header "SSTABLE UPGRADE"
MYSNAPSHOT_NAME=""
if [ ! -z "$1" ]
then
MYSNAPSHOT_NAME="$1"
fi
SSTABLEUPGRADE_BIN="/opt/cassandra-2.0.14/bin/sstableupgrade"
sudo sed -i 's|256M|2G|g' $SSTABLEUPGRADE_BIN
echo_info "Harvesting keyspaces and column family to $CASSANDRA_BACKUP/backup_keyspace.out"
if sudo find /data/ -name "*-ic*Data.db" | grep -v snapshot* | awk -F"/" '{print $4" "$5}' | sort -u > $CASSANDRA_BACKUP/backup_keyspace.out
then
while read line
do
echo_info "SSTABLE upgrade: $SSTABLEUPGRADE_BIN $line $SNAPSHOT_NAME"
sudo -tt -u $CASS_USER /bin/bash -c "$SSTABLEUPGRADE_BIN $line $MYSNAPSHOT_NAME"
sleep 5
done < $CASSANDRA_BACKUP/backup_keyspace.out
else
echo_warn "Fail harvesting keyspaces and column families"
exit 1
fi
}
Here will be output
> INFO: SSTABLE upgrade: /opt/cassandra-2.0.14/bin/sstableupgrade system schema_keyspaces
Found 2 sstables that need upgrading.
Upgrading SSTableReader(path='/data/data02/system/schema_keyspaces/system-schema_keyspaces-ic-214-Data.db')
Upgrade of SSTableReader(path='/data/data02/system/schema_keyspaces/system-schema_keyspaces-ic-214-Data.db') complete.
Upgrading SSTableReader(path='/data/data02/system/schema_keyspaces/system-schema_keyspaces-ic-213-Data.db')
Upgrade of SSTableReader(path='/data/data02/system/schema_keyspaces/system-schema_keyspaces-ic-213-Data.db') complete.
> INFO: SSTABLE upgrade: /opt/cassandra-2.0.14/bin/sstableupgrade system_traces events
Found 2 sstables that need upgrading.
Upgrading SSTableReader(path='/data/data03/system_traces/events/system_traces-events-ic-1-Data.db')
Upgrade of SSTableReader(path='/data/data03/system_traces/events/system_traces-events-ic-1-Data.db') complete.
Upgrading SSTableReader(path='/data/data02/system_traces/events/system_traces-events-ic-2-Data.db')
Upgrade of SSTableReader(path='/data/data02/system_traces/events/system_traces-events-ic-2-Data.db') complete.
> INFO: SSTABLE upgrade: /opt/cassandra-2.0.14/bin/sstableupgrade system_traces sessions
Found 2 sstables that need upgrading.
Upgrading SSTableReader(path='/data/data03/system_traces/sessions/system_traces-sessions-ic-1-Data.db')
Upgrade of SSTableReader(path='/data/data03/system_traces/sessions/system_traces-sessions-ic-1-Data.db') complete.
Upgrading SSTableReader(path='/data/data03/system_traces/sessions/system_traces-sessions-ic-2-Data.db')
Upgrade of SSTableReader(path='/data/data03/system_traces/sessions/system_traces-sessions-ic-2-Data.db') complete.
> INFO: Done
No comments:
Post a Comment