# MongoDB Basic Cluster Administration<br />ch3 Sharding
###### tags: `MongoDB University M103`
## What is Sharding?
* Shards
* store distributed collections
* Config Server
* store metadata about each shards
* Mongos
* routes queries to shards
## When to Shard
* When we reach the most powerful servers available, maximizing our vertical scale options.
* Sharding can provide an alternative to vertical scaling.
* Data sovereignty laws require data to be located in a specific
a7711555 changed 5 years agoView mode Like Bookmark
# MongoDB Performance<br />ch4 CRUD Optimization
###### tags: `MongoDB University M201`
## Optimizing your CRUD Operations
### Index selectivity
* Equality > Sort > Range
## Covered Queries
* Very performant
* Satisfied entirely by index keys
* 0 documents needs to be examined
:::info
An index covers a query only when **both all fields in the query are a part of the index and all the fields are turned in the result are in the same index**.
:::
### Can't cover a query
* Any of indexed fi
a7711555 changed 5 years agoView mode Like Bookmark
# MongoDB Diagnostics and Debugging (Version 3.4) <br />Ch 3: Slow Queries
###### tags: `MongoDB University M312`
## What Slow Queries Look Like in an Application
### Response Time
* End to end application request should be < 200ms
* \> 100ms is considered slow for MongoDB by default
## Response Time Degredation
### The Culprits
* Working set exceeding RAM
* Queries takes longer as data set grows
* Growing pool of clients
* Unbounded array growth
* Excessive number of indexes
:::info
M
a7711555 changed 5 years agoView mode Like Bookmark
# MongoDB Security<br />ch2 Authorization and Encryption
###### tags: `MongoDB University M310`
## Authorization Model
MongoDB authorization model is **role based control access control.**
The model is for any given **user** we're going to go ahead and assign a **role** to that user. And that role is going to be assigned over a given namespace.
The namespace is just a **database** in mongodb.
For example we create a user named **kirby** and a role called **readWrite** role for the **produc
a7711555 changed 5 years agoView mode Like Bookmark
# MongoDB Security<br />ch1 Authentication
###### tags: `MongoDB University M310`
## Authentication vs. Authorization
| Authentication | Authorization |
| -------------------------------- | ------------------------------------- |
| Verifithe **identity** of a user | Verifies the **privileges** of a user |
## Authentication Mechanisms overview
MongoDb supports 5 mechanisms.
First three of them is part of the community version
Last two is part of En
a7711555 changed 5 years agoView mode Like Bookmark
# MongoDB Performance<br />ch5 Performance on Clusters
###### tags: `MongoDB University M201`
## Performance Considerations in Distributed Systems
* Distributed System in MongoDB
* Replica Cluster
* Shard Cluster
* Working with Distributed Systems
* Consider latency
* Data si spread across different nodes
* Read implications
* Write implications
### Before Sharding
* sharding is an horizontal scaling solution
* Have you reached the limits of our vertical scaling
* N
a7711555 changed 5 years agoView mode Like Bookmark
# MongoDB Performance<br />ch3 Index Operations
###### tags: `MongoDB University M201`
## Building Indexes
* Foreground indexes are fase, but block operations
* Background indexes are slow, but don't block operations
:::warning
For feature compatibility version (fcv) =="4.2", all index builds use an optimized build process== that holds the exclusive lock only at the beginning and end of the build process. The rest of the build process yields to interleaving read and write operations. **Mong
a7711555 changed 5 years agoView mode Like Bookmark
# MongoDB Performance<br />ch2 MongoDB Indexes
###### tags: `MongoDB University M201`
## Introduction to Indexes
:::info
### index 最佳建立順序
精確匹配 > 排序條件 > 範圍匹配
equality before range
equality before sorting
:::
* Indexes is try to solve ==slow queries==
* b-tree data structure
* Indexes increase the speed of ==read== but ==decrease write, update and delete performance==
## Single Field Indexes
* Simplest indexes in MongoDB
* db.<collection>.createIndex({<field>: <direction>})
* Key features
a7711555 changed 5 years agoView mode Like Bookmark
# MongoDB Diagnostics and Debugging (Version 3.4) <br />ch2 Tooling Overview
###### tags: `MongoDB University M312`
## Introduction to Diagnostic and Debugging Tools
### MongoDB tools
* mongostat - shows incoming operation in real time.
* mongotop - to know which collection we're spending time reading from and writing to.
* mongoreplay - to monitor record and replay network traffic
* mongo
* profiler - logs queries
* compass
* mtools
## Introducing Server Logs
### Server Log Components
*
a7711555 changed 6 years agoView mode Like Bookmark