TiDB v7.5.4安装部署

TiDB v7.5.4安装部署手册

1 安装部署计划

服务器名称 ip 角色
hdp-01 172.16.4.121 pd_servers、tidb_servers、tikv_servers
hdp-02 172.16.4.122 pd_servers、tidb_servers、tikv_servers
hdp-03 172.16.4.123 pd_servers、tidb_servers、tikv_servers
hdp-04 172.16.4.124 monitoring_servers、grafana_servers、alertmanager_servers

2 相关参考信息

  • 安装部署包下载地址

    • https://download.pingcap.org/tidb-community-server-v7.5.4-linux-arm64.tar.gz
  • 安装部署官方手册

    • https://docs.pingcap.com/zh/tidb/v7.5/tiup-cluster-topology-reference

3 安装部署TiDB

3.1 下载安装部署包

​ 将tidb-community-server-v7.5.4-linux-arm64.tar.gz上传至hdp-01服务器上

mkdir /data/tidb
cd /data/tidb
wget https://download.pingcap.org/tidb-community-server-v7.5.4-linux-arm64.tar.gz
tar -xvf tidb-community-server-v7.5.4-linux-arm64.tar.gz

3.2 tidb用户

3.2.1 增加tidb用户及配置相关密码
#hdp-01、hdp-02、hdp-03、hdp-04
useraddr tidb
passwd tidb
3.2.2 tidb用户免密
#hdp-01
[tidb@hdp-01 ~]$ su - tidb
[tidb@hdp-01 ~]$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/tidb/.ssh/id_rsa): 
Created directory '/home/tidb/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/tidb/.ssh/id_rsa.
Your public key has been saved in /home/tidb/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:jpI7fXb+P79Gae0EFQnrNCtr6i+LLbFmJX4MVJO4ybg tidb@hdp-warehouse-001
The key's randomart image is:
+---[RSA 2048]----+
|        . .  ...o|
|       . +    ...|
|      o + .  + . |
|     . =    o +  |
|      o S  . o .o|
|     E * .  o  +o|
|    o.o O  o  oo |
|    .o.*=++   ...|
|    ..o++B=o..o+o|
+----[SHA256]-----+
[tidb@hdp-01 ~]$ ssh-copy-id hdp-01
[tidb@hdp-01 ~]$ ssh-copy-id hdp-02
[tidb@hdp-01 ~]$ ssh-copy-id hdp-03
[tidb@hdp-01 ~]$ ssh-copy-id hdp-04
3.3.3 配置sudo权限
#hdp-01、hdp-02、hdp-03、hdp-04
# 在/etc/sudoers添加下列条目
tidb    ALL=(ALL)       NOPASSWD:ALL

3.3 部署TiUP环境

# hdp-01
[root@hdp-warehouse-001 tidb-community-server-v7.5.4-linux-arm64]#  sh local_install.sh
Disable telemetry success
Successfully set mirror to /data/tidb/tidb-community-server-v7.5.4-linux-arm64
Detected shell: bash
Shell profile:  /root/.bash_profile
/root/.bash_profile has been modified to to add tiup to PATH
open a new terminal or source /root/.bash_profile to use it
Installed path: /root/.tiup/bin/tiup
===============================================
1. source /root/.bash_profile
2. Have a try:  
### TiDB 安装部署教程最佳实践 #### 下载与安装 TiDB安装过程通常分为几个阶段,首先是下载并解压安装包。可以通过官方文档获取最新版本的安装文件,并将其上传到目标服务器[^2]。 ```bash wget https://download.pingcap.com/tidb-community-server-latest-linux-amd64.tar.gz tar zxvf tidb-community-server-latest-linux-amd64.tar.gz cd tidb-community-server-latest-linux-amd64/bin/ ``` #### 配置拓扑结构 在完成软件包的准备之后,需要生成 `topology.yaml` 文件来定义集群中的各个组件及其对应的机器配置。此文件对于分布式系统的正常运行至关重要,因此需仔细校验其内容是否符合实际环境需求[^2]。 如果遇到磁盘分区问题,可以考虑新增一块硬盘用于存储数据目录。例如,在 `/dev/sdb` 上创建一个新的 GPT 分区表并将它格式化为 EXT4 文件系统[^3]: ```bash sudo parted -s -a optimal /dev/sdb mklabel gpt -- mkpart primary ext4 1 -1 mkfs.ext4 /dev/sdb1 mkdir -p /mnt/data mount /dev/sdb1 /mnt/data echo '/dev/sdb1 /mnt/data ext4 defaults 0 0' | sudo tee -a /etc/fstab ``` 接着更新 `topology.yaml` 中的相关路径指向新挂载点下的子目录: ```yaml pd_servers: - host: pd-hostname-or-ipaddress data_dir: "/mnt/data/pd" tikv_servers: - host: tikv-hostname-or-ipaddress data_dir: "/mnt/data/tikv" tidb_servers: - host: tidb-hostname-or-ipaddress port: 4000 monitoring_server_port: 9090 grafana_server_port: 3000 ``` #### 权限管理 为了保障服务能够顺利启动以及后续运维操作便利性,建议赋予相应用户足够的读写权限给指定的数据目录位置[^2]。 ```bash chown -R tidb:tibdmnt/data/* chmod u+wrx,g+rwx,o-rwx /mnt/data/* ``` #### 初始化与验证 执行初始化命令后即可正式启用整个集群架构。通过以下方式确认各节点的状态均为 UP 表明已成功搭建完毕。 ```bash tiup cluster deploy test_cluster v6.5.0 /path/to/topology.yaml --user root [-i ~/.ssh/id_rsa] tiup cluster start test_cluster tiup dashboard test_cluster curl http://<any_tidb_host>:10080/status ``` 最后测试连接至任意一台 TIDB Server 实例上的 MySQL 接口端口 (默认为 4000),尝试查询一些基础信息以确保功能可用性[^4]。 ```sql SELECT VERSION(); SHOW DATABASES; CREATE TABLE IF NOT EXISTS demo_table(id INT PRIMARY KEY AUTO_INCREMENT, value VARCHAR(255)); INSERT INTO demo_table(value) VALUES('hello world'); SELECT * FROM demo_table LIMIT 10; DROP TABLE IF EXISTS demo_table; ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值