Hi @ddorian43,
Thanks for asking, haven’t added the docs yet, but started working on it now. For the CE version, you are correct in that it will be sequential (like a DB data dump tool). Have added an example below, will add something very similar into the docs.
Example
Let’s say you have a myapp.stock_market
table, along with some sample data inserted into it as shown in this example.
cqlsh> SELECT * FROM myapp.stock_market;
stock_symbol | ts | current_price
--------------+---------------------+---------------
GOOG | 2017-10-26 09:00:00 | 972.56
GOOG | 2017-10-26 10:00:00 | 971.90997
AAPL | 2017-10-26 09:00:00 | 157.41
AAPL | 2017-10-26 10:00:00 | 157
FB | 2017-10-26 09:00:00 | 170.63
FB | 2017-10-26 10:00:00 | 170.10001
(6 rows)
Create Backup
Export the schema for the myapp
keyspace by running the following command (in your bash prompt):
$ cqlsh -e "DESC KEYSPACE myapp" > myapp_schema.cql
Export the data using the following command run from inside cqlsh
:
cqlsh> COPY myapp.stock_market TO 'myapp_data.csv' WITH HEADER = TRUE ;
...
6 rows exported to 1 files in 0.110 seconds.
We can check the backups using the following:
$ ls -lh myapp_*
228B May 29 17:36 myapp_data.csv
327B May 29 17:37 myapp_schema.cql
Restore Backup
To create the keyspace and tables:
cqlsh> source 'myapp_schema.cql'
You should see the following table:
cqlsh> DESCRIBE TABLE myapp.stock_market;
CREATE TABLE myapp.stock_market (
stock_symbol text,
ts text,
current_price float,
PRIMARY KEY (stock_symbol, ts)
) WITH CLUSTERING ORDER BY (ts ASC)
AND default_time_to_live = 0;
To restore the data, do the following:
cqlsh> COPY myapp.stock_market FROM 'myapp_data.csv' WITH HEADER = TRUE ;
...
6 rows imported from 1 files in 0.414 seconds (0 skipped).
To verify the data:
cqlsh> SELECT * FROM myapp.stock_market;
stock_symbol | ts | current_price
--------------+---------------------+---------------
GOOG | 2017-10-26 09:00:00 | 972.56
GOOG | 2017-10-26 10:00:00 | 971.90997
AAPL | 2017-10-26 09:00:00 | 157.41
AAPL | 2017-10-26 10:00:00 | 157
FB | 2017-10-26 09:00:00 | 170.63
FB | 2017-10-26 10:00:00 | 170.10001
(6 rows)