Migration assessment TECH PREVIEW

Create a migration assessment report

The Voyager Migration Assessment feature is specifically designed to optimize the database migration process from various source databases, currently supporting PostgreSQL to YugabyteDB. Voyager conducts a detailed analysis of the source database by capturing essential metadata and metrics. It generates a comprehensive assessment report that recommends effective migration strategies, and provides key insights on ideal cluster configurations for optimal performance with YugabyteDB.

Overview

When you run an assessment, Voyager collects metadata or metrics from the source database. This includes table columns metadata, sizes of tables and indexes, read and write IOPS for tables and indexes, and so on. With this data, Voyager generates an assessment report with the following key details:

  • Database compatibility. An assessment of the compatibility of the source database with YugabyteDB, identifying unsupported features and data types.

  • Cluster size evaluation. Estimated resource requirements for the target environment, to help with planning and scaling your infrastructure. The sizing logic depends on various factors such as the size and number of tables in the source database, as well as the throughput requirements (read/write IOPS).

  • Schema evaluation. Reviews the database schema to suggest effective sharding strategies for tables and indexes.

  • Performance metrics. Voyager analyzes performance metrics to understand workload characteristics and provide recommendations for optimization in YugabyteDB.

  • Migration time estimate. An estimate of the time needed to import data into YugabyteDB after export from the source database. These estimates are calculated based on various experiments during data import to YugabyteDB.

Caveat

The recommendations are based on testing using a RF3 YugabyteDB cluster on instance types with 4GiB memory per core and running v2024.1.

Note that for cases where it is not possible to provide database access to the client machine running Voyager, you can gather the metadata from the source database using plain bash/psql scripts provided with Voyager, and then use Voyager to analyze the metadata directly.

The following table describes the type of data that is collected during a migration assessment.

Data Collected Details
Application or user data No No application or user data is collected.
Passwords No The assessment does not store any passwords.
Database metadata
schema, object, object names
Yes Voyager collects the schema metadata including table IOPS, table size, and so on, and the actual schema.
Database name Yes Voyager collects database and schema names to be used in the generated report.
Performance metrics Optional Voyager captures performance metrics from the database (IOPS) for rightsizing the target environment.
Server or database credentials No No server or database credentials are collected.

Sample Migration Assessment report

A sample Migration Assessment report is as follows:

Migration report

Generate a Migration Assessment report

  1. Install yb-voyager.

  2. Prepare the source database.

    1. Create a new user, ybvoyager as follows:

      CREATE USER ybvoyager PASSWORD 'password';
      
    2. Grant necessary permissions to the ybvoyager user.

      /* Switch to the database that you want to migrate.*/
      \c <database_name>
      
      /* Grant the USAGE permission to the ybvoyager user on all schemas of the database.*/
      
      SELECT 'GRANT USAGE ON SCHEMA ' || schema_name || ' TO ybvoyager;' FROM information_schema.schemata; \gexec
      
      /* The above SELECT statement generates a list of GRANT USAGE statements which are then executed by psql because of the \gexec switch. The \gexec switch works for PostgreSQL v9.6 and later. For older versions, you'll have to manually execute the GRANT USAGE ON SCHEMA schema_name TO ybvoyager statement, for each schema in the source PostgreSQL database. */
      
      /* Grant SELECT permission on all the tables. */
      
      SELECT 'GRANT SELECT ON ALL TABLES IN SCHEMA ' || schema_name || ' TO ybvoyager;' FROM information_schema.schemata; \gexec
      
  3. Assess migration - Voyager supports two primary modes for conducting migration assessments, depending on your access to the source database as follows:

    1. With source database connectivity: This mode requires direct connectivity to the source database from the client machine where voyager is installed. You initiate the assessment by executing the assess-migration command of yb-voyager. This command facilitates a live analysis by interacting directly with the source database, to gather metadata required for assessment. A sample command is as follows:

      yb-voyager assess-migration --source-db-type postgresql \
      --source-db-host hostname --source-db-user ybvoyager \
      --source-db-password password --source-db-name dbname \
      --source-db-schema schema1,schema2 --export-dir /path/to/export/dir
      
    2. Without source database connectivity: In situations where direct access to the source database is restricted, there is an alternative approach. Voyager includes packages with scripts present at /etc/yb-voyager/gather-assessment-metadata/postgresql. You can perform the following steps with these scripts.

      1. Copy the scripts to a machine which has access to the source database.

      2. Run the yb-voyager-pg-gather-assessment-metadata.sh script by providing the source connection string, the schema names, path to a directory where metadata will be saved, and an optional argument of an interval to capture the IOPS metadata of the source (in seconds with a default value of 120). For example,

        /path/to/yb-voyager-pg-gather-assessment-metadata.sh 'postgresql://ybvoyager@host:port/dbname' 'schema1|schema2' '/path/to/assessment_metadata_dir' '60'
        
      3. Copy the metadata directory to the client machine on which voyager is installed, and run the assess-migration command by specifying the path to the metadata directory as follows:

        yb-voyager assess-migration --source-db-type postgresql \
             --assessment-metadata-dir /path/to/assessment_metadata_dir --export-dir /path/to/export/dir
        

      The output of both the methods is a migration assessment report, and its path is printed on the console.

    Important

    For the most accurate migration assessment, the source database must be actively handling its typical workloads at the time the metadata is gathered. This ensures that the recommendations for sharding strategies and cluster sizing are well-aligned with the database's real-world performance and operational needs.
  4. Create a target YugabyteDB cluster as follows:

    1. Create a cluster based on the sizing recommendations in the assessment report.

    2. Create a database with colocation set to TRUE.

      CREATE DATABASE <TARGET_DB_NAME> with COLOCATION=TRUE;
      
  5. Proceed with migration with one of the migration workflows:

Learn more