Batch processing in Cassandra to copy tables; -
i have 2 tables.customer_materializedview , customer_backup. want function such after every 30 min batch runs table customer_materializedview gets copied customer_backup. please notice have copy whole table , not single rows.
begin batch copy events.customer_materializedview (colm_def,...) 'temp.csv'; truncate customer_materializedview; copy event.customer_backup (colm_def) 'temp.csv'; apply batch;
this backup strategy not safe nor practical. suggest reading document first: https://docs.datastax.com/en/cassandra/2.0/cassandra/operations/ops_backup_restore_c.html
but try answer question regardless. create scheduled job using tools based on os using. example can schedule cron job on linux.
you need 2 files. 1 cql commands want execute on db , executing commands.
first file named "cql" this:
begin batch copy events.customer_materializedview (colm_def,...) 'temp.csv'; truncate customer_materializedview; copy event.customer_backup (colm_def) 'temp.csv'; apply batch;
other file named "copy_job.sh":
cqlsh <host> --username=<username> --password=<password> --cqlversion=<cqlversion> -f cql
now, if execute copy_job.sh copy data backup table.
Comments
Post a Comment