{"id":1476,"date":"2020-06-04T19:15:36","date_gmt":"2020-06-04T11:15:36","guid":{"rendered":"http:\/\/39.97.231.10\/?p=1476"},"modified":"2020-06-04T19:15:36","modified_gmt":"2020-06-04T11:15:36","slug":"tidb%e5%ae%89%e8%a3%85%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=1476","title":{"rendered":"TiDB\u5b89\u88c5\u90e8\u7f72"},"content":{"rendered":"<h3>1.\u73af\u5883\u4ecb\u7ecd<\/h3>\n<p>OS\u7cfb\u7edf\u7248\u672c\uff1aCentOS 7<br \/>\nTiDB\u5355\u673a\u4f2a\u96c6\u7fa4\u89c4\u5212\uff1a<\/p>\n<ul>\n<li>1\u4e2aTiDB Server<\/li>\n<li>1\u4e2aPD Server<\/li>\n<li>3\u4e2aTiKV Server<\/li>\n<\/ul>\n<h3>2. \u6b65\u9aa4<\/h3>\n<h4>2.1 \u4e0b\u8f7d\u6700\u65b0\u7684TiDB\u4e8c\u8fdb\u5236\u5305<\/h4>\n<pre>wget <a href=\\\"https:\/\/download.pingcap.org\/tidb-latest-linux-amd64.tar.gz\\\" target=\\\"_blank\\\" rel=\\\"nofollow noopener noreferrer\\\">https:\/\/download.pingcap.org\/tidb-latest-linux-amd64.tar.gz<\/a>\n# \u89e3\u538bTiDB\u4e8c\u8fdb\u5236\u5305\uff1a\ntar -xzf tidb-latest-linux-amd64.tar.gz\ncd tidb-latest-linux-amd64<\/pre>\n<h4>2.2 \u542f\u52a8PD Server<\/h4>\n<pre># \u6253\u5f001\u4e2a\u65b0\u7684\u7ec8\u7aef\uff0c\u6267\u884c\uff1a\n.\/bin\/pd-server --name=pd1 --data-dir=pd1 --client-urls=http:\/\/127.0.0.1:2379 --peer-urls=http:\/\/127.0.0.1:2380 --initial-cluster=http:\/\/127.0.0.1:2380 --log-file=pd1.log<\/pre>\n<h4>2.3 \u542f\u52a8TiKV Server<\/h4>\n<pre># \u6253\u5f003\u4e2a\u65b0\u7684\u7ec8\u7aef\uff0c\u5206\u522b\u6267\u884c\uff1a\n.\/bin\/tikv-server --pd-endpoints=\\\"127.0.0.1:2379\\\" --addr=\\\"127.0.0.1:20160\\\" --data-dir=tikv1 --log-file=tikv1.log\n.\/bin\/tikv-server --pd-endpoints=\\\"127.0.0.1:2379\\\" --addr=\\\"127.0.0.1:20161\\\" --data-dir=tikv2 --log-file=tikv2.log\n.\/bin\/tikv-server --pd-endpoints=\\\"127.0.0.1:2379\\\" --addr=\\\"127.0.0.1:20162\\\" --data-dir=tikv3 --log-file=tikv3.log\n# \u68c0\u67e5TiKV\u90e8\u7f72\u662f\u5426\u6210\u529f\uff0c\u67e5\u770b\u6240\u6709TiKV\u72b6\u6001\u662f\u5426\u4e3aUp\uff1a\n.\/bin\/pd-ctl store -d -u http:\/\/127.0.0.1:2379<\/pre>\n<h4>2.4 \u542f\u52a8TiDB Server<\/h4>\n<pre># \u6253\u5f001\u4e2a\u65b0\u7684\u7ec8\u7aef\uff0c\u6267\u884c\uff1a\n.\/bin\/tidb-server --store=tikv --path=\\\"127.0.0.1:2379\\\" --log-file=tidb.log<\/pre>\n<h4>2.5 \u8fde\u63a5TiDB<\/h4>\n<div>\n<pre>[root@localhost tidb-latest-linux-amd64]# mysql -h 127.0.0.1 -P 4000 -u root\nWelcome to the MySQL monitor.  Commands end with ; or \\\\g.\nYour MySQL connection id is 2\nServer version: 5.7.10-TiDB-v2.1.0-rc.3-248-g2f6639d MySQL Community Server (Apache License 2.0)\nCopyright (c) 2009-2018 Percona LLC and\/or its affiliates\nCopyright (c) 2000, 2018, Oracle and\/or its affiliates. All rights reserved.\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\nType \\'help;\\' or \\'\\\\h\\' for help. Type \\'\\\\c\\' to clear the current input statement.\nmysql&gt; status\n--------------\nmysql  Ver 14.14 Distrib 5.7.22-22, for Linux (x86_64) using  6.2\nConnection id:          2\nCurrent database:\nCurrent user:           root@127.0.0.1\nSSL:                    Not in use\nCurrent pager:          stdout\nUsing outfile:          \\'\\'\nUsing delimiter:        ;\nServer version:         5.7.10-TiDB-v2.1.0-rc.3-248-g2f6639d MySQL Community Server (Apache License 2.0)\nProtocol version:       10\nConnection:             127.0.0.1 via TCP\/IP\nServer characterset:    utf8mb4\nDb     characterset:    utf8mb4\nClient characterset:    utf8\nConn.  characterset:    utf8\nTCP port:               4000\n--------------\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1.\u73af\u5883\u4ecb\u7ecd OS\u7cfb\u7edf\u7248\u672c\uff1aCentOS 7 TiDB\u5355\u673a\u4f2a\u96c6\u7fa4\u89c4\u5212\uff1a 1\u4e2aTiDB Server 1\u4e2aPD  &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=1476\"> <span class=\"screen-reader-text\">TiDB\u5b89\u88c5\u90e8\u7f72<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[90],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":0,"uagb_excerpt":"1.\u73af\u5883\u4ecb\u7ecd OS\u7cfb\u7edf\u7248\u672c\uff1aCentOS 7 TiDB\u5355\u673a\u4f2a\u96c6\u7fa4\u89c4\u5212\uff1a 1\u4e2aTiDB Server 1\u4e2aPD &hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1476"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1476"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1476\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1476"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}