Replication & The Oplog• Replication: Use It!• Mind the Oplog Size• Consider Delayed Replication
Replica Sets• One Primary, Many Secondaries• High Availability ~ Self Healing• Strongly Consistent• Hidden Nodes, Delayed SECONDARIES• Reading from SECONDARIES • If the PRIMARY goes down, can the remaining SECONDARIES handle the load? • Are You Okay With Less Up to Date Data? • If the answer to either question is no, stick with reading from PRIMARIES...
Replica Sets Node 1! Node 2! Secondary! Heartbeat+ Secondary! Node 3! Primary! Replication+ Replication+• Replication is Asynchronous• Nodes Can Be in Different Datacenters• Tailing the Oplog• Monitor Secondary Delay + Oplog Size
Mongodump• http://docs.mongodb.org/manual/reference/ mongodump/• Binary Export• Best to Run Off Hidden Nodes / Delayed Secondaries
Filesystem Snapshots• Journaling... • If turned on, and on the same ﬁlesystem, snapshot at will. • If not on or mounted somewhere else, fsync lock required• Use a ﬁlesystem that supports snapshots :-)
Queries + Indexes• Note the Cursor Type (Btree vs. Basic)• Most Use-Cases: Queries Should be Indexed• Force No Table Scans • --notablescan• Indexes Should Fit in RAM• Indexes Slow Writes • Use them when you need them... • Don’t use them when you don’t...• Use the Slow Query Log