############################################
安装环境:
Building the project requires: Go 1.11 or 更高版本 make git krb5-devel for Red Hat Enterprise Linux / CentOS or libkrb5-dev for Debian / Ubuntu. This package is required for Kerberos authentication in Percona Server for MongoDB.
编译安装:
$ https://github.com/percona/percona-backup-mongodb.git $ cd percona-backup-mongodb $ make build
查看pbm的版本信息
[work@xxx pbm]$ ./pbm version Version: Platform: linux/amd64 GitCommit: c2a65ad2480ce60fdb13802dbded99b2b8d29447 GitBranch: master BuildTime: 2020-09-04_08:27_UTC GoVersion: go1.13.3
在mongodb的副本集的主库上创建备份账号和密码:
开启备份监听的agent:
$ ./pbm-agent --mongodb-uri="mongodb://pbm_user:123456@127.0.0.1:28000/?replicaSet=apple" &> pbm-agent.28000.log
配置备份目的地:
$ ./pbm config --file=storage_conf.yaml --mongodb-uri="mongodb://pbm_user:123456@127.0.0.1:28000/?replicaSet=apple"
$ cat storage_conf.yaml storage: fds: bucket: apple.imac credentials: access-key-id: 345543543543 secret-access-key: fdfsdfsfdsfdsf endpointUrl: fdfdf.fertregsdf.fefwedffg prefix: dfdfsdf/ region: fsdfsdfs type: fds
开始备份:
$ ./pbm backup --mongodb-uri="mongodb://pbm_user:123456@127.0.0.1:28000/?replicaSet=apple" &> pbm.28000.log
查看备份情况:
$ ./pbm list --mongodb-uri="mongodb://pbm_user:123456@127.0.0.1:28000/?replicaSet=apple" Backup history: 2020-08-01T00:01:03+08:00 2021-07-03T00:10:51+08:00 2021-07-05T00:10:44+08:00 2021-07-07T00:11:00+08:00
#######################################