Database Reference
In-Depth Information
vivek@vivek-Vostro-3560:~/software/local-cluster/node4$
bin/nodetool rebuild_index
twitter_keyspace twitter
Running the preceding command does a full index rebuild on all indexes of the
twitter
table in keyspace
twitter_keyspace
. We can also rebuild specific in-
dexes as follows:
vivek@vivek-Vostro-3560:~/software/local-cluster/node4$
bin/nodetool rebuild_index
twitter_keyspace twitter screenname_idx
Here
screenname_idx
is the index on column
screen_name
.
Rebuilding indexes will not drop the index, but it will rebuild it with the available
data on that node. There are a lot of other command options with the nodetool utility.
Here I have covered the most important ones from a data administration backup per-
spective. In the following sections, we will discuss the
refresh
,
repair,
and
sstablescrub
commands, as well.
JSONifying Data
Since its inception, the Cassandra distribution has come with tools to import JSON-
format data into sstable and export sstable data in JSON files. These tools were primar-
ily built for debugging purposes, but they also are useful when we need to migrate data
from one node to another.
The two tools that come with the Cassandra distribution are
sstabl2json
and
json2sstable
. We can find them in the
$CASSANDRA_HOME/bin
folder. Let's
explore both!
Exporting Data to JSON Files with sstable2json
Using the
sstabl2json
command we can export on disk sstables data in JSON
files. Let's explore it with the following exercise:
1.
First let's create the schema and populate data using the cql shell. We
will create a keyspace
twitterkeyspace
and table
user
: