TiDB 單機安裝

官方地址: https://github.com/pingcap/docs-cn

1 下載壓縮包

# 下載Tidb
[root@admxj-core ~]# wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz
# 下載Tidb校驗文件
wget http://download.pingcap.org/tidb-latest-linux-amd64.sha256

2 檢查文件完整性

[root@admxj-core ~]# sha256sum -c tidb-latest-linux-amd64.sha256
tidb-latest-linux-amd64.tar.gz: 確定  #返回ok說明文件沒問題

3 解壓

[root@admxj-core ~]# tar -xzf tidb-latest-linux-amd64.tar.gz
[root@admxj-core ~]# cd tidb-latest-linux-amd64

4 啓動PD

[root@admxj-core tidb-latest-linux-amd64]# ./bin/pd-server --data-dir=/data/pd --log-file=/data/logs/pd.log &

查看啓動的進程

[root@admxj-core tidb-latest-linux-amd64]# ps -ef|grep pd-server
root      2323  894  0 15:36 pts/1    00:00:00 ./bin/pd-server --data-dir=/data/pd --log-file=/data/logs/pd.log
root      2334  894  0 15:36 pts/1    00:00:00 grep --color=auto pd-server

$ 5 啓動TiKV

[root@admxj-core tidb-latest-linux-amd64]# ./bin/tikv-server --pd="127.0.0.1:2379" 
--data-dir=/data/tikv --log-file=/data/logs/tikv.log &

查看TiKV啓動的進程

[root@admxj-core tidb-latest-linux-amd64]# ps -ef|grep tikv-server
root      2357  894  1 15:37 pts/1    00:00:00 ./bin/tikv-server --pd=127.0.0.1:2379
 --data-dir=/data/tikv --log-file=/data/logs/tikv.log
root      2446  894  0 15:37 pts/1    00:00:00 grep --color=auto tikv-server

6 啓動TiDB

[root@admxj-core tidb-latest-linux-amd64]# ./bin/tidb-server --store=tikv
 --path="127.0.0.1:2379" --log-file=/data/logs/tidb.log &

查看TiDB啓動的進程

[root@admxj-core tidb-latest-linux-amd64]# ps -ef|grep tidb-server
root      2462  894  3 15:38 pts/1    00:00:00 ./bin/tidb-server --store=tikv
 --path=127.0.0.1:2379 --log-file=/data/logs/tidb.log
root      2472  894  0 15:38 pts/1    00:00:00 grep --color=auto tidb-server

7 使用mysql連接TiDB

[root@admxj-core tidb-latest-linux-amd64]# yum install mysql
[root@admxj-core tidb-latest-linux-amd64]# mysql -h 127.0.0.1 -P 4000 -u root -D test
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.10-TiDB-v2.1.0-rc.3-409-g6a9ad3f MySQL Community Server (Apache License 2.0)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [test]> show databases;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

原文:https://www.admxj.com/archives/679.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章