Beispiel #1
0
def main():
    conf = CommandOptions.parse()
    Logger.init(conf.logfilepath)
    log = Logger.get()

    conf.info(log)
    if conf.logfilepath:
        conf.info(sys.stdout)

    if isinstance(conf.dst_conf, MongoConfig):
        from mongosync.mongo.syncer import MongoSyncer
        syncer = MongoSyncer(conf)
        syncer.run()
    elif isinstance(conf.dst_conf, EsConfig):
        from mongosync.es.syncer import EsSyncer
        syncer = EsSyncer(conf)
        syncer.run()
    else:
        raise Exception('invalid config type')

    log.info('exit')
Beispiel #2
0
# summary: MongoDB sync tool
# author: caosiyang
# date: 2013/09/16

from gevent import monkey
monkey.patch_all()

import sys
from mongosync.command_options import CommandOptions
from mongosync.config import MongoConfig, EsConfig
from mongosync.logger import Logger

if __name__ == '__main__':
    conf = CommandOptions.parse()
    Logger.init(conf.logfilepath)
    log = Logger.get()
    conf.info(log)
    if conf.logfilepath:
        conf.info(sys.stdout)

    if isinstance(conf.dst_conf, MongoConfig):
        from mongosync.mongo.syncer import MongoSyncer
        syncer = MongoSyncer(conf)
        syncer.run()
    elif isinstance(conf.dst_conf, EsConfig):
        from mongosync.es.syncer import EsSyncer
        syncer = EsSyncer(conf)
        syncer.run()
    else:
        raise Exception('invalid config type')
Beispiel #3
0
# summary: MongoDB sync tool
# author: caosiyang
# date: 2013/09/16

import pymongo
from mongosync.mongo_synchronizer import MongoSynchronizer
from mongosync.command_options import CommandOptions
from mongosync.logger import Logger
from mongosync.mongo_helper import get_version

if __name__ == '__main__':
    opts = CommandOptions()
    opts.parse()

    Logger.init(opts.logfilepath)

    logger = Logger.get()
    logger.info('================================================')
    logger.info('src hostportstr :  %s' % opts.src_hostportstr)
    logger.info('src engine      :  %s' % opts.src_engine)
    logger.info('src db version  :  %s' % get_version(opts.src_host, opts.src_port))
    if opts.src_username or opts.src_password:
        logger.info('src authdb      :  %s' % opts.src_authdb)
    else:
        logger.info('src authdb      :  ')
    logger.info('src username    :  %s' % opts.src_username)
    logger.info('src password    :  %s' % opts.src_password)
    logger.info('dst hostportstr :  %s' % opts.dst_hostportstr)
    logger.info('dst db version  :  %s' % get_version(opts.dst_host, opts.dst_port))
    if opts.dst_username or opts.dst_password: