Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

nodetool import

Imports SSTables from an external directory into a table.


Terminal window
nodetool [connection_options] import [options] <keyspace> <table> <directory>...

See connection options for connection options.

nodetool import loads SSTables from an external directory into a Cassandra table. Unlike refresh, which requires files to be in the data directory, import can load from any location and optionally moves or copies files.

Available in Cassandra 4.0+.


ArgumentDescription
keyspaceTarget keyspace
tableTarget table
directoryOne or more directories containing SSTables to import

OptionDescription
-c, --no-invalidate-cachesSkip row cache invalidation
-cd, --copy-dataCopy files instead of moving
-e, --extended-verifyExtended verification of SSTables
-k, --keep-levelKeep original SSTable level (for LCS)
-l, --keep-repairedKeep repaired status
-niv, --no-index-validationSkip index component validation
-q, --quickQuick import (less verification)
-ri, --require-index-componentsRequire index components to be present
-t, --no-tokensSkip token verification
-v, --no-verifySkip SSTable verification

Terminal window
nodetool import my_keyspace my_table /path/to/sstables/
Terminal window
nodetool import -cd my_keyspace my_table /backup/sstables/
Terminal window
nodetool import -q my_keyspace my_table /path/to/sstables/
Terminal window
nodetool import -k my_keyspace my_table /path/to/sstables/
Terminal window
nodetool import -e my_keyspace my_table /path/to/sstables/

Featureimportrefreshsstableloader
External directoryYesNoYes
Move/copy filesYesNoStreams
Token verificationOptionalNoYes
Different topologyNoNoYes
SpeedFastFastSlower

Terminal window
# 1. Extract backup to a directory
tar -xzf backup.tar.gz -C /tmp/restore/
# 2. Import SSTables
nodetool import my_keyspace my_table /tmp/restore/my_keyspace/my_table/
# 3. Verify
nodetool tablestats my_keyspace.my_table

Terminal window
# 1. Generate SSTables externally (e.g., from Spark)
# Files are in /data/generated/my_keyspace/my_table/
# 2. Import to each node
nodetool import my_keyspace my_table /data/generated/my_keyspace/my_table/
# 3. Repair for consistency
nodetool repair my_keyspace my_table

The source directory should contain SSTable files:

/path/to/sstables/
├── nb-1-big-Data.db
├── nb-1-big-Index.db
├── nb-1-big-Filter.db
├── nb-1-big-Statistics.db
├── nb-1-big-Summary.db
├── nb-1-big-TOC.txt
└── nb-1-big-CompressionInfo.db

By default, import verifies tokens belong to this node:

Terminal window
# Normal import (verifies tokens)
nodetool import my_keyspace my_table /path/
# Skip token verification (use carefully)
nodetool import -t my_keyspace my_table /path/

Token Verification

Skipping token verification (-t) may import data that doesn't belong to this node. Only use when certain about data placement.


By default, files are moved from source to data directory:

Terminal window
nodetool import my_keyspace my_table /tmp/sstables/
# Files moved from /tmp/sstables/ to data directory
# Source directory will be empty after import

Use -cd to copy instead of move:

Terminal window
nodetool import -cd my_keyspace my_table /backup/sstables/
# Files copied, originals remain in /backup/sstables/

Terminal window
# Ensure Cassandra can read source directory
chmod -R 755 /path/to/sstables/
chown -R cassandra:cassandra /path/to/sstables/
ERROR: SSTable is not valid

Try with verification options:

Terminal window
# Extended verification to see details
nodetool import -e my_keyspace my_table /path/
# Or skip verification (risky)
nodetool import -c my_keyspace my_table /path/
ERROR: Token ... is not owned by this node

Either:

  • Import to the correct node
  • Use -v to skip verification (if certain data is correct)
  • Use sstableloader for different topologies

Terminal window
# 1. Verify import
nodetool tablestats my_keyspace.my_table
# 2. Check data is queryable
cqlsh -e "SELECT COUNT(*) FROM my_keyspace.my_table;"
# 3. Run repair for consistency (recommended for bulk loads)
nodetool repair -pr my_keyspace my_table

Import Guidelines

  1. Use copy mode for backups - Keep original files with -cd
  2. Verify first - Use extended verification for critical data
  3. Check token ownership - Ensure SSTables belong to this node
  4. Run repair after - Ensure consistency across replicas
  5. Monitor space - Ensure sufficient disk for imported data

CommandRelationship
refreshLoad SSTables from data directory
snapshotCreate backups
tablestatsVerify after import
repairRun after bulk imports