Docs / Databases / Database Migration with Flyway

Database Migration with Flyway

By Admin · Feb 15, 2026 · Updated Apr 23, 2026 · 5 views · 3 min read

Getting flyway right from the start saves hours of debugging later. In this comprehensive guide, we'll cover everything from initial setup to production-ready configuration, including migration and versioning considerations.

Prerequisites

  • Basic familiarity with the Linux command line
  • A registered domain name (for public-facing services)
  • The target database server installed and running
  • Root or sudo access to the server
  • A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)

Installation and Initial Setup

The migration component plays a crucial role in the overall architecture. Understanding how it interacts with flyway will help you make better configuration decisions.


-- Check current configuration
SHOW VARIABLES LIKE '%migration%';
SHOW STATUS LIKE '%migration%';

-- Optimize settings
SET GLOBAL migration_size = '256M';

These commands should be run as root or with sudo privileges. If you're using a non-root user, prefix each command with sudo.

Configuration Options

The migration component plays a crucial role in the overall architecture. Understanding how it interacts with flyway will help you make better configuration decisions.

Configuration Tuning

The migration component plays a crucial role in the overall architecture. Understanding how it interacts with flyway will help you make better configuration decisions.


# Configuration file: /etc/mysql/mysql.conf.d/mysqld.cnf
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

# Add these optimizations:
[mysqld]
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 2
max_connections = 200

# Restart the service
sudo systemctl restart mysql

Note that file paths may vary depending on your Linux distribution. The examples here are for Debian/Ubuntu; adjust paths accordingly for RHEL/CentOS-based systems.

Advanced Settings

It's recommended to test this configuration in a staging environment before deploying to production. This helps identify potential compatibility issues and allows you to benchmark performance differences.

Setting Up Replication

Before making changes to the configuration, always create a backup of the existing files. This ensures you can quickly roll back if something goes wrong during the setup process.


# Check database performance
mysqltuner --host localhost --user root

# Monitor active queries
mysqladmin processlist
SHOW FULL PROCESSLIST;

The output should show the service running without errors. If you see any warning messages, address them before proceeding to the next step.

Configuration Options

The flyway configuration requires careful attention to resource limits and security settings. On a VPS with limited resources, it's important to tune these parameters according to your available RAM and CPU cores.

Backup and Recovery

For production deployments, consider implementing high availability by running multiple instances behind a load balancer. This approach provides both redundancy and improved performance under heavy load.


-- Check current configuration
SHOW VARIABLES LIKE '%migration%';
SHOW STATUS LIKE '%migration%';

-- Optimize settings
SET GLOBAL migration_size = '256M';

The output should show the service running without errors. If you see any warning messages, address them before proceeding to the next step.

Common Issues and Solutions

  • High memory usage: Review the configuration for memory-related settings. Reduce worker counts or buffer sizes if running on a low-RAM VPS.
  • Slow performance: Check for disk I/O bottlenecks with iostat -x 1 and network issues with mtr. Review application logs for slow queries or requests.
  • Service won't start: Check the logs with journalctl -xe -u flyway. Common causes include port conflicts, missing configuration files, or insufficient permissions.

Summary

You've successfully configured flyway on your VPS. Remember to monitor performance, keep your software updated, and maintain regular backups. If you run into issues, consult the official documentation or open a support ticket for assistance.

Was this article helpful?