Skip to content

Commit ba18fcc

Browse files
authored
Merge pull request #416 from databacker/update-docs-dbnames
update docs and comments to remove last vestiges of DB_NAMES
2 parents 84591c0 + b1e3d4c commit ba18fcc

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ __You should consider the [use of `--env-file=`](https://docs.docker.com/engine/
9494
* `DB_PORT`: port to use to connect to database. Optional, defaults to `3306`
9595
* `DB_USER`: username for the database
9696
* `DB_PASS`: password for the database
97-
* `DB_NAMES`: names of databases to restore separated by spaces. Required if `SINGLE_DATABASE=true`.
98-
* `SINGLE_DATABASE`: If is set to `true`, `DB_NAMES` is required and must contain exactly one database name. Mysql command will then run with `--database=$DB_NAMES` flag. This avoids the need of `USE <database>;` statement, which is useful when restoring from a file saved with `SINGLE_DATABASE` set to `true`.
97+
* `DB_DUMP_INCLUDE`: names of databases to restore separated by spaces. Required if `SINGLE_DATABASE=true`.
98+
* `SINGLE_DATABASE`: If is set to `true`, `DB_DUMP_INCLUDE` is required and must contain exactly one database name. Mysql command will then run with `--database=$DB_DUMP_INCLUDE` flag. This avoids the need of `USE <database>;` statement, which is useful when restoring from a file saved with `SINGLE_DATABASE` set to `true`.
9999
* `DB_RESTORE_TARGET`: path to the actual restore file, which should be a compressed dump file. The target can be an absolute path, which should be volume mounted, an smb or S3 URL, similar to the target.
100100
* `DB_DUMP_DEBUG`: if `true`, dump copious outputs to the container logs while restoring.
101101
* To use the S3 driver `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_DEFAULT_REGION` will need to be defined.
@@ -110,17 +110,17 @@ Examples:
110110
### Restore specific databases
111111
If you have multiple schemas in your database, you can choose to restore only some of them.
112112

113-
To do this, you must restore using `DB_NAMES` to specify the schemas you want restored.
113+
To do this, you must restore using `DB_DUMP_INCLUDE` to specify the schemas you want restored.
114114

115115
When doing this, schemas will be restored with their original name. To restore under other names, you must use `SINGLE_DATABASE=true` on both dump and restore, and you can only do it one schema at a time.
116116

117117
#### Examples:
118118
1. Dump a multi-schemas database and restore only some of them:
119119
* `docker run -e DB_SERVER=gotodb.example.com -e DB_USER=user123 -e DB_PASS=pass123 -v /local/path:/backup databack/mysql-backup dump `
120-
* `docker run -e DB_SERVER=gotodb.example.com -e DB_USER=user123 -e DB_PASS=pass123 -e DB_RESTORE_TARGET=/backup/db_backup_201509271627.gz -e DB_NAMES="database1 database3" -v /local/path:/backup databack/mysql-backup restore`
120+
* `docker run -e DB_SERVER=gotodb.example.com -e DB_USER=user123 -e DB_PASS=pass123 -e DB_RESTORE_TARGET=/backup/db_backup_201509271627.gz -e DB_DUMP_INCLUDE="database1 database3" -v /local/path:/backup databack/mysql-backup restore`
121121
2. Dump and restore a schema under a different name:
122-
* `docker run -e DB_SERVER=gotodb.example.com -e DB_USER=user123 -e DB_PASS=pass123 -e SINGLE_DATABASE=true -e DB_NAMES=database1 -v /local/path:/backup databack/mysql-backup dump`
123-
* `docker run -e DB_SERVER=gotodb.example.com -e DB_USER=user123 -e DB_PASS=pass123 -e DB_RESTORE_TARGET=/backup/db_backup_201509271627.gz -e SINGLE_DATABASE=true DB_NAMES=newdatabase1 -v /local/path:/backup databack/mysql-backup restore`
122+
* `docker run -e DB_SERVER=gotodb.example.com -e DB_USER=user123 -e DB_PASS=pass123 -e SINGLE_DATABASE=true -e DB_DUMP_INCLUDE=database1 -v /local/path:/backup databack/mysql-backup dump`
123+
* `docker run -e DB_SERVER=gotodb.example.com -e DB_USER=user123 -e DB_PASS=pass123 -e DB_RESTORE_TARGET=/backup/db_backup_201509271627.gz -e SINGLE_DATABASE=true DB_DUMP_INCLUDE=newdatabase1 -v /local/path:/backup databack/mysql-backup restore`
124124

125125
See [restore](./docs/restore.md) for a more detailed description of performing restores.
126126

docs/backup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ to a target. That target can be one of:
1313

1414
By default, all databases in the database server are backed up, and the system databases
1515
named `information_schema`, `performance_schema`, `sys` and `mysql` are excluded.
16-
For example, if you set `DB_NAMES_EXCLUDE=database1 db2` then these two databases will not be dumped.
16+
For example, if you set `DB_DUMP_EXCLUDE=database1 db2` then these two databases will not be dumped.
1717

1818
**Dumping just some databases**
1919

20-
* Environment variable: `DB_NAMES=db1,db2,db3`
20+
* Environment variable: `DB_DUMP_INCLUDE=db1,db2,db3`
2121
* CLI flag: `--include=db1 --include=db2 --include=db3`
2222
* Config file:
2323
```yaml
@@ -30,7 +30,7 @@ dump:
3030
3131
**Dumping all databases**
3232
33-
* Environment variable: `DB_NAMES=`
33+
* Environment variable: `DB_DUMP_INCLUDE=`
3434
* CLI flag: `--include=`
3535
* Config file:
3636
```yaml
@@ -42,7 +42,7 @@ Note that you do not need to set those explicitly; these are the defaults for th
4242

4343
**Dumping all databases except for one**
4444

45-
* Environment variable: `DB_NAMES_EXCLUDE=notme,notyou`
45+
* Environment variable: `DB_DUMP_EXCLUDE=notme,notyou`
4646
* CLI flag: `--exclude=notme,notyou`
4747
* Config file:
4848
```yaml

pkg/database/dump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func Dump(ctx context.Context, dbconn Connection, opts DumpOpts, writers []DumpW
2222
// all at once
2323
// mysqldump -A $MYSQLDUMP_OPTS
2424
// all at once limited to some databases
25-
// mysqldump --databases $DB_NAMES $MYSQLDUMP_OPTS
25+
// mysqldump --databases $DB_DUMP_INCLUDE $MYSQLDUMP_OPTS
2626
for _, writer := range writers {
2727
db, err := sql.Open("mysql", dbconn.MySQL())
2828
if err != nil {

0 commit comments

Comments
 (0)