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
Service to backup and/or restore mysql databases using S3
2
+
Service to backup and/or restore mysql databases to/from S3
3
3
4
4
## How to use it
5
5
1. Create an S3 bucket to hold your backups
@@ -8,34 +8,45 @@ Service to backup and/or restore mysql databases using S3
8
8
4. Run a backup and check your bucket for that backup
9
9
10
10
### Environment variables
11
-
`MODE=[backup|restore]`
11
+
`MODE` Valid values: `backup`, `restore`
12
12
13
-
`DB_NAMES=name1 name2 name3 ...`
13
+
`DB_NAMES` list of the database names
14
14
15
-
`MYSQL_USER=`
15
+
`MYSQL_USER` user that accesses the database
16
16
17
-
`MYSQL_PASSWORD=`
17
+
`MYSQL_PASSWORD` password for the `MYSQL_USER`
18
18
19
-
`MYSQL_DUMP_ARGS=` (optional) additional arguments to the mysqldump command, e.g., `--max_allowed_packet=50M`
19
+
`MYSQL_DUMP_ARGS` (optional) additional arguments to the mysqldump command, e.g., `--max_allowed_packet=50M`
20
20
21
-
`AWS_ACCESS_KEY=` used for S3 interactions
21
+
`AWS_ACCESS_KEY` used for S3 interactions
22
22
23
-
`AWS_SECRET_KEY=` used for S3 interactions
23
+
`AWS_SECRET_KEY` used for S3 interactions
24
24
25
-
`S3_BUCKET=`_e.g., s3://database-backups_**NOTE: no trailing slash**
25
+
`S3_BUCKET` e.g., _s3://database-backups_**NOTE: no trailing slash**
26
26
27
27
>**It's recommended that your S3 bucket have versioning turned on.**
28
28
29
29
## Docker Hub
30
-
This image is built automatically on Docker Hub as [silintl/mysql-backup-restore](https://hub.docker.com/r/silintl/mysql-backup-restore/)
30
+
This image is built automatically on Docker Hub as [silintl/mysql-backup-restore](https://hub.docker.com/r/silintl/mysql-backup-restore/).
31
31
32
32
## Playing with it locally
33
-
You'll need [Docker](https://www.docker.com/get-docker) and [Make](https://www.gnu.org/software/make/)
34
-
35
-
1.`cp local.env.dist local.env` and supply variables
36
-
2. Ensure you have a `gz` dump in your S3 bucket to be used for testing. A test database is provided as part of this project in the `test` folder.
37
-
3.`make`
38
-
39
-
A UI into the local database will then be running at [http://localhost:8001](http://localhost:8001)
40
-
41
-
A couple of test databases are provided in the `test` folder if needed.
33
+
You'll need [Docker](https://www.docker.com/get-docker), [Docker Compose](https://docs.docker.com/compose/install/), and [Make](https://www.gnu.org/software/make/).
34
+
35
+
1. cd .../mysql-backup-restore
36
+
2. mkdir ./mybackups
37
+
3. cp -p test/world.sql.gz ./mybackups
38
+
4.`make db` # creates the MySQL DB server
39
+
5.`make restore` # restores the DB dump file
40
+
6.`docker ps -a` # get the Container ID of the exited restore container
41
+
7.`docker logs <containerID>` # review the restoration log messages
42
+
8.`make backup` # create a new DB dump file
43
+
9.`docker ps -a` # get the Container ID of the exited backup container
44
+
10.`docker logs <containerID>` # review the backup log messages
45
+
11.`make restore` # restore the DB dump file from the new backup
46
+
12.`docker ps -a` # get the Container ID of the exited restore container
47
+
13.`docker logs <containerID>` # review the restoration log messages
48
+
14.`make clean` # remove containers and network
49
+
15.`docker volume ls` # find the volume ID of the MySQL data container
50
+
16.`docker volume rm <volumeID>` # remove the data volume
0 commit comments