TiDB 环境与系统配置检查:https://docs.pingcap.com/zh/tidb/stable/check-before-deployment
fdisk -l && umount /data
mkfs.ext4 /dev/sda3
lsblk -f && vi /etc/fstab
UUID=12c260eb-40ab-48f0-9f3e-d9a4df26ab76 /data ext4 defaults,nodelalloc,noatime 0 2
mount -a && mount -t ext4
2021年9月1日:打个卡,今天开始部署测试环境,安装是参考:https://docs.pingcap.com/zh/tidb/stable/production-deployment-using-tiup
节点配置:
[tidb@TiDB ~]$ cat topology.yaml
# # Global variables are applied to all deployments and used as the default value of
# # the deployments if a specific deployment value is missing.
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/data/tidb-deploy"
data_dir: "/data/tidb-data"
server_configs:
pd:
replication.enable-placement-rules: true
pd_servers:
- host: 192.168.0.183
tidb_servers:
- host: 192.168.0.130
tikv_servers:
- host: 192.168.0.125
- host: 192.168.0.140
- host: 192.168.0.150
- host: 192.168.0.160
- host: 192.168.0.173
tiflash_servers:
- host: 192.168.0.110
data_dir: /data/tidb-data/tiflash-9000
deploy_dir: /data/tidb-deploy/tiflash-9000
cdc_servers:
- host: 192.168.0.105
monitoring_servers:
- host: 192.168.0.130
grafana_servers:
- host: 192.168.0.130
alertmanager_servers:
- host: 192.168.0.130
2021年9月6日:在线安装TiUP时必须用tidb用户并且进行/home/tidb目录,否则会安装失败
2021年9月6日:遇到了一个问题还在解决中,epoll-exclusive Fail,内核已经升级到4.12了,还是检测失败,帖子:https://asktug.com/t/topic/33148/9
1、建议 CentOS 7.6,内核要求为 3.10.0-957 或之后版本,everything版本 不要用 minimal,kernel 4.5 及以上
2、虚拟机不支持这个功能可以忽略,不影响您正常使用tidb
3、 tiup cluster deploy tidb-test v5.2.0 ./topology.yaml --user tidb --skip-create-user
3.1、Cluster tidb-test
deployed successfully, you can start it with command: tiup cluster start tidb-test
4、 tiup cluster display tidb-test
4.1、对于 PD 组件,同时可能会带有 |L 表示该 PD 是 Leader,|UI 表示该 PD 运行着 TiDB Dashboard。
5、最好用SQL语句管理,navicat 不保证他执行了什么SQL,https://docs.pingcap.com/zh/tidb/stable/user-account-management
6、 查看 TiKV store 状态、 store_id
、存储情况以及启动时间
select STORE_ID,ADDRESS,STORE_STATE,STORE_STATE_NAME,CAPACITY,AVAILABLE,UPTIME from INFORMATION_SCHEMA.TIKV_STORE_STATUS;
7、 如何用 Sysbench 测试 TiDB
7.1、安装Sysbench后运行异常,提示:ERROR 2013 (HY000): Lost connection to MySQL server during query;
7.1.1、需要把MySQL客户端卸载掉,安装MySQL5.7.35客户端
7.1.1.1、下载安装包
https://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-community-client-5.7.35-1.el6.x86_64.rpm
https://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-community-libs-5.7.35-1.el6.x86_64.rpm
https://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-community-common-5.7.35-1.el6.x86_64.rpm
https://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-community-devel-5.7.35-1.el6.x86_64.rpm
7.1.2、安装命令:yum localinstall mysql-community*
7.1.3、下载:https://github.com/akopytov/sysbench/archive/refs/tags/1.0.17.tar.gz 手动安装,方法参考:https://github.com/akopytov/sysbench#linux
SELECT count(id) from sbtest1
> OK
> 时间: 0.007s
SELECT count(id) from sbtest2
> OK
> 时间: 0.006s
SELECT count(id) from sbtest3
> OK
> 时间: 22.056s
SELECT count(id) from sbtest4
> OK
> 时间: 15.046s
SELECT count(id) from sbtest5
> OK
> 时间: 11.278s
SELECT count(id) from sbtest6
> OK
> 时间: 2.066s
SELECT count(id) from sbtest7
> OK
> 时间: 92.488s
SELECT count(id) from sbtest8
> OK
> 时间: 38.833s
SELECT count(id) from sbtest9
> OK
> 时间: 17.743s
SELECT count(id) from sbtest10
> OK
> 时间: 33.552s
SELECT count(id) from sbtest11
> OK
> 时间: 27.13s
SELECT count(id) from sbtest12
> OK
> 时间: 18.773s
SELECT count(id) from sbtest13
> OK
> 时间: 29.238s
SELECT count(id) from sbtest14
> OK
> 时间: 8.124s
SELECT count(id) from sbtest15
> OK
> 时间: 19.32s
SELECT count(id) from sbtest16
> OK
> 时间: 14.189s
SELECT count(id) from sbtest17
> 1146 - Table 'sbtest.sbtest17' doesn't exist
> 时间: 0.001s
x、命令记录
x.1、show config WHERE type=‘tidb’ and name like ‘log.level’;
x.2、在部署集群之后,如果需要再调整集群服务的配置,则可以使用命令:tiup cluster edit-config tidb-test 和 tiup cluster reload tidb-test
x.2.1、不用担心配置文件写错了,保存的时候系统会提示