Backup in Cassandra is done on either:
Cassandra also provides incremental backups, which will discuss later. Furthermore, restore depends if you are restoring the table to a single node or a cluster.
[root@lparacassandra newsnap]# nodetool snapshot Requested creating snapshot(s) for [all keyspaces] with snapshot name [1526571477560] and options {skipFlush=false} Snapshot directory: 1526571477560 [root@lparacassandra newsnap]#
[root@lparacassandra ~]# nodetool -h localhost -p 7199 snapshot testkeyspace Requested creating snapshot(s) for [testkeyspace] with snapshot name [1526547378058] and options {skipFlush=false} Snapshot directory: 1526547378058
[root@lparacassandra newsnap]# nodetool snapshot --table testtable testkeyspace Requested creating snapshot(s) for [testkeyspace] with snapshot name [1526571643515] and options {skipFlush=false} Snapshot directory: 1526571643515 [root@lparacassandra newsnap]#
Restore is done pretty simple in Cassandra, although it can be pain sometimes:
cqlsh:testkeyspace> select * from testTable; id | name ----+-------- 1 | Julien (1 rows) cqlsh:testkeyspace> truncate table testTable; cqlsh:testkeyspace> cqlsh:testkeyspace> [root@lparacassandra testtable-d1d2aa6059e411e8a087c7aceeb1b122]# cp snapshots/newsnap/* . [root@lparacassandra testtable-d1d2aa6059e411e8a087c7aceeb1b122]# ls -lart total 44 drwxr-xr-x 2 cassandra cassandra 6 May 17 11:13 backups drwxr-xr-x 4 cassandra cassandra 106 May 17 11:13 .. drwxr-xr-x 4 cassandra cassandra 62 May 17 11:15 snapshots -rw-r--r-- 1 root root 836 May 17 11:16 schema.cql -rw-r--r-- 1 root root 92 May 17 11:16 mc-1-big-TOC.txt -rw-r--r-- 1 root root 56 May 17 11:16 mc-1-big-Summary.db -rw-r--r-- 1 root root 4606 May 17 11:16 mc-1-big-Statistics.db -rw-r--r-- 1 root root 8 May 17 11:16 mc-1-big-Index.db -rw-r--r-- 1 root root 16 May 17 11:16 mc-1-big-Filter.db -rw-r--r-- 1 root root 10 May 17 11:16 mc-1-big-Digest.crc32 -rw-r--r-- 1 root root 37 May 17 11:16 mc-1-big-Data.db -rw-r--r-- 1 root root 43 May 17 11:16 mc-1-big-CompressionInfo.db -rw-r--r-- 1 root root 31 May 17 11:16 manifest.json drwxr-xr-x 4 cassandra cassandra 297 May 17 11:16 . [root@lparacassandra testtable-d1d2aa6059e411e8a087c7aceeb1b122]# chown -R cassandra:cassandra * [root@lparacassandra testtable-d1d2aa6059e411e8a087c7aceeb1b122]# ls -lart total 44 drwxr-xr-x 2 cassandra cassandra 6 May 17 11:13 backups drwxr-xr-x 4 cassandra cassandra 106 May 17 11:13 .. drwxr-xr-x 4 cassandra cassandra 62 May 17 11:15 snapshots -rw-r--r-- 1 cassandra cassandra 836 May 17 11:16 schema.cql -rw-r--r-- 1 cassandra cassandra 92 May 17 11:16 mc-1-big-TOC.txt -rw-r--r-- 1 cassandra cassandra 56 May 17 11:16 mc-1-big-Summary.db -rw-r--r-- 1 cassandra cassandra 4606 May 17 11:16 mc-1-big-Statistics.db -rw-r--r-- 1 cassandra cassandra 8 May 17 11:16 mc-1-big-Index.db -rw-r--r-- 1 cassandra cassandra 16 May 17 11:16 mc-1-big-Filter.db -rw-r--r-- 1 cassandra cassandra 10 May 17 11:16 mc-1-big-Digest.crc32 -rw-r--r-- 1 cassandra cassandra 37 May 17 11:16 mc-1-big-Data.db -rw-r--r-- 1 cassandra cassandra 43 May 17 11:16 mc-1-big-CompressionInfo.db -rw-r--r-- 1 cassandra cassandra 31 May 17 11:16 manifest.json [root@lparacassandra newsnap]# nodetool refresh testkeyspace testtable [root@lparacassandra newsnap]# cqlsh Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4] Use HELP for help. cqlsh> use testkeyspace ... ; cqlsh:testkeyspace> select * from testtable; id | name ----+-------- 1 | Julien