receive reads as well (fully consistent) • Secondary ◦ Receives replicated data from primary ◦ Can receive reads as well (eventually consistent) • Arbiter ◦ Holds no data ◦ Only available for voting in elections http://docs.mongodb.org/manual/replication/
as they grow • Balancer ◦ Managed by the config server ◦ Moves chunks between shards • MongoS ◦ Accepts client connections ◦ Routes queries to correct shard(s) http://docs.mongodb.org/manual/sharding/ Sharded Cluster
can log to disk ◦ Rotate logs with kill -SIGUR1 <mongod|pid> • Profiler ◦ Logs to db.system.profile collection ◦ Can log all, none, or slow queries • Built in tools ◦ mongotop ◦ mongostat http://docs.mongodb.org/manual/administration/monitoring/ http://docs.mongodb.org/manual/tutorial/rotate-log-files/
◦ Use proper data types ◦ Override _id field ◦ Fewer indexes • Write Lock ◦ Lock per database ◦ Workarounds ▪ One collection per database ▪ Multiple mongods per host • Sharding ◦ Spread writes over multiple shards
hashed, sparse, compound, unique, geospatial, text ◦ Covering indexes ▪ answer queries directly from the index • Read less ◦ limit() ◦ Filter result fields • Read from slaves ◦ Use appropriate read preference ◦ Data is eventually consistent