Docs / Migration Guides / Zero-Downtime PostgreSQL Major Version Upgrade

Zero-Downtime PostgreSQL Major Version Upgrade

By Admin · Jan 30, 2026 · Updated Apr 23, 2026 · 5 views · 2 min read

Managing postgresql effectively is a crucial skill for any system administrator. This tutorial provides step-by-step instructions for upgrade configuration, along with best practices for production environments.

Prerequisites

  • Basic familiarity with the Linux command line
  • A registered domain name (for public-facing services)
  • A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
  • Sufficient storage on the destination server
  • Root or sudo access to the server

Pre-Migration Assessment

When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.


# Pre-migration data sync with rsync
rsync -avzP --delete \
  --exclude='/dev' --exclude='/proc' --exclude='/sys' --exclude='/tmp' \
  -e 'ssh -p 22' \
  root@old-server:/ /mnt/migration/

# Final sync with minimal downtime
rsync -avzP --delete \
  -e 'ssh -p 22' \
  root@old-server:/var/www/ /var/www/

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.

Performance Considerations

If you encounter issues during setup, check the system logs first. Most problems can be diagnosed by examining the output of journalctl or the application-specific log files in /var/log/.

Data Transfer Process

When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.


# Database migration
# On source server:
mysqldump --single-transaction --routines --triggers --all-databases | gzip > db_backup.sql.gz

# Transfer to destination:
scp db_backup.sql.gz root@new-server:/tmp/

# On destination server:
gunzip < /tmp/db_backup.sql.gz | mysql -u root

Make sure to restart the service after applying these changes. Some settings require a full restart rather than a reload to take effect.

Important Notes

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.

Conclusion

This guide covered the essential steps for working with postgresql on a VPS environment. For more advanced configurations, refer to the official documentation. Don't hesitate to reach out to our support team if you need help with your specific setup.

Was this article helpful?