当前位置:网站首页>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)
边栏推荐
猜你喜欢
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
矩阵分析——Jordan标准形
A used in the study of EEG ultra scanning analysis process
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
ssh服务攻防与加固
姿态解算-陀螺仪+欧拉法
损失函数——交叉熵
SQL滑动窗口
unable to extend table xxx by 1024 in tablespace xxxx
Douyin API interface
随机推荐
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
抖音API接口
第一个C函数:如何实现板级初始化?
基于FPGA的FIR滤波器的实现(5)— 并行结构FIR滤波器的FPGA代码实现
JD.com product details API call example explanation
Pinduoduo API interface
Multiscale communication in cortical-cortical networks
pytorch调整模型学习率
Taobao sku API interface (PHP example)
已解决EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
PIXHAWK飞控使用RTK
拼多多API接口大全
Attitude solution - gyroscope + Euler method
每日sql - 判断+聚合
Redis + lua implements distributed interface current limiting implementation scheme
矩阵分析——微分、积分、极限
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
NFT 的价值从何而来
How Xshell connects to a virtual machine
HCIP MPLS/BGP Comprehensive Experiment