You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration.md
+103-6Lines changed: 103 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,15 +66,15 @@ The following are the environment variables, CLI flags and configuration file op
66
66
| port to use to connect to database. Optional. | BR | `port` | `DB_PORT` | `database.port` | 3306 |
67
67
| username for the database | BR | `user` | `DB_USER` | `database.credentials.username` | |
68
68
| password for the database | BR | `pass` | `DB_PASS` | `database.credentials.password` | |
69
-
| names of databases to dump, comma-separated | B | `include` | `DB_NAMES` | `database.include` | all databases in the server |
70
-
| names of databases to exclude from the dump | B | `exclude` | `DB_NAMES_EXCLUDE` | `database.exclude` | |
71
-
| do not include `USE <database>;` statement in the dump | B | `no-database-name` | `NO_DATABASE_NAME` | `database.no-database-name` | `false` |
69
+
| names of databases to dump, comma-separated | B | `include` | `DB_NAMES` | `dump.include` | all databases in the server |
70
+
| names of databases to exclude from the dump | B | `exclude` | `DB_NAMES_EXCLUDE` | `dump.exclude` | |
71
+
| do not include `USE <database>;` statement in the dump | B | `no-database-name` | `NO_DATABASE_NAME` | `dump.no-database-name` | `false` |
72
72
| restore to a specific database | R | `restore --database` | `RESTORE_DATABASE` | `restore.database` | |
73
73
| how often to do a dump or prune, in minutes | BP | `dump --frequency` | `DB_DUMP_FREQ` | `dump.schedule.frequency` | `1440` (in minutes), i.e. once per day |
74
74
| what time to do the first dump or prune | BP | `dump --begin` | `DB_DUMP_BEGIN` | `dump.schedule.begin` | `0`, i.e. immediately |
75
75
| cron schedule for dumps or prunes | BP | `dump --cron` | `DB_DUMP_CRON` | `dump.schedule.cron` | |
76
76
| run the backup or prune a single time and exit | BP | `dump --once` | `RUN_ONCE` | `dump.schedule.once` | `false` |
| where to put the dump file; see [backup](./backup.md) | BP | `dump --target` | `DB_DUMP_TARGET` | `dump.targets` | |
79
79
| where the restore file exists; see [restore](./restore.md) | R | `restore --target` | `DB_RESTORE_TARGET` | `restore.target` | |
80
80
| replace any `:` in the dump filename with `-` | BP | `dump --safechars` | `DB_DUMP_SAFECHARS` | `database.safechars` | `false` |
@@ -89,6 +89,103 @@ The following are the environment variables, CLI flags and configuration file op
89
89
| filename to save the target backup file | B | `dump --filename-pattern` | `DB_DUMP_FILENAME_PATTERN` | `dump.filename-pattern` | |
90
90
| directory with scripts to execute before backup | B | `dump --pre-backup-scripts` | `DB_DUMP_PRE_BACKUP_SCRIPTS` | `dump.scripts.pre-backup` | in container, `/scripts.d/pre-backup/` |
91
91
| directory with scripts to execute after backup | B | `dump --post-backup-scripts` | `DB_DUMP_POST_BACKUP_SCRIPTS` | `dump.scripts.post-backup` | in container, `/scripts.d/post-backup/` |
92
-
| directory with scripts to execute before restore | R | `restore --pre-restore-scripts` | `DB_DUMP_PRE_RESTORE_SCRIPTS` | `dump.pre-restore-scripts` | in container, `/scripts.d/pre-restore/` |
93
-
| directory with scripts to execute after restore | R | `restore --post-restore-scripts` | `DB_DUMP_POST_RESTORE_SCRIPTS` | `dump.post-restore-scripts` | in container, `/scripts.d/post-restore/` |
92
+
| directory with scripts to execute before restore | R | `restore --pre-restore-scripts` | `DB_DUMP_PRE_RESTORE_SCRIPTS` | `restore.pre-restore-scripts` | in container, `/scripts.d/pre-restore/` |
93
+
| directory with scripts to execute after restore | R | `restore --post-restore-scripts` | `DB_DUMP_POST_RESTORE_SCRIPTS` | `restore.post-restore-scripts` | in container, `/scripts.d/post-restore/` |
94
94
| retention policy for backups | BP | `dump --retention` | `RETENTION` | `prune.retention` | Infinite |
95
+
96
+
## Configuration File
97
+
98
+
### Format
99
+
100
+
The config file is a YAML file. You can write the yaml configuration file by hand. Alternatively, you can use an online service
101
+
to generate one for you. Referenced services will be listed here in the future.
102
+
103
+
The keys are:
104
+
105
+
* `version`: the version of configuration, must be `config.databack.io/v1`
106
+
* `kind`: the kind of configuration, must be one of:
107
+
* `local`: local configuration
108
+
* `remote`: remote configuration
109
+
* `metadata`: metadata about the configuration. Not required. Used primarily for validating or optional information.
110
+
* `name` (optional): the name of the configuration
111
+
* `description` (optional): a description of the configuration
112
+
* `digest` (optional): the digest of the configuration, excluding the `digest` key itself. Everything else, including optional metadata, is included.
113
+
* `created` (optional): the date the configuration was created in [ISO8601 date format](https://en.wikipedia.org/wiki/ISO_8601), e.g. `2021-01-01T00:00:00Z`. The timezone always should be `Z` for UTC.
114
+
* `spec`: the specification. Varies by the `kind` of configuration.
115
+
116
+
The contents of `spec` depend on the kind of configuration.
117
+
118
+
#### Local Configuration
119
+
120
+
For local configuration, the `spec` is composed of the following. See the [Configuration Options](#configuration-options)
121
+
for details of each.
122
+
123
+
* `dump`: the dump configuration
124
+
* `include`: list of tables to include
125
+
* `exclude`: list of tables to exclude
126
+
* `safechars`: safe characters in filename
127
+
* `no-database-name`: remove `USE <database>` from dumpfile
128
+
* `schedule`: the schedule configuration
129
+
* `frequency`: the frequency of the schedule
130
+
* `begin`: the time to begin the schedule
131
+
* `cron`: the cron schedule
132
+
* `once`: run once and exit
133
+
* `compression`: the compression to use
134
+
* `compact`: compact the dump
135
+
* `max-allowed-packet`: max packet size
136
+
* `filename-pattern`: the filename pattern
137
+
* `scripts`:
138
+
* `pre-backup`: path to directory with pre-backup scripts
139
+
* `post-backup`: path to directory with post-backup scripts
140
+
* `targets`: list of names of known targets, defined in the `targets` section, where to save the backup
141
+
* `restore`: the restore configuration
142
+
* `scripts`:
143
+
* `pre-restore`: path to directory with pre-restore scripts
144
+
* `post-restore`: path to directory with post-restore scripts
145
+
* `database`: the database configuration
146
+
* `server`: host:port
147
+
* `port`: port (deprecated)
148
+
* `credentials`: access credentials for the database
149
+
* `username`: user
150
+
* `password`: password
151
+
* `prune`: the prune configuration
152
+
* `retention`: retention policy
153
+
* `targets`: target configurations, each of which can be reference by other sections. Key is the name of the target that is referenced elsewhere. Each one has the following structure:
154
+
* `type`: the type of target, one of: file, s3, smb
155
+
* `url`: the URL of the target
156
+
* `details`: access details for the target, depends on target type:
157
+
* Type s3:
158
+
* `region`: the region
159
+
* `endpoint`: the endpoint
160
+
* `access-key-id`: the access key ID (s3)
161
+
* `secret-access-key`: the secret access key (s3)
162
+
* Type smb:
163
+
* `domain`: the domain (smb)
164
+
* `username`: the username (smb)
165
+
* `password`: the password (smb)
166
+
* `logging`: the log level, one of: error,warning,info,debug,trace; default is info
167
+
* `telemetry`: configuration for sending telemetry data (optional)
168
+
* `url`: URL to telemetry service
169
+
* `certificate`: the certificate for the telemetry server or a CA that signed the server's TLS certificate. Not required if telemetry server does not use TLS, or if the system's certificate store already contains the server's cert or CA.
170
+
* `credentials`: unique token provided by the remote service as credentials, base64-encoded
171
+
172
+
#### Remote Configuration
173
+
174
+
For remote configuration, the `spec` is composed of the following:
175
+
176
+
* `url`: the URL of the remote configuration; required
177
+
* `certificate`: the certificate for the server or a CA that signed the server's TLS certificate. Not required if remote server does not use TLS, or if the system's certificate store already contains the server's cert or CA.
178
+
* `credentials`: unique token provided by the remote service as credentials, base64-encoded
179
+
180
+
The configuration file retrieved from a remote **always** has the same structure as any config file. It even can be
181
+
saved locally and used as a local configuration. This means it also can
182
+
reference another remote configuration, just like a local one. That can in turn reference another
183
+
and so on, ad infinitum. In practice, remote service will avoid this.
184
+
185
+
### Multiple Configurations
186
+
187
+
As of version 1.0 of `mysql-backup`, there is support only for one config file. This means:
188
+
189
+
* The `--config` flag can be used only once.
190
+
* The config file does not support [multiple yaml documents in a single file](https://yaml.org/spec/1.2.2/). If you ask it to read a yaml file with multiple documents sepaarted by `---`, it will read only the first one.
191
+
* You can have chaining, as described in the [remote configuration](#remote-configuration) section, where one file of kind `remote` references another, which itself is `remote`, etc. But only the final one will be used. It is not merging.
0 commit comments