Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

Helping platform leaders, architects, engineers, and operators build scalable real time data platforms.

12/2/2019

Reading time:9 min

Spark, File Transfer, and More: Strategies for Migrating Data to and …

by ScyllaDB

Spark, File Transfer, and More: Strategies for Migrating Data to and … SlideShare Explore You Successfully reported this slideshow.Spark, File Transfer, and More: Strategies for Migrating Data to and from a Cassandra or Scylla ClusterUpcoming SlideShareLoading in …5× 0 Comments 1 Like Statistics Notes KENNETH OWINO , Senior Manager Business Systems Planning at Safaricom Limited at Safaricom Limited No DownloadsNo notes for slide 1. Spark, File Transfer,and MoreStrategies for Migrating Data to and froma Cassandra or Scylla ClusterWEBINAR 2. Presenter2Dan YasnyBefore ScyllaDB, Dan worked in various roles such assysadmin, quality engineering, product management,tech support, integration and DevOps around mainlyopen source technology, at companies such as Red Hat andDell. 3. 3+ The Real-Time Big Data Database+ Drop-in replacement for Cassandra+ 10X the performance & low tail latency+ New: Scylla Cloud, DBaaS+ Open source and enterprise editions+ Founded by the creators of KVM hypervisor+ HQs: Palo Alto, CA; Herzelia, IsraelAbout ScyllaDB 4. Migration overview+ Online and Offline migrations+ Common steps: Schema, Existing dataOnline migrations+ Dual Writes+ Kafka+ Custom application changesExisting data migration+ Highly volatile/TTL’d data+ CQL COPY+ SSTableloader+ Mirror loader (Danloader)+ Spark MigratorAgenda 5. Migration Overview+ Online migration+ Added complexity+ Added load+ Offline migration+ Downtime+ Common steps+ Schema migration and adjustments+ Existing data migration+ Data validationSSTableLoaderSSTables CQLCQL CQLClientCQLCQLClient 6. Migrate Schema+ Use DESCRIBE to export each Cassandra Keyspace, Table, UDT+ cqlsh [IP] "-e DESC SCHEMA" > orig_schema.cql+ cqlsh [IP] --file 'adjusted_schema.cql'+ Schema updates when migrating from Cassandra 3.x+ Different syntax for some schema properties might be neededhttps://docs.scylladb.com/operating-scylla/procedures/cassandra_to_scylla_migration_process/#notes-limitations-and-known-issues 7. Online Migration 8. Write to DB-OLDCold Migration - No Dual WritesTimeRead from DB-OLD 9. Write to DB-OLDMigrate SchemaCold Migration - No Dual WritesTimeRead from DB-OLD 10. Write to DB-OLDForklifting Existing DataMigrate SchemaDBs in SyncCold Migration - No Dual WritesTimeRead from DB-OLD 11. Write to DB-OLDForklifting Existing DataValidation*Migrate SchemaDBs in SyncCold Migration - No Dual WritesTimeFade off DB-OLDRead from DB-OLD 12. Write to DB-OLDForklifting Existing DataValidation*Migrate SchemaDBs in SyncCold Migration - No Dual WritesTimeRead from DB-NEWFade off DB-OLDRead from DB-OLDWrite to DB-NEW 13. Write to DB-OLDDual WritesTimeRead from DB-OLD 14. Write to DB-OLDMigrateSchemaDual WritesTimeRead from DB-OLD 15. Write to DB-OLDDual WritesMigrateSchemaDual WritesTimeRead from DB-OLD 16. Write to DB-OLDDual WritesMigrateSchemaDual WritesTimeRead from DB-OLDWrite to DB-NEW 17. Write to DB-OLDDual WritesForklifting Existing DataMigrateSchemaDual WritesTimeRead from DB-OLDWrite to DB-NEW 18. Write to DB-OLDDual WritesForklifting Existing DataMigrateSchemaDBs in SyncDual WritesTimeRead from DB-OLDWrite to DB-NEW 19. Dual ReadsWrite to DB-OLDDual WritesForklifting Existing DataValidationMigrateSchemaDBs in SyncDual WritesTimeRead from DB-OLDWrite to DB-NEW 20. Dual ReadsWrite to DB-OLDDual WritesForklifting Existing DataValidationMigrateSchemaDBs in SyncDual WritesTimeRead from DB-NEWRead from DB-OLDWrite to DB-NEW 21. Dual ReadsWrite to DB-OLDDual WritesForklifting Existing DataValidationMigrateSchemaDBs in SyncDual WritesTimeRead from DB-NEWFade off DB-OLDRead from DB-OLDWrite to DB-NEW 22. Apache Kafka based dual writesAlready using Kafka+ Start buffering the writes to new cluster+ Increase the TTL and add buffer time while migration is in progress/about to start+ Keep sending writes to old cluster+ Once existing data migration is complete, stream the data to new cluster+ Use the Kafka-connect framework with the Cassandra connector+ Use KSQL if you want to run a couple of transformations on the data (EXPERIMENTAL) 23. Dual Writes: App changes code samplewrites = []writes.append(db1.execute_async(insert_statement_prepared[0], values))writes.append(db2.execute_async(insert_statement_prepared[1], values))results = []for i in range(0,len(writes)):try:row = writes[i].result()results.append(1)except Exception:results.append(0)# Handle itif (results[0]==0):log('Write to cluster 1 failed')if (results[1]==0):log('Write to cluster 2 failed') 24. Existing Data Migration 25. Existing data migration strategies+ CQL COPY+ SSTableloader+ Mirror loader+ Spark MigratorWhen performing an online migration, always use a strategythat preserves timestamps, unless all keys are unique 26. Databases: Under the hood+ Native CQL to native CQL+ Scylla Spark Migrator+ SSTable files to CQL+ SSTableloader+ SSTable files to SStable files+ Mirror loader+ Arbitrary data files to CQL+ COPY 27. Highly volatile data with low TTL+ Establish dual writes+ Keep running until last record in the old DB is expired+ Turn off dual writes+ Phase out old DBSQLNoSQL 28. CQL COPY 29. CQL COPY: Database Compatibility+ Scylla and Cassandra: Common file format+ Schema Migration vs Schema RedesignSQLNoSQL 30. COPY continuedSome knobs:+ HEADER+ CHUNKSIZE+ DATETIMEFORMAT+ DELIMITER+ INGESTRATE+ MAXBATCHSIZE+ MAXROWS+ NULL+ PREPAREDSTATEMENTS+ TTL+ File size matters+ Skipping unwanted columns+ Formatting+ NULL+ DATETIME+ Quotes+ Escapes+ Delimiters+ Best practices+ Small files+ Separate host 31. COPY and CSV filesPros+ Simplicity+ CSV transparency+ Easy to validate+ Destination schema can have lesscolumns than the original+ Can be tweaked, plenty of languagesupport+ Can be used for any data ingestion, notnecessarily from Scylla/Cassandra(incompatible DBs)+ Compatible with Cassandra, Scylla andScylla CloudCons+ Not for large data sizes+ Timestamps not preserved - becareful with online migrations 32. SSTableloader 33. + Create snapshot of each Cassandra node+ Run sstableloader from each Cassandra node, or from intermediate servers+ Use throttling -t to limit the leader throughput if needed+ Run several sstableloaders in parallelBoth Cassandra and Scylla ship with an sstableloader utility.While they are similar, there are differences between the two:+ Use Scylla’s sstableloader to migrate to ScyllaSSTableloaderScylla’sSSTableLoaderSSTables CQLSQLNoSQL 34. SStableloader continued+ No Schema update during forklifting+ Scylla’s sstableloader has support for simple column renames+ Assuming RF=3, you end up with 9 copies of the data until compaction happensFailure handling:+ What should I do if sstableloader fails?+ What should I do if a source node fails?+ What should I do if a destination node fails?+ How to rollback and start from scratch?https://docs.scylladb.com/operating-scylla/procedures/cassandra_to_scylla_migration_process 35. Mirror Loader 36. Mirror LoaderPreparation:+ Temporarily mirror the original DB+ Establish node pairs+ Clone the token sets between nodepairs+ nodetool ring+ Every node has token assignment, whichhas to match the data on disk+ We want to bring up a similar Scyllasetup, using the same token ranges+ Then let Scylla’s internals do the workSource DB Temp DBFile copySQLNoSQL 37. Mirror Loader+ Start the mirrored Scylla cluster+ Bring up destination Scylla nodes in anew DC in the same cluster, using thetemp cluster as seed+ Start synchronization (repair or rebuild)+ Wait for synchronization to complete+ Phase out the Old and TemporaryclustersNative syncSourceclusterDestinationClustertemporary DC1Destination clusterDC2 38. Mirror LoaderPros+ Very simple approach+ Direct file copy, no data digesting+ Very low effect on source DB load+ Native sync to destination DB+ Very fast - files are copied and thetemporary DB is ready to be usedimmediately.Cons+ Supported file formats+ ka, la, mc+ Temporary machines required+ Not usable with Scylla cloud+ Schema adjustments might be needed 39. Scylla Spark Migrator 40. Scylla Spark migrator+ Highly resilient to failures, and will retry reads andwrites throughout the job+ Continuously writes savepoint files which can be usedto resume the transfer from the point at which it stopped+ Access compatible Databases using a native connector+ High performance parallelized reads and writes+ Unlimited streaming power+ Reduce data transfer costs+ Can be configured to preserve the WRITETIME and TTL attributes of the fieldsthat are copied+ Can handle column renames as part of the transferSQLNoSQL 41. Scylla Spark MigratorA very simple and easy to use tool+ Install the standard Spark stack (Java JRE and JDK, SBT)+ Edit configuration file+ RunLinks:+ https://www.scylladb.com/2019/02/07/moving-from-cassandra-to-scylla-via-apache-spark-scylla-migrator/+ https://github.com/scylladb/scylla-migrator/ 42. Scylla Spark Migrator - configurationsource:host: 10.0.0.110port: 9042credentials:username: <user>password: <pass>keyspace: keyspace1table: standard1splitCount: 256connections: 4fetchSize: 1000target:...preserveTimestamps: truesavepoints:path: /tmp/savepointsintervalSeconds: 60renames: []skipTokenRanges: [] 43. STDOUT:2019-03-25 20:30:04 INFO migrator:405 -Created a savepoint config at/tmp/savepoints/savepoint_1553545804.yamldue to schedule. Ranges added:Set((49660176753484882,50517483720003777),(1176795029308651734,1264410883115973030),(-246387809075769230,-238284145977950153),(-735372055852897323,-726956712682417148),(6875465462741850487,6973045836764204908),(-467003452415310709,-4589291437737669003)...Scylla Sparkmigrator 44. Takeaways: Online MigrationThis webinar covered ways to do online migration (no downtime) to and fromApache Cassandra, Scylla, and Scylla Cloud. This requires the writes to be sent toboth clusters+ Have an existing Kafka infrastructure: replay kafka streams+ For all other scenarios: small changes to the application to do dual writes 45. Takeaways: Existing Data Migration+ If Source database is SQL, MongoDB, etc:+ Use COPY command+ If you have control of the topology and can afford temporary extra nodes:+ Use Mirror Loader+ If you have access to the original SSTable files:+ Use SSTableloader+ Want a fully flexible streaming solution and can afford the extra load in thesource:+ Use the Scylla Spark Loader 46. United States1900 Embarcadero RoadPalo Alto, CA 94303Israel11 Galgalei HapladaHerzelia, Israelwww.scylladb.com@scylladbThank you 47. Q&AStay in touchdyasny@scylladb.com@dyasny Recommended Teaching Techniques: Creating Effective Learning AssessmentsOnline Course - LinkedIn Learning Learning Management Systems (LMS) Quick StartOnline Course - LinkedIn Learning Test Prep: PSATOnline Course - LinkedIn Learning Zenly Shares Best Practices for Running ScyllaDB on GCPScyllaDB MongoDB vs Scylla: Production Experience from Both Dev & Ops Standpoint at Nu...ScyllaDB Scaling Up Machine Learning Experimentation at Tubi 5x and BeyondScyllaDB Lookout on Scaling Security to 100 Million DevicesScyllaDB Writing Applications for ScyllaScyllaDB How Scylla Make Adding and Removing Nodes Faster and SaferScyllaDB Project Gemini - a fuzzing tool used by Scylla to guarantee that data, once w...ScyllaDB About Blog Terms Privacy Copyright LinkedIn Corporation © 2019 × Public clipboards featuring this slideNo public clipboards found for this slideSelect another clipboard ×Looks like you’ve clipped this slide to already.Create a clipboardYou just clipped your first slide! Clipping is a handy way to collect important slides you want to go back to later. Now customize the name of a clipboard to store your clips. Description Visibility Others can see my Clipboard

Illustration Image
Spark, File Transfer, and More: Strategies for Migrating Data to and …

Successfully reported this slideshow.

Spark, File Transfer, and More: Strategies for Migrating Data to and from a Cassandra or Scylla Cluster
Spark, File Transfer,
and More
Strategies for Migrating Data to and from
a Cassandra or Scylla Cluster
WEBINAR
Presenter
2
Dan Yasny
Before ScyllaDB, Dan worked in various roles such as
sysadmin, quality engineering, product manageme...
3
+ The Real-Time Big Data Database
+ Drop-in replacement for Cassandra
+ 10X the performance & low tail latency
+ New: Sc...
Migration overview
+ Online and Offline migrations
+ Common steps: Schema, Existing data
Online migrations
+ Dual Writes
+ K...
Migration Overview
+ Online migration
+ Added complexity
+ Added load
+ Offline migration
+ Downtime
+ Common steps
+ Schema...
Migrate Schema
+ Use DESCRIBE to export each Cassandra Keyspace, Table, UDT
+ cqlsh [IP] "-e DESC SCHEMA" > orig_schema.cq...
Online Migration
Write to DB-OLD
Cold Migration - No Dual Writes
Time
Read from DB-OLD
Write to DB-OLD
Migrate Schema
Cold Migration - No Dual Writes
Time
Read from DB-OLD
Write to DB-OLD
Forklifting Existing Data
Migrate Schema
DBs in Sync
Cold Migration - No Dual Writes
Time
Read from DB-OLD
Write to DB-OLD
Forklifting Existing Data
Validation*
Migrate Schema
DBs in Sync
Cold Migration - No Dual Writes
Time
Fade...
Write to DB-OLD
Forklifting Existing Data
Validation*
Migrate Schema
DBs in Sync
Cold Migration - No Dual Writes
Time
Read...
Write to DB-OLD
Dual Writes
Time
Read from DB-OLD
Write to DB-OLD
Migrate
Schema
Dual Writes
Time
Read from DB-OLD
Write to DB-OLD
Dual Writes
Migrate
Schema
Dual Writes
Time
Read from DB-OLD
Write to DB-OLD
Dual Writes
Migrate
Schema
Dual Writes
Time
Read from DB-OLD
Write to DB-NEW
Write to DB-OLD
Dual Writes
Forklifting Existing Data
Migrate
Schema
Dual Writes
Time
Read from DB-OLD
Write to DB-NEW
Write to DB-OLD
Dual Writes
Forklifting Existing Data
Migrate
Schema
DBs in Sync
Dual Writes
Time
Read from DB-OLD
Write t...
Dual Reads
Write to DB-OLD
Dual Writes
Forklifting Existing Data
Validation
Migrate
Schema
DBs in Sync
Dual Writes
Time
Re...
Dual Reads
Write to DB-OLD
Dual Writes
Forklifting Existing Data
Validation
Migrate
Schema
DBs in Sync
Dual Writes
Time
Re...
Dual Reads
Write to DB-OLD
Dual Writes
Forklifting Existing Data
Validation
Migrate
Schema
DBs in Sync
Dual Writes
Time
Re...
Apache Kafka based dual writes
Already using Kafka
+ Start buffering the writes to new cluster
+ Increase the TTL and add ...
Dual Writes: App changes code sample
writes = []
writes.append(db1.execute_async(insert_statement_prepared[0], values))
wr...
Existing Data Migration
Existing data migration strategies
+ CQL COPY
+ SSTableloader
+ Mirror loader
+ Spark Migrator
When performing an online m...
Databases: Under the hood
+ Native CQL to native CQL
+ Scylla Spark Migrator
+ SSTable files to CQL
+ SSTableloader
+ SSTab...
Highly volatile data with low TTL
+ Establish dual writes
+ Keep running until last record in the old DB is expired
+ Turn...
CQL COPY
CQL COPY: Database Compatibility
+ Scylla and Cassandra: Common file format
+ Schema Migration vs Schema Redesign
SQL
NoSQL
COPY continued
Some knobs:
+ HEADER
+ CHUNKSIZE
+ DATETIMEFORMAT
+ DELIMITER
+ INGESTRATE
+ MAXBATCHSIZE
+ MAXROWS
+ NULL
...
COPY and CSV files
Pros
+ Simplicity
+ CSV transparency
+ Easy to validate
+ Destination schema can have less
columns than ...
SSTableloader
+ Create snapshot of each Cassandra node
+ Run sstableloader from each Cassandra node, or from intermediate servers
+ Use ...
SStableloader continued
+ No Schema update during forklifting
+ Scylla’s sstableloader has support for simple column renam...
Mirror Loader
Mirror Loader
Preparation:
+ Temporarily mirror the original DB
+ Establish node pairs
+ Clone the token sets between node...
Mirror Loader
+ Start the mirrored Scylla cluster
+ Bring up destination Scylla nodes in a
new DC in the same cluster, usi...
Mirror Loader
Pros
+ Very simple approach
+ Direct file copy, no data digesting
+ Very low effect on source DB load
+ Nativ...
Scylla Spark Migrator
Scylla Spark migrator
+ Highly resilient to failures, and will retry reads and
writes throughout the job
+ Continuously wr...
Scylla Spark Migrator
A very simple and easy to use tool
+ Install the standard Spark stack (Java JRE and JDK, SBT)
+ Edit...
Scylla Spark Migrator - configuration
source:
host: 10.0.0.110
port: 9042
credentials:
username: <user>
password: <pass>
ke...
STDOUT:
2019-03-25 20:30:04 INFO migrator:405 -
Created a savepoint config at
/tmp/savepoints/savepoint_1553545804.yaml
du...
Takeaways: Online Migration
This webinar covered ways to do online migration (no downtime) to and from
Apache Cassandra, S...
Takeaways: Existing Data Migration
+ If Source database is SQL, MongoDB, etc:
+ Use COPY command
+ If you have control of ...
United States
1900 Embarcadero Road
Palo Alto, CA 94303
Israel
11 Galgalei Haplada
Herzelia, Israel
www.scylladb.com
@scyl...
Q&A
Stay in touch
dyasny@scylladb.com
@dyasny

