HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

MongoDB in ReplicaSet databases showing different sizes and objects

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
showingdatabasesobjectsmongodbsizesdifferentreplicasetand

Problem

I have a MongoDB in a ReplicaSet with 3 members, and last week the primary node got corrupted somehow and stopped. I had to resync the data from the other nodes.

It has been a week but I was checking this morning and the databases looks different somehow between the primary (that crashed) and the two secondary that were used for resync the data.


PRIMARY (after crash)


Secondary

I've seen other questions similar to this one but at the end the databases had the same amount of objects, however, my scenario it isn't the same.

Any idea? Or does it look ok?

Solution

The rsync process will also apply a de-fragmentation for the MongoDB data files on the crashed primary replica. That's why you see the data file reduced in size on the primary after crashed.

This effect is the same if you run the compact command on your secondary to reclaim the fragmented storage caused by data CRUD operations over time.

Context

StackExchange Database Administrators Q#195496, answer score: 3

Revisions (0)

No revisions yet.