MongoDB replica set and db.stats()
-
08-03-2021 - |
سؤال
We just added a node to our replica set. After the node's state switched to SECONDARY, I do
use obs
db.stats()
on both the PRIMARY node and the new SECONDARY.
PRIMARY SECONDARY
"collections" : 19 18
"views" : 0 0
"objects" : 70926 70409
Why are numbers of objects and collections different?
لا يوجد حل صحيح
نصائح أخرى
OK we found why there is a discrepancy.
We were able to list the collections on the secondary node with
db.getMongo().setSlaveOk()
show collections
From there, I realized the extra collection on the primary was system.profile
(I'd forgotten I'd turned on the profiler) and it's 517 documents accounted for the different object counts from db.stats()
لا تنتمي إلى dba.stackexchange