MariaDB/Clone a host
Appearance
< MariaDB
Derived from MariaDB/Provisioning a host
Good to know before starting
Please be sure to be aware of the following page(s):
- MariaDB/Start and stop - This will come in handy if you have trouble with any hosts you're currently managing
Host preparation
Here is an overview of what a host depends on:

Move the host in the right groups with the right role
Only required if the host is new or it is changing its section
- In
manifests/site.pp:- Add the DBNAME to the appropriate regexps
- Remove the
insetuprole from DBNAME
- In
hieradata/hosts/$destination_host.yamladd the configuration content ofhieradata/hosts/$source_host.yaml. You can check this example if needed. - If the host is new, you'll have to run puppet on the host before running the cookbook below.
Add the host to dbctl config (example)
Only required if the host is new
In conftool-data/dbconfig-instance/instances.yaml add - DBNAME in the appropriate location and then run dbctl commit command on cumin
- Merge the change to puppet and then
puppet-mergeon the Puppet master - Check that the new host is present in dbctl using
dbctl instance <DBNAME> get - Edit the instance's config using
dbctl instance <DBNAME> edit - Commit the change using
dbctl config commit -m <commit_message>
Cloning
The sre.mysql.clone cookbook will:
- Ensure the new host is configured in dbctl and puppet
- Depool the source and target servers
- Disable icinga monitoring for the target
- Clone the source to target
- Wait for replication and icinga monitoring to normalize
- Pool-in the servers (default)
- Add the new host to zarcillo
See --help for more and try --dry-run on first use.
Clone via the sre.mysql.clone cookbook in a tmux/screen:
sudo cookbook sre.mysql.clone --source <source_fqdn> --target <destination_fqdn> --task <task_id>
Example: db1190 will be recloned from db1180 and will be configured to replicate from db1173.eqiad.wmnet
sudo cookbook sre.mysql.clone --source db1180.eqiad.wmnet --target db1190.eqiad.wmnet --task T1234
Monitor the run output
After a few days of uptime
If required (i.e. upon decomissionning) and if everything works properly, we can now depool our old host (from any cumin host):
sudo cookbook sre.mysql.depool -t $TASKID -r "Decommissioning $HOST" $HOST
We will also repool the new host (from any cumin host):
sudo cookbook sre.mysql.pool -t $TASKID -r "Pooling $HOST after cloning" $HOST