Skip to content
Snippets Groups Projects
Commit 90f398d3 authored by jurgenhaas's avatar jurgenhaas
Browse files

docker/l3d#74 Move all documentation to devops-tools doc

parent 2f07a2f1
No related branches found
No related tags found
No related merge requests found
Default values for MySQL configuration: https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
# MySQL
Use http://www.mysqlcalculator.com to calculate settings depending on your host configuration.
# Configure Backups
By default we install automatic MySQL backups pre-configured with rotating daily, weekly and monthly backups which will be stored in `/var/backups/mysql`. Those backups will be done at 2am every day by a cron task.
In [defaults/main.yml](/defaults/main.yml) you'll find a variable `mysqlbackup` with all the default values being defined and if you want to change those, copy that into your inventory and make the changes there.
## Special note on excluding tables
By default no tables are excluded. You can define a list of excluded tables in `mysqlbackup.exclude.table` where each item in the list must be defined in the format `dbname.tablename` and the tablename accepts wildcards, e.g. `mydb.cache*` to exclude all tables that start with `cache` in their name.
## Configuring Drupal databases
The [Drupal role](https://gitlab.lakedrops.com/ansible-roles/drupal) defines databases for each domain in a variable named `drupal_settings.ITEM.domains.DOMAIN.db` and inside of this dictionary you can either turn off MySQL backup for that database completely by adding `backup: false` or you can exclude certain tables by adding a list in `backup_exclude` with table names supporting wildcards as well. Note, you don't have to provide the db name here as we have already defined that once before.
Examples:
```
drupal_settings:
- ...
domains:
- ...
db:
...
backup: false
- ...
db:
...
backup_exclude:
- cache*
- access*
```
# Replcation
- [Replication Configuration](https://dev.mysql.com/doc/refman/5.7/en/replication.html)
- [Replication SQL Statements](https://dev.mysql.com/doc/refman/5.7/en/sql-replication-statements.html)
## Setting up a new replication
Starting from [here](https://dev.mysql.com/doc/refman/5.7/en/replication-howto-masterstatus.html) there are basically these steps:
- Create a DB dump: lock tables, remember bin log position, dump db (see [Choosing a Method for Data Snapshots](https://dev.mysql.com/doc/refman/5.7/en/replication-snapshot-method.html)) and copy to secondary host
- Unlock the tables again
- Configure secondary for new master with Ansible playbook `dans COMPANY mysqlsecondary --tags=changemaster --extra-vars="port=[PORT]" --extra-vars="binpos=[BINLOGPOS]"`
- On the secondary, start the MySQL server and turn off replication (`stop slave`)
- Import dump file and then start replication again (`start slave`)
You find all the details in the [full documentation](https://devops-tools.docs.lakedrops.com/ansible/roles/mysql/).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment