1

I try to access real-time data changes with pymongo.mongo_client.MongoClient.watch(), code example (Python 3.5.3, pymongo==3.7.2):

from pymongo import MongoClient  
DB_CON_STR = "mongodb://10.10.10.1:27017/?replicaset=rslogs"  
mongo_rs = MongoClient(MDB_CON_STR)  
MDB_SCHEMA = 'logs'  
MDB_COLLECTION = 'rqs'  
for change in mongo_rs[MDB_SCHEMA][MDB_COLLECTION].watch():  
    print(change)   

and don't get any output.

Replica Set consist from five mongod instances,
Earlier two weeks ago used db.version() 3.4 with set featureCompatibilityVersion: 3.2,
then updated to db.version() 3.6.9, WiredTiger storage engine, pv1, featureCompatibilityVersion: 3.6, logSizeMB: 51200.

logs contain:

2019-02-25T15:02:55.353+0000 I COMMAND [conn30246] command logs.rqs command: getMore { getMore: 6649875775522786240, collection: "rqs", lsid: { id: UUID("") }, $clusterTime: { signature: { hash: BinData(0, 0000000000000000000000000000000000000000), keyId: 0 }, clusterTime:Timestamp(1551106974, 13) }, $db: "logs", $readPreference: { mode: "primary" } } originatingCommand: { aggregate: "rqs", pipeline: [ { $changeStream: { fullDocument: "default" } } ], cursor: {}, lsid: { id: UUID("") }, $clusterTime: { signature: { hash: BinData(0, 0000000000000000000000000000000000000000), keyId: 0 }, clusterTime: Timestamp(1551106971, 9) }, $db: "logs", $readPreference: { mode: "primary" } } planSummary: COLLSCAN cursorid:6649875775522786240 keysExamined:0 docsExamined:16 numYields:16 nreturned:0 reslen:210 locks:{ Global: { acquireCount: { r: 36 } }, Database: { acquireCount: { r: 18 } }, oplog: { acquireCount: { r: 17 } } } protocol:op_msg 927m

In what could be the problem?

0

Problem was solved by stopping one by one each replica and make resync it, after that was changed primary and resync previous one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.