Skip to content

Instantly share code, notes, and snippets.

View judahschvimer's full-sized avatar

Judah Schvimer judahschvimer

View GitHub Profile
@judahschvimer
judahschvimer / step_into_mongod.py
Created January 14, 2019 16:14
StepIntoMongod
# Created by Dan Gottlieb
import gdb
class StepIntoMongod(gdb.Command):
"""sim (Step Into MongoDB)
Step into the next MongoDB source line.
There are two usages. `sim` and `sim <arg>`.
sim: Steps into the next MongoDB (or WiredTiger) source line. Consider the source line:
@judahschvimer
judahschvimer / replicationwiki.md
Last active March 4, 2023 10:03
Replication Internals Wiki

Replication in 3.4

Replication is the set of systems used to continuously copy data from a primary server to secondary servers so if the primary server fails a secondary server can take over soon. This process is intended to be mostly transparent to the user, with drivers taking care of routing queries to the requested replica. MongoDB supports two forms of replication: replica sets and master-slave.

Master-Slave

This article will focus on replica sets, which are the main way people use replication today. Master-slave has one master node and multiple slave nodes. Slaves replicate from the master and all failover is done manually. Slave nodes can only replicate from other slave nodes if the other slave nodes are configured as masters themselves.

Master-slave replication also allows for filtered replication. Slaves can replicate some chosen subset of the collections.