Pacific-Design.com

    
Home Index

1. Cassandra

2. sstablekeys

Cassandra / sstablekeys /

Get all the keys from sstable


#!/bin/bash

#prend en parametre le nom de la table
if [ -z "$1" ]
  then echo "Table Name Required"
  exit 1
fi

nodetool flush
#recuperation de tout les fichiers data correspondant
for file in `ls /mnt/cassandra/data/keyspace1/standard1-3556766001eb11e69aa0f79b3f31e5b2/*-$1-*-Data.db`
do
  echo "sstablekeys $file"
  sstablekeys $file >> output.txt
done
nbLigne=$(sort output.txt | uniq | wc -l)
rm output.txt
echo "Number of records: $nbLigne"