{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/docs/pulls/comments/84829615","pull_request_review_id":5581372,"id":84829615,"diff_hunk":"@@ -1,22 +1,87 @@\n # TiDB Documentation\n \n-TiDB is a distributed SQL database. Inspired by the design of Google F1, TiDB supports the best features of both traditional RDBMS and NoSQL.\n+TiDB is a NewSQL database that is horizontally scalable and highly available. This document aims to help the technical engineers especially the operations engineers understand its horizontal scalability and high availability. \n+\n+## TiDB Architecture\n+\n+To better understand TiDB’s features, you need to understand the TiDB architecture.\n+\n+![image alt text](op-guide/architecture.png)\n+\n+The TiDB cluster has three components: the TiDB Server, the PD Server,  and the TiKV server.\n+\n+### TiDB Server\n+\n+The TiDB server is in charge of the following operations:\n+\n+1. Receiving the SQL requests\n+\n+2. Processing the SQL related logics\n+\n+3. Locating the TiKV address for storing and computing data through the Placement Driver (PD)\n+\n+4. Exchanging data with TiKV\n+\n+5. Returning the result\n+\n+The TiDB server is stateless. It doesn’t store data and it is for computing only. TiDB is horizontally scalable and provides the unified interface to the outside through the load balancing components such as Linux Virtual Server (LVS), HAProxy, or F5.\n+\n+### Placement Driver Server\n+\n+Placement Driver (PD) is the managing component of the entire cluster and is in charge of the following three operations:\n+\n+1. Storing the metadata of the cluster such as the region location of a specific key.\n+\n+2. Scheduling and load balancing regions in the TiKV cluster, including but not limited to data migration and Raft group leader transfer.\n+\n+3. Allocating the transaction ID that is globally unique and monotonic increasing.\n+\n+As a cluster, PD needs to be deployed to an odd number of nodes. Usually it is recommended to deploy to 3 online nodes at least.\n+\n+### TiKV Server\n+\n+TiKV server is responsible for storing data. From an external view, TiKV is a distributed transactional Key-Value storage engine. Region is the basic unit to store data. Each Region stores the data for a particular Key Range which is a left-closed and right-open interval from StartKey to EndKey. There are multiple Regions in each TiKV node. TiKV uses the Raft protocol for replication to ensure the data consistency and disaster recovery. The replicas of the same Region on different nodes compose a Raft Group. The load balancing of the data among different TiKV nodes are scheduled by PD. Region is also the basic unit for scheduling the load balance.\n+\n+## Horizontal Scalability\n+\n+Horizontal scalability is the most important feature of TiDB. The scalability includes two aspects: the computing capability and the storage capacity. The TiDB server processes the SQL requests. As the business grows, the overall processing capability and higher throughput can be achieved by simply adding more TiDB server nodes. Data is stored in TiKV. As the size of the data grows, the scalability of data can be resolved by adding more TiKV server nodes. PD schedules data in Regions among the TiKV nodes and migrates part of the data to the newly added node. So in the early stage, you can deploy only a few service instances. For example, it is recommended to deploy at least 3 TiKV nodes, 3 PD nodes and 2 TiDB nodes. As business grows, more TiDB and TiKV instances can be added on-demand.\n+\n+## High availability\n+\n+High availability is another important feature of TiDB. All of the three components, TiDB, TiKV and PD, can tolerate the failure of some instances without impacting the availability of the entire cluster. For each component, See the following for more details about the availability, the consequence of a single instance failure and how to recover.\n+\n+### TiDB\n+\n+TiDB is stateless and it is recommended to deploy at least two instances. The front-end provides services to the outside through the load balancing components. If one of the instances is down, the Session on the instance will be impacted. From the application’s point of view, it is a single request failure but the service can be regained by reconnecting to the TiDB server. If a single instance is down, the service can be recovered by restarting the instance or by deploying a new one.\n+\n+### PD\n+\n+PD is a cluster and the data consistency is ensured using the Raft protocol. If an instance is down but the instance is not a Raft Leader, there is no impact on the service at all. If the instance is a Raft Leader, a new Leader will be elected to recover the service. During the election which is approximately 3 seconds, PD cannot provide service. It is recommended to deploy three instances. If one of the instances is down, the service can be recovered by restarting the instance or by deploying a new one.\n+\n+### TiKV\n+\n+TiKV is a cluster and the data consistency is ensured using the Raft protocol. The number of the replicas can be configurable and the default is 3 replicas. The load of TiKV servers are balanced through PD. If one of the node is down, all the Regions in the node will be impacted. If the failed node is the Leader of the Region, the service will be interrupted and a new election will be initiated. If the failed node is a Follower of the Region, the service will not be impacted. If a TiKV node is down for a period of time (the default value is 10 minutes), PD will move the data to another TiKV node.\n+\n ## FAQ\n- - [TiDB FAQ](./TiDB_FAQ.md)\n+\n+- [TiDB FAQ](./TiDB_FAQ.md)\n  \n ## Getting started\n- - [Quick Start for TiDB](https://github.com/pingcap/tidb/blob/master/docs/QUICKSTART.md)\n+- [Quick Start for TiDB](https://github.com/pingcap/tidb/blob/master/docs/QUICKSTART.md)\n+\n+## Deployment & Operation","path":"README.md","position":75,"original_position":75,"commit_id":"f7b6252b4235f6409ac15be5590afc0ad41c2c3a","original_commit_id":"f7b6252b4235f6409ac15be5590afc0ad41c2c3a","user":{"login":"queenypingcap","id":19528243,"avatar_url":"https://avatars.githubusercontent.com/u/19528243?v=3","gravatar_id":"","url":"https://api.github.com/users/queenypingcap","html_url":"https://github.com/queenypingcap","followers_url":"https://api.github.com/users/queenypingcap/followers","following_url":"https://api.github.com/users/queenypingcap/following{/other_user}","gists_url":"https://api.github.com/users/queenypingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/queenypingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/queenypingcap/subscriptions","organizations_url":"https://api.github.com/users/queenypingcap/orgs","repos_url":"https://api.github.com/users/queenypingcap/repos","events_url":"https://api.github.com/users/queenypingcap/events{/privacy}","received_events_url":"https://api.github.com/users/queenypingcap/received_events","type":"User","site_admin":false},"body":"The name of this section is “Deployment & Operation”, but there are only deployment guides. Please move the operating guides here. ","created_at":"2016-10-25T04:35:44Z","updated_at":"2016-10-25T04:35:44Z","html_url":"https://github.com/pingcap/docs/pull/55#discussion_r84829615","pull_request_url":"https://api.github.com/repos/pingcap/docs/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/pingcap/docs/pulls/comments/84829615"},"html":{"href":"https://github.com/pingcap/docs/pull/55#discussion_r84829615"},"pull_request":{"href":"https://api.github.com/repos/pingcap/docs/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/docs/pulls/55","id":90734778,"html_url":"https://github.com/pingcap/docs/pull/55","diff_url":"https://github.com/pingcap/docs/pull/55.diff","patch_url":"https://github.com/pingcap/docs/pull/55.patch","issue_url":"https://api.github.com/repos/pingcap/docs/issues/55","number":55,"state":"open","locked":false,"title":"*: refactor structure","user":{"login":"siddontang","id":1080370,"avatar_url":"https://avatars.githubusercontent.com/u/1080370?v=3","gravatar_id":"","url":"https://api.github.com/users/siddontang","html_url":"https://github.com/siddontang","followers_url":"https://api.github.com/users/siddontang/followers","following_url":"https://api.github.com/users/siddontang/following{/other_user}","gists_url":"https://api.github.com/users/siddontang/gists{/gist_id}","starred_url":"https://api.github.com/users/siddontang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siddontang/subscriptions","organizations_url":"https://api.github.com/users/siddontang/orgs","repos_url":"https://api.github.com/users/siddontang/repos","events_url":"https://api.github.com/users/siddontang/events{/privacy}","received_events_url":"https://api.github.com/users/siddontang/received_events","type":"User","site_admin":false},"body":"Like docs-cn, refactor the structure of the doc. \r\n\r\n+ Move `Overview` to the home `README`\r\n+ Add `Recommendation`, `Binary Deployment`, `Docker Deployment` directly for user use in production.\r\n+ Move `docker-compose` to another file. \r\n\r\n@shenli @queenypingcap @iamxy ","created_at":"2016-10-25T03:50:58Z","updated_at":"2016-10-25T04:35:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e407c8d9dd7abb0bf3f8d831fd35819f9d757f7e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/docs/pulls/55/commits","review_comments_url":"https://api.github.com/repos/pingcap/docs/pulls/55/comments","review_comment_url":"https://api.github.com/repos/pingcap/docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/docs/issues/55/comments","statuses_url":"https://api.github.com/repos/pingcap/docs/statuses/f7b6252b4235f6409ac15be5590afc0ad41c2c3a","head":{"label":"pingcap:siddontang/update-structure","ref":"siddontang/update-structure","sha":"f7b6252b4235f6409ac15be5590afc0ad41c2c3a","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":63995402,"name":"docs","full_name":"pingcap/docs","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/docs","description":"TiDB/TiKV/PD documents.","fork":false,"url":"https://api.github.com/repos/pingcap/docs","forks_url":"https://api.github.com/repos/pingcap/docs/forks","keys_url":"https://api.github.com/repos/pingcap/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/docs/teams","hooks_url":"https://api.github.com/repos/pingcap/docs/hooks","issue_events_url":"https://api.github.com/repos/pingcap/docs/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/docs/events","assignees_url":"https://api.github.com/repos/pingcap/docs/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/docs/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/docs/tags","blobs_url":"https://api.github.com/repos/pingcap/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/docs/languages","stargazers_url":"https://api.github.com/repos/pingcap/docs/stargazers","contributors_url":"https://api.github.com/repos/pingcap/docs/contributors","subscribers_url":"https://api.github.com/repos/pingcap/docs/subscribers","subscription_url":"https://api.github.com/repos/pingcap/docs/subscription","commits_url":"https://api.github.com/repos/pingcap/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/docs/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/docs/merges","archive_url":"https://api.github.com/repos/pingcap/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/docs/downloads","issues_url":"https://api.github.com/repos/pingcap/docs/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/docs/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/docs/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/docs/deployments","created_at":"2016-07-23T02:39:04Z","updated_at":"2016-10-25T02:51:38Z","pushed_at":"2016-10-25T03:51:22Z","git_url":"git://github.com/pingcap/docs.git","ssh_url":"git@github.com:pingcap/docs.git","clone_url":"https://github.com/pingcap/docs.git","svn_url":"https://github.com/pingcap/docs","homepage":null,"size":274,"stargazers_count":10,"watchers_count":10,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":10,"forks":4,"open_issues":10,"watchers":10,"default_branch":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"be32fbb6d23d2c1472269a236d6d586769cb708b","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":63995402,"name":"docs","full_name":"pingcap/docs","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars.githubusercontent.com/u/11855343?v=3","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/docs","description":"TiDB/TiKV/PD documents.","fork":false,"url":"https://api.github.com/repos/pingcap/docs","forks_url":"https://api.github.com/repos/pingcap/docs/forks","keys_url":"https://api.github.com/repos/pingcap/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/docs/teams","hooks_url":"https://api.github.com/repos/pingcap/docs/hooks","issue_events_url":"https://api.github.com/repos/pingcap/docs/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/docs/events","assignees_url":"https://api.github.com/repos/pingcap/docs/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/docs/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/docs/tags","blobs_url":"https://api.github.com/repos/pingcap/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/docs/languages","stargazers_url":"https://api.github.com/repos/pingcap/docs/stargazers","contributors_url":"https://api.github.com/repos/pingcap/docs/contributors","subscribers_url":"https://api.github.com/repos/pingcap/docs/subscribers","subscription_url":"https://api.github.com/repos/pingcap/docs/subscription","commits_url":"https://api.github.com/repos/pingcap/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/docs/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/docs/merges","archive_url":"https://api.github.com/repos/pingcap/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/docs/downloads","issues_url":"https://api.github.com/repos/pingcap/docs/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/docs/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/docs/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/docs/deployments","created_at":"2016-07-23T02:39:04Z","updated_at":"2016-10-25T02:51:38Z","pushed_at":"2016-10-25T03:51:22Z","git_url":"git://github.com/pingcap/docs.git","ssh_url":"git@github.com:pingcap/docs.git","clone_url":"https://github.com/pingcap/docs.git","svn_url":"https://github.com/pingcap/docs","homepage":null,"size":274,"stargazers_count":10,"watchers_count":10,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":10,"forks":4,"open_issues":10,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/docs/pulls/55"},"html":{"href":"https://github.com/pingcap/docs/pull/55"},"issue":{"href":"https://api.github.com/repos/pingcap/docs/issues/55"},"comments":{"href":"https://api.github.com/repos/pingcap/docs/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/docs/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/docs/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/docs/statuses/f7b6252b4235f6409ac15be5590afc0ad41c2c3a"}}}}
{"actor":{"display_login":"queenypingcap"}}