Offsite Backups

From Server rental store
Revision as of 17:40, 15 April 2025 by Admin (talk | contribs) (Automated server configuration article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  1. Offsite Backups

This article details the configuration of offsite backups for our MediaWiki installation. Protecting your data is crucial, and relying solely on local backups is insufficient in the event of a major disaster (fire, flood, theft, etc.). This guide will outline the process for establishing a robust offsite backup strategy. We will cover the tools used, configuration steps, and verification procedures. This is intended for system administrators and those familiar with Server Administration concepts.

Why Offsite Backups?

Local backups are vital for quick restoration from minor issues like accidental file deletion or database corruption. However, they offer no protection against physical disasters affecting the server location. Offsite backups ensure business continuity by providing a copy of your data stored in a geographically separate location. This allows for recovery even if the primary server and local backups are compromised. See also Disaster Recovery Planning.

Backup Tools & Technologies

We utilize a combination of tools for our offsite backup solution:

  • rsync: Used for efficient incremental file transfer.
  • SSH: Provides a secure channel for transferring data.
  • cron: Automates the backup process.
  • Remote Server: A dedicated server at a separate location, acting as the backup destination. This server must have sufficient storage space and network bandwidth. More details on Server Requirements.

Configuration Steps

These steps outline the configuration required on both the MediaWiki server (source) and the remote backup server (destination). Before beginning, ensure you have SSH access established between the two servers using SSH Keys for passwordless authentication. This is *critical* for automated backups.

1. Remote Server Preparation

On the remote backup server, create a dedicated directory to store the MediaWiki backups. Ensure the user account used for rsync has write permissions to this directory.

```bash mkdir /backup/mediawiki chown backupuser:backupgroup /backup/mediawiki chmod 700 /backup/mediawiki ```

2. Rsync Script Creation

On the MediaWiki server, create a bash script (e.g., `/usr/local/bin/mediawiki_backup.sh`) to handle the backup process. This script will use rsync to copy the necessary files and directories.

```bash

  1. !/bin/bash
  1. Configuration

SOURCE_DIR="/var/www/html/mediawiki" # Adjust to your MediaWiki installation directory DESTINATION_USER="backupuser" DESTINATION_SERVER="backupserver.example.com" DESTINATION_DIR="/backup/mediawiki" DATE=$(date +%Y-%m-%d_%H-%M-%S) BACKUP_DIR="$DESTINATION_DIR/$DATE"

  1. Create backup directory on remote server

ssh $DESTINATION_USER@$DESTINATION_SERVER "mkdir -p $BACKUP_DIR"

  1. Perform rsync backup

rsync -avz --delete $SOURCE_DIR/ $DESTINATION_USER@$DESTINATION_SERVER:$BACKUP_DIR

  1. Log the backup

echo "Backup completed to $DESTINATION_SERVER:$BACKUP_DIR" >> /var/log/mediawiki_backup.log ```

Make the script executable:

```bash chmod +x /usr/local/bin/mediawiki_backup.sh ```

3. Cron Job Scheduling

Configure a cron job to run the backup script automatically. Edit the crontab using `crontab -e`. Add a line similar to the following to schedule the backup to run daily at 2:00 AM:

``` 0 2 * * * /usr/local/bin/mediawiki_backup.sh ```

This will run the script every day at 2:00 AM. Refer to Cron Job Management for more details.

Files to Backup

The following table details the essential files and directories that must be included in the backup:

File/Directory Description
/var/www/html/mediawiki/ The entire MediaWiki installation directory.
/var/lib/mysql/mediawiki_db/ The MySQL database directory (adjust path as needed).
/etc/apache2/sites-available/mediawiki.conf Apache configuration file (if applicable).
/etc/php/7.4/apache2/php.ini PHP configuration file (adjust PHP version as needed).

Database Backup

In addition to file-based backups, it is *essential* to regularly back up the MediaWiki database. We use `mysqldump` for this purpose. Add the following to the backup script `/usr/local/bin/mediawiki_backup.sh` *before* the rsync command:

```bash

  1. Database Backup

MYSQL_USER="mediawiki_user" MYSQL_PASSWORD="your_password" MYSQL_DATABASE="mediawiki_db" DATABASE_BACKUP_FILE="$BACKUP_DIR/mediawiki_db_$DATE.sql.gz"

mysqldump -u $MYSQL_USER -p"$MYSQL_PASSWORD" $MYSQL_DATABASE | gzip > $DATABASE_BACKUP_FILE ```

    • Important:** Replace `mediawiki_user`, `your_password`, and `mediawiki_db` with your actual database credentials. Consider using a dedicated backup user with limited privileges for increased security. See Database Security.

Backup Verification & Restoration

Regularly verify the integrity of your backups. This involves performing test restorations to a staging environment. The following table summarizes key considerations for restoration:

Step Description
1. Restore Files Copy the backed-up files from the remote server to the staging environment.
2. Restore Database Import the SQL dump file into a new database instance.
3. Configuration Update Modify the `LocalSettings.php` file in the staging environment to point to the restored database.
4. Test Functionality Thoroughly test all MediaWiki features to ensure the restoration was successful.

Storage Specifications

The following table details the specifications of our remote backup server:

Component Specification
CPU Intel Xeon E3-1220 v3
RAM 16GB DDR3
Storage 4TB HDD (RAID 1)
Network 1Gbps Ethernet
Operating System Ubuntu Server 20.04 LTS

Security Considerations

  • Use SSH keys for authentication.
  • Restrict access to the backup directory on the remote server.
  • Encrypt the backups if possible. Consider using tools like `gpg`.
  • Regularly review backup logs for errors.
  • Implement Access Control Lists on both servers.

Related Articles


Intel-Based Server Configurations

Configuration Specifications Benchmark
Core i7-6700K/7700 Server 64 GB DDR4, NVMe SSD 2 x 512 GB CPU Benchmark: 8046
Core i7-8700 Server 64 GB DDR4, NVMe SSD 2x1 TB CPU Benchmark: 13124
Core i9-9900K Server 128 GB DDR4, NVMe SSD 2 x 1 TB CPU Benchmark: 49969
Core i9-13900 Server (64GB) 64 GB RAM, 2x2 TB NVMe SSD
Core i9-13900 Server (128GB) 128 GB RAM, 2x2 TB NVMe SSD
Core i5-13500 Server (64GB) 64 GB RAM, 2x500 GB NVMe SSD
Core i5-13500 Server (128GB) 128 GB RAM, 2x500 GB NVMe SSD
Core i5-13500 Workstation 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000

AMD-Based Server Configurations

Configuration Specifications Benchmark
Ryzen 5 3600 Server 64 GB RAM, 2x480 GB NVMe CPU Benchmark: 17849
Ryzen 7 7700 Server 64 GB DDR5 RAM, 2x1 TB NVMe CPU Benchmark: 35224
Ryzen 9 5950X Server 128 GB RAM, 2x4 TB NVMe CPU Benchmark: 46045
Ryzen 9 7950X Server 128 GB DDR5 ECC, 2x2 TB NVMe CPU Benchmark: 63561
EPYC 7502P Server (128GB/1TB) 128 GB RAM, 1 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (128GB/2TB) 128 GB RAM, 2 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (128GB/4TB) 128 GB RAM, 2x2 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (256GB/1TB) 256 GB RAM, 1 TB NVMe CPU Benchmark: 48021
EPYC 7502P Server (256GB/4TB) 256 GB RAM, 2x2 TB NVMe CPU Benchmark: 48021
EPYC 9454P Server 256 GB RAM, 2x2 TB NVMe

Order Your Dedicated Server

Configure and order your ideal server configuration

Need Assistance?

⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️