TiDB架構(gòu)設(shè)計(jì)指南_第1頁(yè)
TiDB架構(gòu)設(shè)計(jì)指南_第2頁(yè)
TiDB架構(gòu)設(shè)計(jì)指南_第3頁(yè)
TiDB架構(gòu)設(shè)計(jì)指南_第4頁(yè)
TiDB架構(gòu)設(shè)計(jì)指南_第5頁(yè)
已閱讀5頁(yè),還剩40頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、TiDB架構(gòu)設(shè)計(jì)指南TiDB Design And ArchitectureWhy we need a new databaseThe goal of TiDBDesign & ArchitectureStorage LayerSchedulerSQL LayerSpark integrationTiDB on Kubernetes From scratch Whats wrong with the existing DBs?RDBMSNoSQL & Middleware NewSQL:F1 & Spanner1970s20102015PresentMySQLPostgreSQL Oracle

2、DB2.Redis HBase Cassandra MongoDB.Google Spanner Google F1 TiDBRDBMSNoSQLNewSQLScalabilityHigh AvailabilityACID TransactionSQLA Distributed, Consistent, Scalable, SQL Database that supports the best features of both traditional RDBMS and NoSQLOpen source, of courseData storageData distributionData r

3、eplicationAuto balanceACID TransactionSQL at scaleApplicationsMySQL Drivers(e.g. JDBC)TiDBTiKVMySQL ProtocolRPCSQL LayerStorageLayerGood start! RocksDB is fast and stable.Atomic batch writeSnapshotHowever Its a locally embedded KV store.Cant tolerate machine failuresScalability depends on the capaci

4、ty of the disk Fault ToleranceUse Raft to replicate dataKey features of RaftStrong leader: leader does most of the work, issue all log updatesLeader electionMembership changesImplementation:Ported from etcdReplicas are distributed across machines/racks/data-centers Fault ToleranceMachine 1Machine 2M

5、achine 3RocksDBRocksDBRocksDBRaftRaft ScalabilityWhat if we SPLIT data into many regions?We got many Raft groups.Region = Contiguous KeysHash partitioning or Range partitioning?Redis: Hash partitioningHBase: Range partitioningRange Scan:Select * from t where c 10 and c a - dRegion 2 - e - hRegion n

6、- w - zData is stored/replicated/scheduled in regions(-, +) Sorted MapLogical KeySpace Meta: Start_key, end_key)Thats simpleLogical splitJust Split & MoveSplit safely using RaftRegion 1Region 1Region 2Region1Region3Region 1Region 2Region 1*Region 2Region 2Region 3Region 3Node ANode BNode CNode DRegi

7、on1Region3Region1Region 2Region 1*Region 2Region 2Region 3Region 3Node BNode ANew NodeENode CNode DRegion1Region3Region1*Region 2Region 2Region 2Region 3Region1Region 3Node ANode BNode CNode DNew NodeERegion 1Region1Region3Region1*Region 2Region 2Region 2Region 3Region1Region 3Node ANode BNode CNode

8、 DNew NodeEClientStore 1Region 1Region 3Region 5Region 4Store 3Region 3Region 5Region 2Store 2Region 1Region 3Region 2Region 4Store 4Region 1Region 5Region 2Region 4RPCRPCRPCRPCTiKV node 1TiKV node 2TiKV node 3TiKV node 4Placement DriverPD 1PD 2PD 3Raft GroupMVCCData layoutkey1_version2 - valuekey1_

9、version1 - valuekey2_version3 - valueLock-free snapshot readsTransactionInspired by Google PercolatorAlmost decentralized 2-phasecommitHighly layeredRaft for consistency and scalabilityNo distributed file systemFor better performance and lower latencyTransactionMVCCRaftKVLocal KV Storage (RocksDB)Pr

10、ovide the Gods view of the entire clusterStore the metadataClients have cache of placement information.Maintain the replication constraint3 replicas, by defaultData movement for balancing the workloadIts a cluster too, of course.Thanks to Raft.Placemen tDriver Placement DriverPlacement DriverRaftRaf

11、tRaftNode 1Region ARegion BNode 2PDScheduling StrategyCluster InfoAdminHeartBeat with InfoSchedulin g CommandRegion CConfi gMovementReplica number in a raft groupReplica geo distributionRead/Write workloadLeaders and followersTables and TiKV instancesOther customized scheduling strategySQL is simple

12、 and very productiveWe want to write code like this:SELECT COUNT(*) FROM userWHERE age 20 and age 10Can we push down filters?select count(*) from personwhere age 20 and age 20 and age 20 and age 20 and age 30TiDB knows that Region 1 / 2 / 5stores the data of person table.We just build a protocol lay

13、er that is compatible with MySQL. Then wehave all the MySQL drivers.All the toolsAll the ORMsAll the applicationsThats what TiDB does.KV APICoprocessorTxn, TransactionMVCCRawKV, Raft KVRocksDBPlacement DriverMySQL clientsLoad Balancer (Optional)MySQL ProtocolTiDB SQL LayerKV APIDistSQL APITiDB Serve

14、r (Stateless)MySQL ProtocolTiDB SQL LayerKV APIDistSQL APITiDB Server (Stateless)Pluggable Storage Engine (e.g. TiKV)TiSpark = Spark SQL on TiKVSparkSQL directly on top of a distributed Database StorageHybrid Transactional/Analytical Processing(HTAP) rocksProvide strong OLAP capacity together with T

15、iDBSpark ecosystemTiDBTiDBWorkerSpark DriverMeta dataTiKVTiKVTiKVApplicationSyncerData locationJobTiSparkDistSQL APITiKVTiDBTSO/Data locationWorkerWorkerSpark ClusterTiDB.TiDB Cluster.TiKV Cluster (Storage).DistSQL APIPDPDPDPD ClusterTiKVTiKVTiDBTiKV Connector is better than JDBC connectorIndex supp

16、ortComplex Calculation PushdownCBOPick up the right Access PathJoin ReorderPriority & Isolation LevelAPI ServerSchedulerKubernetes CoreController ManagerTiDB OperatorDeploymentTiDB Cluster ControllerPD ControllerTiKV ControllerTiDB ControllerGC ControllerVolume ManagerDaemonSetTiDB Scheduler: Kube Scheduler + Scheduler Extender DaemonSetUsersUsersAdminTiDB Cloud Manager RESTFul Interface Extern

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論