caosiyang / py-mongo-sync

Oplog-based data sync tool that synchronizes data from a replica set to another deployment, e.g.: standalone, replica set, and sharded cluster.
http://caosiyang.github.io/py-mongo-sync/
MIT License
108 stars 46 forks source link

Mongodb 4 can't connect error #17

Closed luantruong closed 6 years ago

luantruong commented 6 years ago

When I sync between 2 mongodb 4.0, the error is rised.

Traceback (most recent call last):
  File "./sync.py", line 28, in <module>
    syncer = MongoSynchronizer(conf)
  File "/localsrc/script/mongo-sync/mongosync/mongo_synchronizer.py", line 28, in __init__
    raise Exception('connect to mongodb(src) failed: %s' % self._conf.src_hostportstr)
Exception: connect to mongodb(src) failed:
luantruong commented 6 years ago
2018-07-20 10:15:44,221 INFO src hostportstr :  XXXXXXXXX:27017
2018-07-20 10:15:44,221 INFO src authdb      :  admin
2018-07-20 10:15:44,221 INFO src username    :  root
2018-07-20 10:15:44,221 INFO src password    :  XXXXX
2018-07-20 10:15:45,722 INFO src db version  :  4.0.0
2018-07-20 10:15:45,722 INFO dst hostportstr :  YYYYYYYYY:27017
2018-07-20 10:15:45,722 INFO dst authdb      :  admin
2018-07-20 10:15:45,722 INFO dst username    :  root
2018-07-20 10:15:45,722 INFO dst password    :  YYYYYYYY
2018-07-20 10:15:45,729 INFO dst db version  :  4.0.0
2018-07-20 10:15:45,729 INFO databases       :  NNNNNNNN
2018-07-20 10:15:45,730 INFO collections     :  NNNNNNNNN
2018-07-20 10:15:45,730 INFO db mapping      :  NNNNN => NNNNN
2018-07-20 10:15:45,730 INFO fileds          :
2018-07-20 10:15:45,730 INFO start optime    :  None
2018-07-20 10:15:45,730 INFO optime logfile  :
2018-07-20 10:15:45,730 INFO log filepath    :  log.txt
2018-07-20 10:15:45,730 INFO asyncio         :  True
2018-07-20 10:15:45,730 INFO pymongo version :  3.7.1
2018-07-20 10:15:45,730 INFO ================================================
2018-07-20 10:15:51,289 ERROR connect failed: No replica set members found yet
luantruong commented 6 years ago

Set src with replica set (try with 1 member)

caosiyang commented 6 years ago

This tool hasn't run on MongoDB v4.x and it may be not compatible.