Skip to content

Zap-Robo/replisim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

replisim

Data Replicating Appliance — generates realistic, continuous database and filesystem loads for Disaster Recovery (DR) replication testing.

It simulates the kind of production-like data churn that real DR testing requires, running as long-lived background processes (systemd services).


What it does

Database load (db_changer.py)

Continuously inserts batches of fake records into a MySQL users table using the Faker library. Enforces a row cap by deleting the oldest records when the limit is hit, maintaining a rolling window of data.

Filesystem load (file_changer.sh)

Continuously writes random binary files (via /dev/urandom) to a target directory. When the directory exceeds a configurable size limit, it deletes the oldest files to stay under the threshold.


Components

File Purpose
db_changer.py Main DB load generator
db_changer.ini Config: DB credentials, batch size, field definitions
db_wipe.py Utility to drop all tables and reset the DB
file_changer.sh Filesystem load generator
file_changer.ini Config: max dir size, chunk size, sleep interval, target path
wiper.sh Stops services, deletes logs/data, wipes DB, clears history

Configuration

All tunable parameters live in .ini files — no code changes needed to adjust behavior.

db_changer.ini defaults:

  • max_rows: 100,000
  • records_per_batch: 5,000
  • sleep_time: 30 seconds
  • Fields: name, age, email, city, created_at, is_active, description, random_number

file_changer.ini defaults:

  • MAX_SIZE: 10G
  • CHUNK_SIZE: 500M
  • SLEEP_TIME: 30 seconds
  • DIR: /opt/replisim/data

Design notes

  • Schema-flexible: db_changer.py reads field definitions from config and dynamically creates or migrates the MySQL table, including adding new columns to existing tables.
  • Bounded operation: Both tools implement rolling windows — the DB stays under max_rows and the directory stays under MAX_SIZE — so they run indefinitely without exhausting disk or database space.
  • Faker-backed: DB records use realistic fake data (names, emails, cities, dates, etc.) to more closely mimic real replication traffic.

Tech stack

  • Python 3 + mysql.connector + faker
  • Bash + dd + du
  • MySQL
  • systemd

About

Script to create a data replicating appliance to create disk loads to aid in DR application testing

Resources

Stars

Watchers

Forks

Contributors