mongodb跨数据中心备份-mongoshake

可以使用mongoshake工具进行备份。

You can use the mongoshake utility for backups.

 

地址为:GitHub - alibaba/MongoShake: MongoShake is a universal data replication platform based on MongoDB's oplog. Redundant replication and active-active replication are two most important functions. 基于mongodb oplog的集群复制工具,可以满足迁移和同步的需求,进一步实现灾备和多活功能。

GitHub- alibaba/MongoShake: MongoShake is a universal data replication platform based on MongoDB's oplog. Redundant replication and active-active replication are two most important functions. The cluster replication tool based on mongodb oplog can meet the requirements of migration and synchronization, and further realize disaster recovery and multi-activity functions.

mongodbShake可以应用在实例间复制,机房间、跨数据中心复制。

MongodbShake can be used for inter-instance replication, inter-machine room replication, and cross-data center replication.

mongodbshake是通过读取MongoDB集群的Oplog操作日志,对MongoDB的数据进行复制,后续通过操作日志实现特定需求。

Mongodbshake is to copy the data of MongoDB by reading the Oplog operation log of MongoDB cluster, and then realize specific requirements through the operation log.

下载mongoshake安装包:

Download the mongoshake installation package:

GitHub - alibaba/MongoShake: MongoShake is a universal data replication platform based on MongoDB's oplog. Redundant replication and active-active replication are two most important functions. 基于mongodb oplog的集群复制工具,可以满足迁移和同步的需求,进一步实现灾备和多活功能。

GitHub - alibaba/MongoShake: MongoShake is a universal data replication platform based on MongoDB's oplog. Redundant replication and active-active replication are two most important functions. The cluster replication tool based on mongodb oplog can meet the requirements of migration and synchronization, and further realize disaster recovery and multi-activity functions.

解压:

Decompression:

tar zxf mongo-shake-v2.7.4.tgz

cd mongo-shake-v2.7.4/

内容如下所示:

The contents are as follows:

修改collector.conf文件(针对有密码验证的情况):

Modify the collector.conf file (with password authentication):

修改

modification

mongo_urls,代表源端mongo

mongo_urls, representing the source mongo

tunnel.address  目的端mongo

tunnel.address  destination mongo

sync_mode = all (视情况而定,有all 全量+增量同步,full表示全量同步,incr表示增量同步)

sync_mode = all (depending on the situation, there are all full + incremental synchronization, full means full synchronization, incr means incremental synchronization)

filter.pass.special.db = admin   

#指定特殊的namespace通过,比如admin,system.views,mongoshake,config。正常情况下,这几个都会被过滤,但是有可能有比较特殊的情况,例如,由于历史原因,用户的数据写入到admin库了,现在希望对这部分数据也进行同步,那么就可以执行filter.pass.special.db=admin。默认空。

#Specify special namespaces via, for example, admin, system.views, mongoshake, config. Under normal circumstances, these data will be filtered, but there may be special cases. For example, due to historical reasons, the user's data has been written into the admin library, and now you want to synchronize this part of data, you can execute filter.pass.special.db =admin. Default is empty.

格式如下:

The format is as follows:

备注:需要注意,源端与目的端的账号需要对mongo里面的库有全部权限(可以把权限设置为root)

Note: Note that the accounts of the source and destination terminals need to have all permissions on the libraries in mongo (the permissions can be set to root).

启动mongoshake

Start mongoshake

nohub ./collector.linux -conf ./collector.conf &

mongoshake的配置文件

Configuration file for mongoshake

(2.4版本之后mongoshake参考如下配置文件释义)

(After version 2.4, refer to the following configuration file for explanation of mongoshake)

配置参数说明 · alibaba/MongoShake Wiki · GitHub

· alibaba/MongoShake Wiki · GitHub

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值