Skip to content

Instantly share code, notes, and snippets.

@PeterCorless
Created February 7, 2019 09:39
Show Gist options
  • Save PeterCorless/f666030384af0a7b2deeafb15845d64d to your computer and use it in GitHub Desktop.
Save PeterCorless/f666030384af0a7b2deeafb15845d64d to your computer and use it in GitHub Desktop.
Scylla Migrator
# On one node, start the master:
spark-2.4.0-bin-hadoop2.7 $ ./sbin/start-master.sh
# On the same node, and on the other nodes, start the Spark workers:
spark-2.4.0-bin-hadoop2.7 $ SPARK_WORKER_INSTANCES=8 SPARK_WORKER_CORES=2 ./sbin/start-slave.sh spark://<spark-master-ip>:7077
migrator $ spark-submit --class com.scylladb.migrator.Migrator \
--master spark://<private IP for the Spark master>:7077 \
--conf spark.scylla.config=<path to config.yaml> \
./target/scala-2.11/scylla-migrator-assembly-0.0.1.jar
2019-01-11 19:20:27 INFO migrator:123 - Original schema loaded:
root
|-- id: string (nullable = true)
|-- cola: string (nullable = true)
|-- colb: integer (nullable = true)
|-- colc: string (nullable = true)
2019-01-11 19:20:27 INFO migrator:259 - Schema after renames:
2019-01-11 19:20:27 INFO migrator:260 - root
|-- id: string (nullable = true)
|-- cola: string (nullable = true)
|-- colb: integer (nullable = true)
|-- colc: string (nullable = true)
2019-01-11 19:20:28 INFO TaskSetManager:54 - Starting task 0.0 in stage 0.0 (TID 0, 172.16.0.15, executor 19, partition 0, ANY, 10724 bytes)
2019-01-11 19:20:28 INFO TaskSetManager:54 - Starting task 1.0 in stage 0.0 (TID 1, 172.16.0.15, executor 11, partition 1, ANY, 9950 bytes)
2019-01-11 19:20:28 INFO TaskSetManager:54 - Starting task 2.0 in stage 0.0 (TID 2, 172.16.0.204, executor 21, partition 2, ANY, 10830 bytes)
2019-01-11 19:20:28 INFO TaskSetManager:54 - Starting task 3.0 in stage 0.0 (TID 3, 172.16.0.15, executor 10, partition 3, ANY, 10444 bytes)
2019-01-11 19:25:27 INFO migrator:357 - Created a savepoint config at /tmp/savepoints/savepoint_1547234727.yaml due to schedule. Ranges added: Set()
2019-01-11 19:30:27 INFO migrator:357 - Created a savepoint config at /tmp/savepoints/savepoint_1547235027.yaml due to schedule. Ranges added: Set()
2019-01-11 19:35:27 INFO migrator:357 - Created a savepoint config at /tmp/savepoints/savepoint_1547235327.yaml due to schedule. Ranges added: Set()
migrator $ spark-submit --class com.scylladb.migrator.Migrator \
--master spark://<private IP for the Spark master>:7077 \
--conf spark.scylla.config=savepoint_1547235327.yaml
./target/scala-2.11/scylla-migrator-assembly-0.0.1.jar
renames:
- from: orig_field
to: dest_field
renames:
- from: orig_field
to: dest_field
- from: old_col_name
to: new_col_name
-- Display the table settings:
SHOW CREATE TABLE <keyspace>.<table>;
-- Disable compaction:
ALTER TABLE <keyspace>.<table> WITH compaction = { ‘NullCompactionStrategy’ };
-- Re-enable compaction when done with the appropriate class:
ALTER TABLE <keyspace>.<table>
WITH compaction = { ‘<strategy class>’ };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment