Changes between Initial Version and Version 1 of network-mysql-transition


Ignore:
Timestamp:
Nov 2, 2018, 6:18:14 PM (7 years ago)
Author:
Jamie McClelland
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • network-mysql-transition

    v1 v1  
     1= Network MySQL transition =
     2
     3We are in the process of transitioning all MySQL databases from being run on the MOSH they server and only accessible via localhost, to be running on one of a few dedicated MySQL servers that are backed by solid state drives (see ticket #13886 to track progress).
     4
     5This page documents how to transition a MOSH from using localhost to a database server.
     6
     7== Overview ==
     8
     9The script to perform this tasks resides on your local workstation - it's in our puppet repo in the helpers folder and is called: `mf-mysql-move-to-network-server`
     10
     11It is run from your workstation because you have to login to multiple servers to complete this task and we don't want to grant that access to other servers if we can help it.
     12
     13The script operates on a entire mosh at a time because keeping track of which mysql users go with which mysql databases (and also the fact that many databases are stored in hosting orders that they are not configured to work with) is far too difficult.
     14
     15The first step: collect information and try to give suggestions for cleaning up. If there are any empty databases or mysql users not assigned to any database, you will be given an opportunity to purge them properly (via deletion via the control panel in an automated way).
     16
     17Next, the script iterates over the remaining databases and tries to find known configuration files (settings.php, wp-config.php, etc) that contain the database name. It builds out a directory on the host with a file for each database that contains each configuration file found, plus a file with the database name followed by ".modified" that contains the date of the newest table's last modification time.
     18
     19The script then rsync's this data to your workstation. Once the data is on your workstation, you can re-run it over and over and point to this data and avoid going through the time-consuming reporting phase.
     20
     21The last step is to iterate over each database found. The script tells you how many configuration files it found and also the date it was last modified. You can choose whether to move it to the network database server or not.
     22
     23Here's a guide for making the decision:
     24
     25 * If there are no found configuration files and it hasn't been modified in more than a year, don't move it
     26 * If there are no found configuration files and it has been modified recently, then you'll have to dig through the server to find the configuration files and move it over
     27 * If there are configuration files and it hasn't been modified in over a year, it's a judgement call
     28
     29If you choose to move a database, you get a step by step process of:
     30
     31 1. Update item in the control panel (and associated mysql users)
     32 2. Add new DNS record (<dbname>.db.mayfirst.cx)
     33 3. Run `red-node-update` on both lumumba and tubman to make all items active
     34 4. Dump database on host, scp to lumumba and import it
     35
     36At any time you can say no and ctl-c to cancel and start again.
     37
     38== The details ==
     39
     40You can invoke the script with:
     41
     42{{{
     43./helper/mf-mysql-move-to-network-server <moshname>
     44}}}
     45
     46After you have run it once with a mosh and have downloaded the data, you can re-run with:
     47
     48{{{
     49./helper/mf-mysql-move-to-network-server <moshname> /path/to/data
     50}}}
     51
     52For example, the first run might be:
     53
     54{{{
     55./helper/mf-mysql-move-to-network-server octavia
     56}}}
     57
     58The output from the script will report the local path used to download the data, so the next time you can run:
     59
     60{{{
     61./helper/mf-mysql-move-to-network-server octavia /tmp/tmp.Dkf21fJ
     62}}}