User:DWalden (WMF)/Simulating database replication lag

From mediawiki.org
  1. Setup a local docker wiki which uses a replica database, follow these instructions: MediaWiki-Docker/Configuration_recipes/Alternative_databases#MariaDB_(database_replication)
  2. Access the replica database (e.g. run docker compose exec mariadb-replica mariadb -u root -p (password is main_root_password))
  3. To set a 10 second replication lag, run the SQL commands:
    STOP REPLICA;
    CHANGE MASTER TO MASTER_DELAY=10;
    START REPLICA;
    
  4. To remove the lag, run the commands:
    STOP REPLICA;
    CHANGE MASTER TO MASTER_DELAY=0;
    START REPLICA;