Skip to content

Instantly share code, notes, and snippets.

@karlpokus
Last active May 15, 2017 15:23
Show Gist options
  • Save karlpokus/83ee3739889dbfc38612d2606c587b55 to your computer and use it in GitHub Desktop.
Save karlpokus/83ee3739889dbfc38612d2606c587b55 to your computer and use it in GitHub Desktop.
mongodb - maintenance, scaling, monitoring

Scale

  • replica sets scales reads
  • sharding scales read and writes

replica sets

  • backup
  • primary and secondary members
  • oplog requires a replica set

primary member

  • only one

secondary member

  • multiple
  • copies-, and repeats the primary oplog after a set delay
  • priority 0 will not become a primary
  • use "hidden" to avoid interference. Suitable for analytics and offline reads. Rquired to be priority 0.

arbiter

  • only required if even number-, or only one secondary

sharded cluster

  • Cluster of shards. Each shard is a mongod
  • Each shard should be a replica set
  • Requires: shardKey, router mongos, config server

TODOs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment