Tech:Moving a wiki to another database server

    From Miraheze Meta, Miraheze's central coordination wiki

    This page provides guidance if you need to move a wiki to another database server (typically relates to disk space issues/imbalances).

    Moving a wiki to another database is not complicated provided you have the required rights (SRE, root on the db servers).

    1. Put the wiki you are moving into read-only mode (add a read-only notice if you'd like, especially if it is a large wiki, and it will take time).
    2. Connect to the server on which the database is located and as root execute:
      mysqldump --single-transaction --routines --triggers nameofwiki | gzip -c | ssh -i /home/dbcopy/.ssh/id_ed25519 'cat > /home/dbcopy/nameofwiki.sql.gz'
      Pictogram voting info.svg Note: Replace "nameofwiki" with the name of the wiki you want to move.
    3. Open the target server and unzip the file.
      gunzip nameofwiki.sql.gz
    4. Execute creation of the new database.
      mysql -e 'create database nameofwiki;'
    5. Import the database.
      mysql nameofwiki < nameofwiki.sql
    6. Change wiki_dbcluster in metawiki.cw_wikis.
    7. Remove read-only mode from the wiki.
    8. After you have made sure that the wiki works on the new database server and that it has been imported correctly, you can drop the database on the initial server.