All Projects → caosiyang → py-mongo-sync

caosiyang / py-mongo-sync

Licence: MIT license
Oplog-based data sync tool that synchronizes data from a replica set to another deployment, e.g.: standalone, replica set, and sharded cluster.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to py-mongo-sync

multihack-brackets
Realtime collaboration for programmers. (Brackets Extension)
Stars: ✭ 24 (-76.47%)
Mutual labels:  sync, realtime
node-v
🔒 Secure ❄️ Synchronized ⚡️ Realtime ☁️ Cloud 🌈 Native JavaScript Variables & Events
Stars: ✭ 27 (-73.53%)
Mutual labels:  sync, realtime
mongofluxd
Real time sync from MongoDB into InfluxDB
Stars: ✭ 33 (-67.65%)
Mutual labels:  sync, oplog
Realmcontent
Light Realm-powered content management system
Stars: ✭ 237 (+132.35%)
Mutual labels:  sync, realtime
Amazonriver
amazonriver 是一个将postgresql的实时数据同步到es或kafka的服务
Stars: ✭ 198 (+94.12%)
Mutual labels:  sync, realtime
Monstache
a go daemon that syncs MongoDB to Elasticsearch in realtime
Stars: ✭ 736 (+621.57%)
Mutual labels:  sync, realtime
twilio-taskrouter-realtime-dashboard
Twilio TaskRouter Realtime Dashboard using Sync
Stars: ✭ 51 (-50%)
Mutual labels:  sync, realtime
Realm Dotnet
Realm is a mobile database: a replacement for SQLite & ORMs
Stars: ✭ 927 (+808.82%)
Mutual labels:  sync, realtime
Realm Cocoa
Realm is a mobile database: a replacement for Core Data & SQLite
Stars: ✭ 14,778 (+14388.24%)
Mutual labels:  sync, realtime
Video-Engine-Dash
A Dash plugin for playing back video and optionally syncing video to timestamped CSV Data
Stars: ✭ 26 (-74.51%)
Mutual labels:  sync, realtime
NodeScalableArchitecture
A Scalable Node Architecture/Server. This repository contains a complete implementation of writing scalable nodejs server/architecture on my medium blog.
Stars: ✭ 62 (-39.22%)
Mutual labels:  mongo
readmeio-sync
↕️ A tool for syncing local markdown files to Readme.io
Stars: ✭ 18 (-82.35%)
Mutual labels:  sync
zoia2 old
Zoia CMS
Stars: ✭ 24 (-76.47%)
Mutual labels:  mongo
oh-migrations
Data migrations through implicit function composition at the type-level
Stars: ✭ 23 (-77.45%)
Mutual labels:  data-migration
AntSimulator
Simple Ants simulator
Stars: ✭ 1,939 (+1800.98%)
Mutual labels:  realtime
docker-mongo-auth
Easily setup authentication on Docker's Official MongoDB image.
Stars: ✭ 78 (-23.53%)
Mutual labels:  mongo
locize-cli
locize cli to import / export locales, add / edit / remove sync segments
Stars: ✭ 44 (-56.86%)
Mutual labels:  sync
SSE-Github
This repository contains the demo app for the blog
Stars: ✭ 17 (-83.33%)
Mutual labels:  realtime
CanSat-Ground-station
Code for a CanSat or OBCs GUI ground station where different sensor data are displayed in real time. No sensors needed to try it.
Stars: ✭ 55 (-46.08%)
Mutual labels:  realtime
aw-server-rust
High-performance implementation of the ActivityWatch server, written in Rust
Stars: ✭ 76 (-25.49%)
Mutual labels:  sync

py-mongo-sync

It synchronizes data from a replica set to another MongoDB deployment, e.g., standalone, replica set, and sharded cluster.

It's oplog-based and provides a realtime data synchronization.

It's written in Python 2.7.

Support

  • MongoDB 2.4
  • MongoDB 2.6
  • MongoDB 3.0
  • MongoDB 3.2
  • MongoDB 3.4

Features

  • initial sync and oplog based incremental sync
  • sync the specified databases and collections
  • concurrent oplog replaying

Requirements

See requirements for details.

  • gevent

  • toml

  • mmh3

  • pymongo

    Always use pymongo 3.5.1.

    Refer to https://api.mongodb.com/python/3.6.0/changelog.html

    Version 3.6 adds support for MongoDB 3.6, drops support for CPython 3.3 (PyPy3 is still supported), and drops support for MongoDB versions older than 2.6. If connecting to a MongoDB 2.4 server or older, PyMongo now throws a ConfigurationError.

Notice

  • source MUST be a replica set
  • ignore system databases
    • admin
    • local
  • ignore system collections
    • system.*
  • create users for destination manually if necessary
  • suggest to authenticate with administrator if source enabled authentication
  • not support geospatial index

if the source is a sharded cluster

  • first, stop the balancer
  • then, start a seprate sync process for each shard

Configurations

Use TOML as configuration file format.

Refer to mongo_conf.toml.

src

Source config items.

  • src.hosts - hostportstr of a member of replica set
  • src.username - username
  • src.password - password
  • src.authdb - authentiction database

dst

Destination config items.

  • dst.mongo.hosts
  • dst.mongo.authdb
  • dst.mongo.username
  • dst.mongo.password

sync

Custom options for synchronization.

sync.dbs specfies the databases to sync. sync.dbs.colls specifies the collections to sync.

  • sync.dbs - databases to sync, sync all databases if not specify
    • sync.dbs.db - source database name
    • sync.dbs.rename_db - destination database name, stay the same if not specify
    • sync.dbs.colls - collectons to sync, sync all collections if not specify

coll in sync.dbs.colls element specifies the collection to sync. fileds in sync.dbs.colls element specifies the fields of current collection to sync.

log

  • log.filepath - log file path, write to stdout if empty or not set

Usage

Command options has functional limitations. It's strongly recommended that use config file.

sync

usage: sync.py [-h] [-f [CONFIG]] [--src [SRC]] [--src-authdb [SRC_AUTHDB]]
               [--src-username [SRC_USERNAME]] [--src-password [SRC_PASSWORD]]
               [--dst [DST]] [--dst-authdb [DST_AUTHDB]]
               [--dst-username [DST_USERNAME]] [--dst-password [DST_PASSWORD]]
               [--start-optime [START_OPTIME]]
               [--optime-logfile [OPTIME_LOGFILE]] [--logfile [LOGFILE]]

Sync data from a replica-set to another MongoDB/Elasticsearch.

optional arguments:
  -h, --help            show this help message and exit
  -f [CONFIG], --config [CONFIG]
                        configuration file, note that command options will
                        override items in config file
  --src [SRC]           source should be hostportstr of a replica-set member
  --src-authdb [SRC_AUTHDB]
                        src authentication database, default is 'admin'
  --src-username [SRC_USERNAME]
                        src username
  --src-password [SRC_PASSWORD]
                        src password
  --dst [DST]           destination should be hostportstr of a mongos or
                        mongod instance
  --dst-authdb [DST_AUTHDB]
                        dst authentication database, default is 'admin', for
                        MongoDB
  --dst-username [DST_USERNAME]
                        dst username, for MongoDB
  --dst-password [DST_PASSWORD]
                        dst password, for MongoDB
  --start-optime [START_OPTIME]
                        timestamp in second, indicates oplog based increment
                        sync
  --optime-logfile [OPTIME_LOGFILE]
                        optime log file path, use this as start optime if
                        without '--start-optime'
  --logfile [LOGFILE]   log file path

TODO List

  • command options tuning
  • config file format tuning
  • sync sharding config (enableSharding & shardCollection)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].