Skip to content

Migrating from MySQL

Enrico Olivelli edited this page Nov 13, 2019 · 2 revisions

Migrating data from MySQL

If you have to migrate data from MySQL (or any other database which can dump the contents to a SQL file) you can use the provided herddb-cli.sh script. As backup files can be huge herddb-cli script can read directly gzipped files

bin/herddb-cli.sh -f my_huge_dump_file.sql.gz --mysql

The --frommysqldump tells the cli that the file is from MySQL and so some MySQL weird syntax will handled as well

Spreading data across multiple tablespaces

You can easily spread your tables using a Groovy script which maps each table name to a tablespace name. This is very useful when you have to distribute and existing database to a distributed HerdDB cluster

bin/herddb-cli.sh -f my_huge_dump_file.sql.gz --mysql -tsm tablespacemapper.groovy

Sample "tablespacemapper.groovy" code:

int underscore = tableName.indexOf('_');
if (underscore > 0 && tableName.toLowerCase().startsWith('q')) {
   return tableName.substring(0,underscore);
} else {
  return 'config';
}

The script essentially maps the 'tableName' variable to the name of a tablespace

Clone this wiki locally