|
2 | 2 |
|
3 | 3 | ###########################################################################################################################
|
4 | 4 | #
|
5 |
| -# This script can be used to Migrate data between Cassandra Clusters (including Astra) in chunks. It migrates data by |
6 |
| -# partition token ranges sequentially in progressive slices. It also helps to restart migration from a point where the |
7 |
| -# previous run might have stopped/failed for whatever reasons. |
| 5 | +# This script can be used to Migrate data between two Cassandra Clusters (including Astra) in chunks. It migrates data |
| 6 | +# sequentially in progressive token-range slices. It also helps to restart migration from a point where the previous |
| 7 | +# run might have stopped/failed for whatever reasons. |
| 8 | +# |
| 9 | +# Before running the script, update the below params |
| 10 | +# SPARK_SUBMIT - Path to the spark-submit command |
| 11 | +# PROPS_FILE - Path to the spark configuration for the table |
| 12 | +# S_IDX - Change this value only if you want to set a custom starting point (e.g. after a previous incomplete run) |
8 | 13 | #
|
9 | 14 | # *** IMP Note: Run this script using nohup in background using a logfile and tail the logfile to monitor progress ***
|
10 | 15 | # e.g. nohup ./migrate_data.sh > logs/spark/migrate_data.out &
|
@@ -32,24 +37,24 @@ echo "Starting Migration using $PROPS_FILE !!"
|
32 | 37 | # Migrate initial partition tokens from min-long to -9000000000000000000
|
33 | 38 | if [ $S_IDX -lt -9000000000000000000 ]
|
34 | 39 | then
|
35 |
| - E_IDX=-9000000000000000001 |
36 |
| - echo "Running Migrate for Partition Range $S_IDX to $E_IDX .." |
37 |
| - $SPARK_SUBMIT --properties-file $PROPS_FILE --master "local[*]" --conf spark.migrate.source.minPartition=$S_IDX --conf spark.migrate.source.maxPartition=$E_IDX --class datastax.astra.migrate.Migrate migrate-*.jar |
38 |
| - S_IDX=-9000000000000000000 |
| 40 | + E_IDX=-9000000000000000001 |
| 41 | + echo "Running Migrate for Partition Range $S_IDX to $E_IDX .." |
| 42 | + $SPARK_SUBMIT --properties-file $PROPS_FILE --master "local[*]" --conf spark.migrate.source.minPartition=$S_IDX --conf spark.migrate.source.maxPartition=$E_IDX --class datastax.astra.migrate.Migrate migrate-*.jar |
| 43 | + S_IDX=-9000000000000000000 |
39 | 44 | fi
|
40 | 45 |
|
41 | 46 | # Migrate partition tokens from -9000000000000000000 to 8999999999999999999 in slices of 1000000000000000000
|
42 | 47 | while [ $S_IDX -lt 9000000000000000000 ]
|
43 | 48 | do
|
44 |
| - if [ $S_IDX -gt 8223372036854775807 ] |
45 |
| - then |
46 |
| - E_IDX=8999999999999999999 |
47 |
| - else |
48 |
| - E_IDX=$(( $S_IDX + $SLICE )) |
49 |
| - fi |
50 |
| - echo "Running Migrate for Partition Range $S_IDX to $E_IDX .." |
51 |
| - $SPARK_SUBMIT --properties-file $PROPS_FILE --master "local[*]" --conf spark.migrate.source.minPartition=$S_IDX --conf spark.migrate.source.maxPartition=$E_IDX --class datastax.astra.migrate.Migrate migrate-*.jar |
52 |
| - S_IDX=$(( $E_IDX + 1 )) |
| 49 | + if [ $S_IDX -gt 8223372036854775807 ] |
| 50 | + then |
| 51 | + E_IDX=8999999999999999999 |
| 52 | + else |
| 53 | + E_IDX=$(( $S_IDX + $SLICE )) |
| 54 | + fi |
| 55 | + echo "Running Migrate for Partition Range $S_IDX to $E_IDX .." |
| 56 | + $SPARK_SUBMIT --properties-file $PROPS_FILE --master "local[*]" --conf spark.migrate.source.minPartition=$S_IDX --conf spark.migrate.source.maxPartition=$E_IDX --class datastax.astra.migrate.Migrate migrate-*.jar |
| 57 | + S_IDX=$(( $E_IDX + 1 )) |
53 | 58 | done
|
54 | 59 |
|
55 | 60 | # Migrate final partition tokens from 9000000000000000000 to max-long
|
|
0 commit comments