Skip to content

Commit 3898de7

Browse files
committed
Merge PR Drivetech#13 from upstream
2 parents 935c79c + 4ee3b29 commit 3898de7

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ docker run -d --name mongodump \
5353
lgatica/mongodump-s3
5454
```
5555

56-
### Inmediatic backup
56+
### Immediate backup
5757

5858
```bash
5959
docker run -d --name mongodump \
@@ -65,9 +65,9 @@ docker run -d --name mongodump \
6565
lgatica/mongodump-s3
6666
```
6767

68-
## IAM Policity
68+
## IAM Policy
6969

70-
You need to add a user with the following policies. Be sure to change `your_bucket` by the correct.
70+
You need to add a user with the following policies. Be sure to change `your_bucket` by the correct name.
7171

7272
```xml
7373
{
@@ -98,12 +98,19 @@ You need to add a user with the following policies. Be sure to change `your_buck
9898
}
9999
```
100100

101-
## Extra environmnet
101+
## Extra environment
102102

103103
- `S3_PATH` - Default value is `mongodb`. Example `s3://your_bucket/mongodb`
104104
- `MONGO_COMPLETE` - Default not set. If set doing backup full mongodb
105105
- `MAX_BACKUPS` - Default not set. If set doing it keeps the last n backups in /backup
106106
- `AWS_S3_ENDPOINT` - Default not set. You can use this for backing up to other s3 compatible storages
107+
- `BACKUP_NAME` - Default is `$(date -u +%Y-%m-%d_%H-%M-%S)_UTC.gz`. If set this is the name of the backup file. Useful when using s3 versioning. (Remember to place .gz extension on your filename)
108+
- `EXTRA_OPTIONS` - Default not set.
109+
110+
## Troubleshoot
111+
112+
1. If you get SASL Authentication failure, add `--authenticationDatabase=admin` to EXTRA_OPTIONS.
113+
2. If you get "Failed: error writing data for collection ... Unrecognized field 'snapshot'", add `--forceTableScan` to EXTRA_OPTIONS.
107114

108115
## License
109116

backup.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env sh
22

33
OPTIONS=`python /usr/local/bin/mongouri`
4-
BACKUP_NAME="$(date -u +%Y-%m-%d_%H-%M-%S)_UTC.gz"
4+
OPTIONS="$OPTIONS $EXTRA_OPTIONS"
5+
DEFAULT_BACKUP_NAME="$(date -u +%Y-%m-%d_%H-%M-%S)_UTC.gz"
6+
BACKUP_NAME=${BACKUP_NAME:-$DEFAULT_BACKUP_NAME}
57

68
# Run backup
79
mongodump ${OPTIONS} -o /backup/dump
@@ -27,4 +29,4 @@ if [ -n "${MAX_BACKUPS}" ]; then
2729
done
2830
else
2931
rm -rf /backup/*
30-
fi
32+
fi

0 commit comments

Comments
 (0)