Shell commands

The following table shows actions you can take from the shell.

Action

Shell command

Comments

Take a snapshot of tableX called snapshotX

snapshot 'tableX', 'snapshotX'

Snapshots can be taken while a table is disabled, or while a table is online and serving traffic.

  • If a table is disabled (using disable <table>), an offline snapshot is taken. This snapshot is managed by the master and fully consistent with the state when the table was disabled. This is the simplest and safest method, but it involves a service interruption because the table must be disabled to take the snapshot.
  • In an online snapshot, the table remains available while the snapshot is taken, and incurs minimal performance degradation of normal read/write loads. This snapshot is managed by the master and run on the RegionServers. The current implementation—simple-flush snapshots—provides no causal consistency guarantees. Despite this shortcoming, it offers the same degree of consistency as CopyTable and is a significant improvement.

Restore snapshot snapshotX (replaces the source table content)

restore_snapshot ‘snapshotX’

Restoring a snapshot replaces the current version of a table with the data in that table when the snapshot was taken. To run this command, you must disable the target table. The restore_snapshot command takes the name of a snapshot e (appending a timestamp code), and then clones data into the original data and removes data not in the snapshot. If the operation succeeds, the target table is enabled.

List all available snapshots

list_snapshots

 

List all available snapshots starting with ‘mysnapshot_’ (regular expression)

list_snapshots ‘my_snapshot_.*’

 

Remove a snapshot called snapshotX

delete_snapshot ‘snapshotX’

Create a new table tableY from a snapshot snapshotX

clone_snapshot ‘snapshotX’, ‘tableY’

Cloning a snapshot creates a new table that serves the data kept at the time of the snapshot. The original table and the cloned table can be modified independently; new data written to one table does not show up on the other.