Upcoming SlideShare

Loading in …5

×

  1. 1. Spark, File Transfer, and More Strategies for Migrating Data to and from a Cassandra or Scylla Cluster WEBINAR
  2. 2. Presenter 2 Dan Yasny Before ScyllaDB, Dan worked in various roles such as sysadmin, quality engineering, product management, tech support, integration and DevOps around mainly open source technology, at companies such as Red Hat and Dell.
  3. 3. 3 + The Real-Time Big Data Database + Drop-in replacement for Cassandra + 10X the performance & low tail latency + New: Scylla Cloud, DBaaS + Open source and enterprise editions + Founded by the creators of KVM hypervisor + HQs: Palo Alto, CA; Herzelia, Israel About ScyllaDB
  4. 4. Migration overview + Online and Offline migrations + Common steps: Schema, Existing data Online migrations + Dual Writes + Kafka + Custom application changes Existing data migration + Highly volatile/TTL’d data + CQL COPY + SSTableloader + Mirror loader (Danloader) + Spark Migrator Agenda
  5. 5. Migration Overview + Online migration + Added complexity + Added load + Offline migration + Downtime + Common steps + Schema migration and adjustments + Existing data migration + Data validation SSTable Loader SSTables CQL CQL CQL Client CQLCQL Client
  6. 6. Migrate Schema + Use DESCRIBE to export each Cassandra Keyspace, Table, UDT + cqlsh [IP] "-e DESC SCHEMA" > orig_schema.cql + cqlsh [IP] --file 'adjusted_schema.cql' + Schema updates when migrating from Cassandra 3.x + Different syntax for some schema properties might be needed https://docs.scylladb.com/operating-scylla/procedures/cassandra_to_scylla_migration_process/#notes-limitations-and-kn own-issues
  7. 7. Online Migration
  8. 8. Write to DB-OLD Cold Migration - No Dual Writes Time Read from DB-OLD
  9. 9. Write to DB-OLD Migrate Schema Cold Migration - No Dual Writes Time Read from DB-OLD
  10. 10. Write to DB-OLD Forklifting Existing Data Migrate Schema DBs in Sync Cold Migration - No Dual Writes Time Read from DB-OLD
  11. 11. Write to DB-OLD Forklifting Existing Data Validation* Migrate Schema DBs in Sync Cold Migration - No Dual Writes Time Fade off DB-OLD Read from DB-OLD
  12. 12. Write to DB-OLD Forklifting Existing Data Validation* Migrate Schema DBs in Sync Cold Migration - No Dual Writes Time Read from DB-NEW Fade off DB-OLD Read from DB-OLD Write to DB-NEW
  13. 13. Write to DB-OLD Dual Writes Time Read from DB-OLD
  14. 14. Write to DB-OLD Migrate Schema Dual Writes Time Read from DB-OLD
  15. 15. Write to DB-OLD Dual Writes Migrate Schema Dual Writes Time Read from DB-OLD
  16. 16. Write to DB-OLD Dual Writes Migrate Schema Dual Writes Time Read from DB-OLD Write to DB-NEW
  17. 17. Write to DB-OLD Dual Writes Forklifting Existing Data Migrate Schema Dual Writes Time Read from DB-OLD Write to DB-NEW
  18. 18. Write to DB-OLD Dual Writes Forklifting Existing Data Migrate Schema DBs in Sync Dual Writes Time Read from DB-OLD Write to DB-NEW
  19. 19. Dual Reads Write to DB-OLD Dual Writes Forklifting Existing Data Validation Migrate Schema DBs in Sync Dual Writes Time Read from DB-OLD Write to DB-NEW
  20. 20. Dual Reads Write to DB-OLD Dual Writes Forklifting Existing Data Validation Migrate Schema DBs in Sync Dual Writes Time Read from DB-NEW Read from DB-OLD Write to DB-NEW
  21. 21. Dual Reads Write to DB-OLD Dual Writes Forklifting Existing Data Validation Migrate Schema DBs in Sync Dual Writes Time Read from DB-NEW Fade off DB-OLD Read from DB-OLD Write to DB-NEW
  22. 22. Apache Kafka based dual writes Already using Kafka + Start buffering the writes to new cluster + Increase the TTL and add buffer time while migration is in progress/about to start + Keep sending writes to old cluster + Once existing data migration is complete, stream the data to new cluster + Use the Kafka-connect framework with the Cassandra connector + Use KSQL if you want to run a couple of transformations on the data (EXPERIMENTAL)
  23. 23. Dual Writes: App changes code sample writes = [] writes.append(db1.execute_async(insert_statement_prepared[0], values)) writes.append(db2.execute_async(insert_statement_prepared[1], values)) results = [] for i in range(0,len(writes)): try: row = writes[i].result() results.append(1) except Exception: results.append(0) # Handle it if (results[0]==0): log('Write to cluster 1 failed') if (results[1]==0): log('Write to cluster 2 failed')
  24. 24. Existing Data Migration
  25. 25. Existing data migration strategies + CQL COPY + SSTableloader + Mirror loader + Spark Migrator When performing an online migration, always use a strategy that preserves timestamps, unless all keys are unique
  26. 26. Databases: Under the hood + Native CQL to native CQL + Scylla Spark Migrator + SSTable files to CQL + SSTableloader + SSTable files to SStable files + Mirror loader + Arbitrary data files to CQL + COPY
  27. 27. Highly volatile data with low TTL + Establish dual writes + Keep running until last record in the old DB is expired + Turn off dual writes + Phase out old DB SQL NoSQL
  28. 28. CQL COPY
  29. 29. CQL COPY: Database Compatibility + Scylla and Cassandra: Common file format + Schema Migration vs Schema Redesign SQL NoSQL
  30. 30. COPY continued Some knobs: + HEADER + CHUNKSIZE + DATETIMEFORMAT + DELIMITER + INGESTRATE + MAXBATCHSIZE + MAXROWS + NULL + PREPAREDSTATEMENTS + TTL + File size matters + Skipping unwanted columns + Formatting + NULL + DATETIME + Quotes + Escapes + Delimiters + Best practices + Small files + Separate host
  31. 31. COPY and CSV files Pros + Simplicity + CSV transparency + Easy to validate + Destination schema can have less columns than the original + Can be tweaked, plenty of language support + Can be used for any data ingestion, not necessarily from Scylla/Cassandra (incompatible DBs) + Compatible with Cassandra, Scylla and Scylla Cloud Cons + Not for large data sizes + Timestamps not preserved - be careful with online migrations
  32. 32. SSTableloader
  33. 33. + Create snapshot of each Cassandra node + Run sstableloader from each Cassandra node, or from intermediate servers + Use throttling -t to limit the leader throughput if needed + Run several sstableloaders in parallel Both Cassandra and Scylla ship with an sstableloader utility. While they are similar, there are differences between the two: + Use Scylla’s sstableloader to migrate to Scylla SSTableloader Scylla’s SSTable Loader SSTables CQL SQL NoSQL
  34. 34. SStableloader continued + No Schema update during forklifting + Scylla’s sstableloader has support for simple column renames + Assuming RF=3, you end up with 9 copies of the data until compaction happens Failure handling: + What should I do if sstableloader fails? + What should I do if a source node fails? + What should I do if a destination node fails? + How to rollback and start from scratch? https://docs.scylladb.com/operating-scylla/procedures/cassandra_to_scylla_migration_process
  35. 35. Mirror Loader
  36. 36. Mirror Loader Preparation: + Temporarily mirror the original DB + Establish node pairs + Clone the token sets between node pairs + nodetool ring + Every node has token assignment, which has to match the data on disk + We want to bring up a similar Scylla setup, using the same token ranges + Then let Scylla’s internals do the work Source DB Temp DB File copy SQL NoSQL
  37. 37. Mirror Loader + Start the mirrored Scylla cluster + Bring up destination Scylla nodes in a new DC in the same cluster, using the temp cluster as seed + Start synchronization (repair or rebuild) + Wait for synchronization to complete + Phase out the Old and Temporary clusters Native sync Source cluster Destination Cluster temporary DC1 Destination cluster DC2
  38. 38. Mirror Loader Pros + Very simple approach + Direct file copy, no data digesting + Very low effect on source DB load + Native sync to destination DB + Very fast - files are copied and the temporary DB is ready to be used immediately. Cons + Supported file formats + ka, la, mc + Temporary machines required + Not usable with Scylla cloud + Schema adjustments might be needed
  39. 39. Scylla Spark Migrator
  40. 40. Scylla Spark migrator + Highly resilient to failures, and will retry reads and writes throughout the job + Continuously writes savepoint files which can be used to resume the transfer from the point at which it stopped + Access compatible Databases using a native connector + High performance parallelized reads and writes + Unlimited streaming power + Reduce data transfer costs + Can be configured to preserve the WRITETIME and TTL attributes of the fields that are copied + Can handle column renames as part of the transfer SQL NoSQL
  41. 41. Scylla Spark Migrator A very simple and easy to use tool + Install the standard Spark stack (Java JRE and JDK, SBT) + Edit configuration file + Run Links: + https://www.scylladb.com/2019/02/07/moving-from-cassandra-to-scylla-via-apache-spark-scylla- migrator/ + https://github.com/scylladb/scylla-migrator/
  42. 42. Scylla Spark Migrator - configuration source: host: 10.0.0.110 port: 9042 credentials: username: <user> password: <pass> keyspace: keyspace1 table: standard1 splitCount: 256 connections: 4 fetchSize: 1000 target: ... preserveTimestamps: true savepoints: path: /tmp/savepoints intervalSeconds: 60 renames: [] skipTokenRanges: []
  43. 43. STDOUT: 2019-03-25 20:30:04 INFO migrator:405 - Created a savepoint config at /tmp/savepoints/savepoint_1553545804.yaml due to schedule. Ranges added: Set((49660176753484882,50517483720003777), (1176795029308651734,1264410883115973030), (-246387809075769230,-238284145977950153), (-735372055852897323,-726956712682417148), (6875465462741850487,6973045836764204908), (-467003452415310709,-4589291437737669003) ... Scylla Spark migrator
  44. 44. Takeaways: Online Migration This webinar covered ways to do online migration (no downtime) to and from Apache Cassandra, Scylla, and Scylla Cloud. This requires the writes to be sent to both clusters + Have an existing Kafka infrastructure: replay kafka streams + For all other scenarios: small changes to the application to do dual writes
  45. 45. Takeaways: Existing Data Migration + If Source database is SQL, MongoDB, etc: + Use COPY command + If you have control of the topology and can afford temporary extra nodes: + Use Mirror Loader + If you have access to the original SSTable files: + Use SSTableloader + Want a fully flexible streaming solution and can afford the extra load in the source: + Use the Scylla Spark Loader
  46. 46. United States 1900 Embarcadero Road Palo Alto, CA 94303 Israel 11 Galgalei Haplada Herzelia, Israel www.scylladb.com @scylladb Thank you
  47. 47. Q&A Stay in touch dyasny@scylladb.com @dyasny

×

Related Articles

python
java
cassandra

Vald

John Doe

2/11/2024

scylladb
cassandra

Checkout Planet Cassandra

Claim Your Free Planet Cassandra Contributor T-shirt!

Make your contribution and score a FREE Planet Cassandra Contributor T-Shirt! 
We value our incredible Cassandra community, and we want to express our gratitude by sending an exclusive Planet Cassandra Contributor T-Shirt you can wear with pride.

Join Our Newsletter!

Sign up below to receive email updates and see what's going on with our company

Explore Related Topics

AllKafkaSparkScyllaSStableKubernetesApiGithubGraphQl

Explore Further

data.engineering