当前位置:网站首页>Tidb二进制集群搭建
Tidb二进制集群搭建
2022-08-11 05:59:00 【JACK-JIE】
机器准备
IP | 主机名 | 用户 | 组件 |
---|---|---|---|
192.168.10.61 | tidb-1 | tidb | pd,tikv,tidb |
192.168.10.62 | tidb-2 | tidb | pd,tikv,tidb |
192.168.10.63 | tidb-3 | tidb | pd,tikv,tidb |
关闭防火墙及selinux
[[email protected] software]# systemctl stop firewalld && systemctl disable firewalld
[[email protected] software]# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
安装用到的工具
yum -y install wget lrzsz curl vim net-tools screen
安装包准备
- 下载安装包
[[email protected] software]# wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz
[[email protected] software]# wget http://download.pingcap.org/tidb-latest-linux-amd64.sha256
- 检查安装包完整性,返回 ok 则正确
[[email protected] software]# sha256sum -c tidb-latest-linux-amd64.sha256
tidb-latest-linux-amd64.tar.gz: 确定
解压软件包到指定目录
[[email protected] software]# tar -zxf tidb-latest-linux-amd64.tar.gz -C /data/
[[email protected] software]# cd /data/
[[email protected] data]# mv tidb-v5.0.1-linux-amd64/ tidb
添加tidb用户并配置属主属组
[[email protected] data]# useradd tidb
[[email protected] data]# chown -R tidb.tidb /data/tidb/
创建所需目录
[[email protected] tidb]# su tidb
[[email protected] tidb]$ mkdir /data/tidb/{
data,logs} -p
[[email protected] tidb]$ mkdir /data/tidb/data/{
pd,tikv} -p
部署pd-server
- tidb-1
[[email protected] tidb]$ ./bin/pd-server --name=pd1 --data-dir=/data/tidb/data/pd --client-urls="http://192.168.10.61:2379" --peer-urls="http://192.168.10.61:2380" --initial-cluster="pd1=http://192.168.10.61:2380,pd2=http://192.168.10.62:2380,pd3=http://192.168.10.63:2380" -L "info" --log-file=/data/tidb/logs/pd.log &
- tidb-2
[[email protected] tidb]$ ./bin/pd-server --name=pd2 --data-dir=/data/tidb/data/pd --client-urls="http://192.168.10.62:2379" --peer-urls="http://192.168.10.62:2380" --initial-cluster="pd1=http://192.168.10.61:2380,pd2=http://192.168.10.62:2380,pd3=http://192.168.10.63:2380" -L "info" --log-file=/data/tidb/logs/pd.log &
- tidb-3
[[email protected] tidb]$ ./bin/pd-server --name=pd3 --data-dir=/data/tidb/data/pd --client-urls="http://192.168.10.63:2379" --peer-urls="http://192.168.10.63:2380" --initial-cluster="pd1=http://192.168.10.61:2380,pd2=http://192.168.10.62:2380,pd3=http://192.168.10.63:2380" -L "info" --log-file=/data/tidb/logs/pd.log &
- 验证
[[email protected] tidb]$ netstat -lntp | grep pd
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 192.168.10.61:2379 0.0.0.0:* LISTEN 17187/./bin/pd-serv
tcp 0 0 192.168.10.61:2380 0.0.0.0:* LISTEN 17187/./bin/pd-serv
部署tikv
- tidb-1
[[email protected] tidb]$ ./bin/tikv-server --pd="192.168.10.61:2379,192.168.10.62:2379,192.168.10.63:2379" --addr="192.168.10.61:20160" --data-dir=/data/tidb/data/tikv --log-file=/data/tidb/logs/tikv.log &
- tidb-2
[[email protected] tidb]$ ./bin/tikv-server --pd="192.168.10.61:2379,192.168.10.62:2379,192.168.10.63:2379" --addr="192.168.10.62:20160" --data-dir=/data/tidb/data/tikv --log-file=/data/tidb/logs/tikv.log &
- tidb-3
[[email protected] tidb]$ ./bin/tikv-server --pd="192.168.10.61:2379,192.168.10.62:2379,192.168.10.63:2379" --addr="192.168.10.63:20160" --data-dir=/data/tidb/data/tikv --log-file=/data/tidb/logs/tikv.log &
- 验证
[[email protected] tidb]$ netstat -lntp | grep kv
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:20180 0.0.0.0:* LISTEN 17342/./bin/tikv-se
tcp6 0 0 192.168.10.61:20160 :::* LISTEN 17342/./bin/tikv-se
部署tidb
- tidb-1
[[email protected] tidb]$ ./bin/tidb-server --store=tikv --path="192.168.10.61:2379,192.168.10.62:2379,192.168.10.63:2379" --log-file=/data/tidb/logs/tidb.log &
- tidb-2
[[email protected] tidb]$ ./bin/tidb-server --store=tikv --path="192.168.10.61:2379,192.168.10.62:2379,192.168.10.63:2379" --log-file=/data/tidb/logs/tidb.log &
- tidb-3
[[email protected] tidb]$ ./bin/tidb-server --store=tikv --path="192.168.10.61:2379,192.168.10.62:2379,192.168.10.63:2379" --log-file=/data/tidb/logs/tidb.log &
- 验证
[[email protected] tidb]$ netstat -lntp | grep db
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 0 0 :::10080 :::* LISTEN 17462/./bin/tidb-se
tcp6 0 0 :::4000 :::* LISTEN 17462/./bin/tidb-se
链接测试
[[email protected] ~]# mysql -h 192.168.10.61 -P 4000 -uroot -D test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.25-TiDB-v5.0.1 TiDB Server (Apache License 2.0) Community Edition, MySQL 5.7 compatible
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| INFORMATION_SCHEMA |
| METRICS_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql |
| test |
+--------------------+
5 rows in set (0.00 sec)
边栏推荐
- 每日sql-统计各个专业人数(包括专业人数为0的)
- My meeting of the OA project (meeting seating & review)
- unable to extend table xxx by 1024 in tablespace xxxx
- Class definition, class inheritance, and the use of super
- ssh服务攻防与加固
- 拼多多API接口(附上我的可用API)
- 抖音API接口大全
- sql--7天内(含当天)购买次数超过3次(含),且近7天的购买金额超过1000的用户
- PIXHAWK飞控使用RTK
- Do not add the is prefix to the variables of the boolean type in the POJO class of the Alibaba specification
猜你喜欢
拼多多API接口大全
已解决EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
每日sql-求2016年成功的投资总和
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
基于FPGA的FIR滤波器的实现(5)— 并行结构FIR滤波器的FPGA代码实现
基于FPGA的FIR滤波器的实现(4)— 串行结构FIR滤波器的FPGA代码实现
Daily sql-statistics of the number of professionals (including the number of professionals is 0)
Douyin API interface
[损失函数]——均方差
ssh服务攻防与加固
随机推荐
unable to extend table xxx by 1024 in tablespace xxxx
Multiscale communication in cortical-cortical networks
详解BLEU的原理和计算
My approval of OA project (inquiry & meeting signature)
Strongly recommend an easy-to-use API interface
李沐d2l(十)--卷积层Ⅰ
已解决EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
radix-4 FFT 原理和C语言代码实现
抖音分享口令url API工具
抖音获取douyin分享口令url API 返回值说明
HCIP OSPF dynamic routing protocol
淘宝API接口参考
Pinduoduo API interface
HCIP Republish/Routing Policy Experiment
淘宝API常用接口与获取方式
抖音API接口
软件测试基本流程有哪些?北京专业第三方软件检测机构安利
图文带你理解什么是Few-shot Learning
Taobao API common interface and acquisition method
Unity底层是如何处理C#的