Server Migration Guide
Step-by-step guide to safely migrating your data, websites, and applications to a REXE server with minimal downtime.
Table of Contents
Introduction
Server migration is the process of transferring all data, applications, and configurations from your existing server to a new one. With proper planning, you can minimize downtime and prevent data loss.
Pre-Migration Preparation
1. Take Inventory
# Running services
systemctl list-units --type=service --state=running
# Installed packages
dpkg --get-selections > /tmp/packages.txt # Debian/Ubuntu
# Open ports
ss -tlnp
# Crontab
crontab -l > /tmp/crontab_backup.txt
# Disk usage
df -h
du -sh /var/www/ /home/ /etc/
# Databases
mysql -e "SHOW DATABASES;"
2. Take Backups
# Web files
tar -czf /tmp/www_backup.tar.gz /var/www/
# Database backup
mysqldump --all-databases -u root -p > /tmp/all_databases.sql
# Config files
tar -czf /tmp/etc_backup.tar.gz /etc/
3. Lower DNS TTL
Lower DNS TTL 24-48 hours before migration:
Current TTL: 86400 (24 hours)
New TTL: 300 (5 minutes)
Migration Methods
Method 1: Live Migration with rsync (Recommended)
# Pull files from old server to new server
rsync -avz --progress \
-e "ssh -p 22" \
root@old_server_ip:/var/www/ \
/var/www/
# Config files
rsync -avz --progress \
-e "ssh -p 22" \
root@old_server_ip:/etc/nginx/ \
/etc/nginx/
# Database
rsync -avz --progress \
-e "ssh -p 22" \
root@old_server_ip:/tmp/all_databases.sql \
/tmp/
Method 2: SCP File Transfer
# Single file
scp root@old_server_ip:/tmp/backup.tar.gz /tmp/
# Directory
scp -r root@old_server_ip:/var/www/ /var/www/
Application-Specific Migration
Website (Nginx/Apache)
# 1. Transfer web files
rsync -avz root@old_ip:/var/www/ /var/www/
# 2. Transfer Nginx config
rsync -avz root@old_ip:/etc/nginx/sites-available/ /etc/nginx/sites-available/
# 3. Transfer SSL certificates
rsync -avz root@old_ip:/etc/letsencrypt/ /etc/letsencrypt/
# 4. Restart Nginx
nginx -t && systemctl restart nginx
Database (MySQL/MariaDB)
# On old server: dump
mysqldump --all-databases -u root -p > /tmp/all_db.sql
# On new server: import
mysql -u root -p < /tmp/all_db.sql
Docker Applications
# Save images
docker save myapp:latest | gzip > /tmp/myapp.tar.gz
# Transfer
rsync -avz root@old_ip:/tmp/myapp.tar.gz /tmp/
# Load on new server
docker load < /tmp/myapp.tar.gz
DNS Cutover
- Fully prepare and test the new server
- Update DNS A record to new IP
- Wait for TTL (5 minutes if you lowered it to 300)
- Verify new server is working
- Keep old server active for a few days (for rollback)
# Check DNS propagation
nslookup domain.com 8.8.8.8
nslookup domain.com 1.1.1.1
Post-Migration Checks
# Check all services are running
systemctl status nginx mysql php8.2-fpm
# Test website
curl -I https://domain.com
# Check SSL certificate
curl -vI https://domain.com 2>&1 | grep -E '(SSL|expire|issuer)'
# Check logs
tail -f /var/log/nginx/error.log
Don't shut down the old server immediately after migration. Keep it active for at least 1 week. Some users may still reach the old server due to DNS caching.
Conclusion
Planning is critical for a successful server migration. Take a full backup before migration, lower DNS TTL, and thoroughly test before going live. Our technical support team can assist if you encounter issues during migration.
Related Articles
REXE Service Comparison: VDS, Dedicated, Colocation Guide
Compare REXE Technology's VDS, dedicated server, colocation, and rack rental services in detail. Find the right hosting solution for your needs with our pricing and feature guide.
Server Backup Options and Data Recovery Guide for REXE
REXE Technology backup options: automatic snapshots, manual backups, and application-level backup strategies. Learn how to prevent data loss and recover quickly from any incident.
SLA and Uptime Guarantee: REXE 99.9% Service Commitment
REXE Technology SLA policy: 99.9% uptime guarantee, credit policy, uptime calculation and data center infrastructure. Learn your rights and the credit process during outages.