TiDB架构设计指南_第1页
TiDB架构设计指南_第2页
TiDB架构设计指南_第3页
TiDB架构设计指南_第4页
TiDB架构设计指南_第5页
已阅读5页,还剩40页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、TiDB架构设计指南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. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论