The 'It Won't Happen To Me' Syndrome: Disaster Recovery Strategies for Nordic Systems
Letβs be honest with each other. You have a backup script. It runs a tar command at 3:00 AM. It dumps a gzipped file onto the same physical disk as your production data. You sleep soundly.
Wake up. That is not a Disaster Recovery (DR) plan. That is a suicide pact with your hardware.
It is February 2014. We have witnessed massive outages this past year. We have seen what happens when relying on 'The Cloud' blindly. The reality of systems administration, whether you are running a high-traffic Magento store or a critical email server for a relentless Oslo law firm, is simple: Hardware fails. Power grids fluctuate. Admins make typos.
If your strategy relies on a single VPS staying up forever, you are already down. You just don't know it yet. Here is how we architect resilience using tools available today, focusing on the specific latency and legal constraints of the Norwegian market.
1. Redundancy is Not Backup (The RAID Fallacy)
I recently audited a setup for a client in Trondheim. They boasted about their RAID 10 array. "We can lose two drives and stay up!" they said. That is true. But RAID redundancy handles hardware availability. It does not handle:
rm -rf /(Human error)- Corrupted file systems (Software error)
- Malicious intrusion (Security breach)
- Fire or Flood (Data center failure)
CoolVDS provides enterprise-grade SSD storage with RAID protection at the block level. That keeps your service online if a disk stutters. But for true DR, you need geographic separation and point-in-time recovery.
2. The "Poor Man's" Replication: Rsync is Still King
Forget complex, expensive proprietary backup software. The most battle-hardened tool in 2014 remains rsync. It is efficient, it handles delta transfers, and it is installed on virtually every Linux distribution from CentOS 5 to the latest Ubuntu 13.10.
For a static web server (Nginx/Apache), we need to ship /var/www/html to a secondary location. Ideally, if your primary is in Oslo, your secondary should be in a different facility, perhaps Bergen or even Stockholm (latency permitting).
The Bulletproof Rsync Script
Don't just run rsync manually. Automate it with strict error logging. Here is the snippet I use for production nodes:
#!/bin/bash
# Configuration
SOURCE_DIR="/var/www/html/"
DEST_USER="backup_user"
DEST_HOST="192.168.1.50" # Secondary CoolVDS Instance
DEST_DIR="/home/backups/web01/"
LOG_FILE="/var/log/daily_backup.log"
echo "Starting backup at $(date)" >> $LOG_FILE
# -a: archive mode (preserves permissions, times)
# -v: verbose
# -z: compress during transfer (saves bandwidth)
# --delete: delete files in dest that are gone in source (Be careful!)
rsync -avz --delete -e "ssh -p 2222" $SOURCE_DIR $DEST_USER@$DEST_HOST:$DEST_DIR >> $LOG_FILE 2>&1
if [ $? -eq 0 ]; then
echo "Backup Success: $(date)" >> $LOG_FILE
else
echo "CRITICAL FAILURE: $(date)" >> $LOG_FILE
# In 2014, we might pipe this to sendmail
echo "Backup Failed" | mail -s "DR ALERT" admin@example.no
fi
Pro Tip: Always run rsync over a private network interface (backend LAN) if your provider supports it. CoolVDS offers private networking between instances, meaning your backup traffic doesn't count against your public bandwidth quota and is secure from public sniffing.
3. Database Consistency: The MySQL Trap
You cannot simply rsync the /var/lib/mysql directory while the server is running. You will end up with corrupted tables. In 2014, for standard MySQL 5.5 or 5.6 setups, you have two pragmatic options for DR.
Option A: The Dump and Ship (Small Databases)
For databases under 5GB, a nightly mysqldump is acceptable.
mysqldump -u root -p'PASSWORD' --single-transaction --quick --lock-tables=false all-databases | gzip > /backups/db_$(date +%F).sql.gz
Option B: Master-Slave Replication (High Availability)
For critical applications, you need real-time replication. This drastically reduces your RPO (Recovery Point Objective). If the master dies, the slave has data from seconds ago.
In your my.cnf (usually found in /etc/mysql/ or /etc/), you must configure the binary log:
[mysqld]
server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
binlog_do_db = production_db
# Performance tuning for SSD (Crucial on CoolVDS)
innodb_flush_log_at_trx_commit = 1
innodb_buffer_pool_size = 2G # Adjust based on RAM
innodb_io_capacity = 2000 # We have fast SSDs, use them!
Setting innodb_io_capacity correctly is vital. Default MySQL settings assume spinning rusty HDDs. On CoolVDS high-performance storage, leaving this at '200' is like driving a Ferrari in first gear.
4. Data Sovereignty and The Law (Personopplysningsloven)
Technical recovery is half the battle. Legal compliance is the other. With the recent revelations regarding NSA surveillance (Snowden, 2013), trust in US-based hosting is at an all-time low. The "Safe Harbor" framework is under intense scrutiny.
For Norwegian businesses, the Personal Data Act (Personopplysningsloven) enforces strict rules on how sensitive data is handled. Datatilsynet (The Norwegian Data Protection Authority) does not look kindly on personal data leaking across borders without control.
Hosting your primary and DR site within Norway (or the EEA) reduces your legal exposure significantly. It also improves latency. Pinging a backup server in Virginia takes ~100ms. Pinging a CoolVDS instance in Oslo via NIX (Norwegian Internet Exchange) takes ~2ms. When you are restoring 500GB of data, that latency difference translates to hours of downtime.
5. The Architecture of Trust
Why do we emphasize KVM (Kernel-based Virtual Machine) at CoolVDS? Because in a disaster scenario, resource isolation is paramount.
Older virtualization technologies like OpenVZ share the host kernel. If a "noisy neighbor" on the same physical host Kernel Panics the system, your "uptime" is gone. KVM provides hardware virtualization. Your OS is yours. Your kernel is yours. If the neighbor crashes, you keep humming along.
| Feature | OpenVZ / Containers | CoolVDS (KVM) |
|---|---|---|
| Isolation | Shared Kernel (Risk) | Full Hardware Virtualization (Safe) |
| Disk I/O | Shared contention | Dedicated SSD throughput |
| Custom Kernels | No | Yes (Required for specific DRBD setups) |
Final Thoughts: Test or Fail
A backup that hasn't been restored is not a backup; it is a wish. Schedule a "Fire Drill" next Friday. Spin up a fresh CoolVDS instance, pull your backups, and see if your application actually boots.
Do not wait for the inevitable hardware failure to find out your `mysqldump` command was missing a flag. Secure your infrastructure on a platform built for stability.
Need a sandbox to test your recovery scripts? Deploy a high-performance SSD VPS on CoolVDS in under 60 seconds.