📑
scrapbook
  • Introduction
  • 1. Concept
  • 1.1 EAI
  • 1.2 ESB
  • 1.3 EAI v.s. ESB
  • 1.4 SOA
  • 1.5 RESTful
  • 1.6 Microservices
  • 1.7 Microservice v.s. SOA
  • 1.8 Maintain HTTP State
  • 1.8.1 Cookie
  • 1.8.2 Session
  • 1.9 Put, Add, and Set
  • 1.10 Public Key & Private Key
  • 1.11 Message Digest & Hash Function
  • 1.12 Diffie - Hellman Key Exchange
  • 1.13 About IoC
  • 1.14 About AOP
  • 1.15 Spring - Pros and Cons
  • 1.16 Spring - Prototype in Singleton
  • 1.17 HTTP v.s. SPDY
  • 1.18 HTTP/2
  • 1.19 Securing REST Services
  • 1.20 Conway's Law
  • 1.21 大型網站架構演化發展歷程
  • 1.22 Java Generics
  • 1.23 MySQL HA經驗談
  • 2. Questions & Solutions
  • 2.1 海底撈幾根針
  • 2.2 塞不進去
  • 3. Relational Database
  • 3.1 SQL Join Type
  • 3.2 SQL Injection
  • 3.3 MySQL CHAR v.s. VARCHAR
  • 4. NoSQL
  • 4.1 CAP Theorem, ACID v.s. BASE
  • 4.2 Two-Phase-Commit
  • 4.3 RDB v.s. NoSQL
  • 4.4 Structured, Unstructured and Semi-structured Data
  • 4.5 Shard v.s. Replica
  • 4.6 ArrayList v.s. LinkedList
  • 4.7 HashSet v.s. TreeSet
  • 4.8 HashMap v.s. TreeMap
  • 4.9 ArrayList v.s. Vector
  • 4.10 HashMap v.s. HashTable
  • 4.11 Statement, PreparedStatement and CallableStatement
  • 4.12 Overflow of Digits
  • X. JVM
  • X.1 JVM System Threads
  • X.2 Garbage Collection
Powered by GitBook
On this page

Was this helpful?

4.5 Shard v.s. Replica

在MongoDB裡, 對於資料集的處理, 有很多種方式, 這邊只是簡單記錄一下shard與replica的差異.

  • Replica Set: 又稱副本集, 即指一組server的cluster, 其中有一個主server(primary), 用於處理user的request; 其餘為備份server(secondary), 用於保存primary的資料副本. 若primary掛了, 會自動將一個secondary升級為新的primary, 進而保證服務的運作及可用性.

  • Shard: 所謂的sharding (Horizontal scaling), 指的就是把資料拆分, 將其分散到不同機器上的過程. MongoDB支持auto sharding, 對application來說, 好像始終都和單一個server互動一般.

由以上敘述可知: Replication是讓多台server擁有相同的資料副本, 而Sharding是指每個shard都擁有整個資料集的一個子集, 且互相為不同的資料, 多個shards的資料整合起來構成整個資料集.

Previous4.4 Structured, Unstructured and Semi-structured DataNext4.6 ArrayList v.s. LinkedList

Last updated 5 years ago

Was this helpful?