暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

TIDB单节点安装指南

爱玩大数据 2021-06-04
808


TiDB 是 PingCAP 公司自主设计、研发的开源分布式关系型数据库,是一款同时支持在线事务处理与在线分析处理 (Hybrid Transactional and Analytical Processing, HTAP)的融合型分布式数据库产品,具备水平扩容或者缩容、金融级高可用、实时 HTAP、云原生的分布式数据库、兼容 MySQL 5.7 协议和 MySQL 生态等重要特性。目标是为用户提供一站式 OLTP (Online Transactional Processing)、OLAP (Online Analytical Processing)、HTAP 解决方案。TiDB 适合高可用、强一致要求较高、数据规模较大等各种应用场景。

系统环境:CentOS Linux release 7.5.1804 (Core)

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

1.下载压缩包

wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz

wget http://download.pingcap.org/tidb-latest-linux-amd64.sha256

-------------------------------------------------------------------

2.检查文件完整性

[root@localhost tools]# sha256sum -c tidb-latest-linux-amd64.sha256

tidb-latest-linux-amd64.tar.gz: OK  #返回ok说明文件没问题

-------------------------------------------------------------------

3.解压

tar -xzf tidb-latest-linux-amd64.tar.gz

cd tidb-latest-linux-amd64

-------------------------------------------------------------------

4.启动PD 

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

查看启动的进程

[root@localhost 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@localhost tidb-latest-linux-amd64]# ./bin/tikv-server --pd="127.0.0.1:2379" --data-dir=/data/tikv --log-file=/data/logs/tikv.log &

 

[root@localhost 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@localhost tidb-latest-linux-amd64]# ./bin/tidb-server --store=tikv --path="127.0.0.1:2379" --log-file=/data/logs/tidb.log &

 

[root@localhost 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@localhost logs]# 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.0.0-rc.3-39-g8941ba9 MySQL Community Server (Apache License 2.0)

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

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

MySQL [test]> 

MySQL [test]> show databases;

+--------------------+

| Database           |

+--------------------+

| INFORMATION_SCHEMA |

| PERFORMANCE_SCHEMA |

| mysql              |

| test               |

+--------------------+

4 rows in set (0.00 sec)

-------------------------------------------------------------------

CentOS7安装(MySQL) mariadb-server

~]# yum install -y mariadb-server

启动服务

~]# systemctl start mariadb.service

添加到开机启动

~]# systemctl enable mariadb.service

测试一下

~]#  mysql -u root -p

文章转载自爱玩大数据,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论