mongodb备份服务

animeic 6baa4514ea add wwlacke 1 gadu atpakaļ
config 6baa4514ea add wwlacke 1 gadu atpakaļ
format-backup-file ba92f17e17 update 1 gadu atpakaļ
docker-compose.yaml 1030ed66b5 change backup dir 1 gadu atpakaļ
readme.md 2819945ff6 update readme.md 1 gadu atpakaļ

readme.md

数据库备份

文档:https://github.com/stefanprodan/mgob

使用

  1. 在config/添加配置 config/3dshow.yaml
  2. 启动服务:docker-compose up -d

webapi

mgob-host:8090/storage file server
mgob-host:8090/status backup jobs status
mgob-host:8090/metrics Prometheus endpoint
mgob-host:8090/version mgob version and runtime info
mgob-host:8090/debug pprof endpoint

恢复数据

  1. 进入容器 docker exec -it mongo-backup sh
  2. 恢复命令 mongorestore --gzip --archive=/storage/local-3dshow/local-3dshow1-1668757800.gz --host 3dshow-mongo:27017 --drop -u root -p 3dshow --authenticationDatabase admin

格式化备份文件

cd ./format-backup-file

go build -o format-backup-file

chmod +x format-backup-file

sh format-backup-file