nodetool rebuild

Rebuilds data by streaming from other nodes.

Rebuilds data by streaming from other nodes.

Synopsis

nodetool options rebuild 
[-dc | --dcs src_dc_names
[-mode | --mode rebuild_mode]
[ -ks | --keyspace keyspace_name [ , keyspace_name ] . . . ] 
[ -ts | --tokens token_spec ]
[ -- source-dc-name ]
Cassandra tarball installations:
installation_location/cassandra/bin
Table 1. Options
Short Long Description
-dc --dcs The name of the datacenter that Cassandra uses as the source for streaming. Cassandra rebuilds from any datacenter. If a datacenter is not specified, Cassandra chooses at random.
-h --host Hostname or IP address.
-ks specific_keyspace --keyspace specific_keyspace Rebuild specific keyspace.
-m --mode Rebuild mode.
-p --port Port number.
-pwf --password-file Password file path.
-pw --password Password.
source-dc-name Name of datacenter from which to select sources for streaming. By default, choose any datacenter.
-- Separates an option from an argument that could be mistaken for a option.

Parameters

-ks, --keyspace keyspace_name, ...
(Cassandra 3.6 and later only) Comma-separated list of one or more keyspaces. List only the keyspaces to include in the rebuild.
Tip: Do not include keyspaces that are not replicated across datacenters (for example, dsefs keyspaces, and keyspaces with local strategy).
rebuild_mode
  • normal - conventional behavior. Streams only ranges that are not locally available. Default.
  • refetch - resets locally available ranges. Streams all ranges but leaves current data untouched.
  • reset - resets locally available ranges. Removes all locally present data (like a TRUNCATE). Streams all ranges.
  • reset-no-snapshot - resets locally available ranges. Removes all locally present data (like a TRUNCATE). Streams all ranges. Prevents a snapshot if auto_snapshot is enabled in cassandra.yaml.
token_spec (Cassandra 3.6 and later)
One or more tokens, and/or one or more ranges of tokens. The token_spec can be:
  • One specific token.
  • A comma-delimited list of single tokens.
  • A range of tokens, specified as ( start_token, end_token).
  • A comma-delimited list of token ranges — for example, ( start_token1, end_token1) , ( start_token2, end_token2, . . .
  • A comma-delimited list of mixed single tokens and token ranges — for example, token1, ( start_token2, end_token2) , ( start_token3, end_token3) , token4, . . .
--
Separates an option and argument that could be mistaken for a option.
source-dc-name

The name of the datacenter Cassandra uses as the source for streaming. Cassandra rebuilds from any datacenter. If the statement does not specify one, Cassandra chooses at random.

Description

This command operates on multiple nodes in a cluster. Like nodetool bootstrap, rebuild only streams data from a single source replica when rebuilding a token range. Use this command to add a new datacenter to an existing cluster.

If rebuild fails because some token ranges cannot be retrieved, you can rebuild selectively by using the -ts or --token option to specify a list of tokens, or one or more token ranges.

Note: If rebuild is interrupted before completion, you can restart it by re-entering the command. The process resumes from the point at which it was interrupted.