内容简介:参考文档:参考文档:TIDB官方文档手册:
参考文档: https://pingcap.com/docs-cn/op-guide/ansible-deployment-scale/
TIDB官方文档手册: https://www.pingcap.com/docs-cn/ ,当前操作tidb集群版本是v2.1
1、准备机器
已经部署了tidb集群,部署过程见以前的博客文章,运行一段时间后,qps到达瓶颈,查了下问题出在tidb性能到瓶颈,需要扩容tidb节点。
在已有的新节点上,扩容tidb节点,服务器新购买,所以需要一些统一标准,特别是初始化的配置,以及安装环境准备等等。
准备资源配置文件cleric_add.ini
hy3-tidb-[3:4].csdn.com |
---|
在ansible上面安装tidb账号,在csdndbtls上安装(这是一台能连通所有tidb节点的服务器)
ansible -i cleric_add.ini all -m shell -a "useradd tidb" -b |
---|
准备公钥
scp hy3-tipd-1.csdn.com:/tmp/id_rsa.pub .
1.2 建立tidb互通免秘钥
准备好sudo.txt
%tidb ALL=(ALL) ALL %tidb ALL=(ALL) NOPASSWD: ALL |
---|
在csdndbtls操作(这是一台能通所有tidb集群节点的中间服务器),让tidb能sudo到管理员进行各种安装操作
在csdndbtls上面 cd /home/ansible/csdnhs/sms ansible -i cleric_add.ini all -m copy -a "src=sudo.txt dest=/tmp/sudoers.1 mode=0644" -uansible -b ansible -i cleric_add.ini all -m shell -a "cat /tmp/sudoers.1 >> /etc/sudoers" -uansible -b |
---|
设置tidb互通
将中控机的tidb的公钥copy到csdndbtls上面,在csdndbtls上操作
ansible -i cleric_add.ini all -m copy -a "src=id_rsa.pub dest=/tmp/id_rsa.pub.1" -b ansible -i cleric_add.ini all -m shell -a "mkdir -p /home/tidb/.ssh/" -b ansible -i cleric_add.ini all -m shell -a "chown -R tidb.tidb /home/tidb" -b ansible -i cleric_add.ini all -m shell -a "cat /tmp/id_rsa.pub.1 >> /home/tidb/.ssh/authorized_keys" -b ansible -i cleric_add.ini all -m shell -a "chmod 600 /home/tidb/.ssh/authorized_keys" -b ansible -i cleric_add.ini all -m shell -a "chown -R tidb.tidb /home/tidb" -b ansible -i cleric_add.ini all -m shell -a "chown -R tidb.tidb /data0" -b |
---|
设置后,试下:
执行过程: |
---|
[tidb@hy3-tidb-pd-1] ~$ ssh hy3-tidb-3.csdn.com The authenticity of host 'hy3-tidb-3.csdn.com (172.20.96.167)' can't be established. ECDSA key fingerprint is 22:49:b2:5c:7c:8f:73:56:89:29:8a:bd:56:49:74:66. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'hy3-tidb-3.csdn.com,172.20.96.167' (ECDSA) to the list of known hosts. [tidb@hy3-tidb-3] ~$ exit logout Connection to hy3-tidb-3.csdn.com closed. [tidb@hy3-tidb-pd-1] ~$ ssh hy3-tidb-4.csdn.com The authenticity of host 'hy3-tidb-4.csdn.com (172.20.98.161)' can't be established. ECDSA key fingerprint is 22:49:b2:5c:7c:8f:73:56:89:29:8a:bd:56:49:74:66. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'hy3-tidb-4.csdn.com,172.20.98.161' (ECDSA) to the list of known hosts. [tidb@hy3-tidb-4] ~$ exit |
在csdndbtls上安装ntp服务
安装:ansible -i cleric_add.ini all -m shell -a "sudo yum install ntp ntpdate -y" -b 启动:ansible -i cleric_add.ini all -m shell -a "sudo systemctl start ntpd.service " -b |
---|
准备,生成h.txt,上面ansible命令的时候,会有所有的tidb节点域名地址日志信息,copy到1.log,然后 more 1.log |grep hy3 |awk '{print $1}' |sort >> h.txt 就生成了域名的文件,之后再
[ansible@csdndbtls] ~/csdnhs/tidb$ more 1.log |grep hy3 |awk '{print $1}' |sort >> h.txt [ansible@csdndbtls] ~/csdnhs/tidb$ more h.txt hy3-tidb-3.csdn.com hy3-tidb-4.csdn.com [ansible@csdndbtls] ~/csdnhs/tidb$ more h.txt hy3-tidb-3.csdn.com hy3-tidb-4.csdn.com [ansible@csdndbtls] ~/csdnhs/tidb$ for h in `cat h.txt`;do echo `nslookup $h |grep 'Address: 10' |sed 's/Address: //'` $h;done 172.10.66.118 hy3-tidb-3.csdn.com 172.10.167.52 hy3-tidb-4.csdn.com [ansible@csdndbtls] ~/csdnhs/tidb$ |
---|
2、开始部署
先去vim inventory.ini添加2个新节点
[tidb_servers]
172.10.66.118
172.10.167.52
[monitored_servers]
172.10.66.118
172.10.167.52
这个就是改一些参数和建目录
-
初始化新增节点:
ansible-playbook bootstrap.yml -l 172.10.66.118,172.10.167.52
-
部署新增节点:
ansible-playbook deploy.yml -l 172.10.66.118,172.10.167.52
-
启动新节点服务:
ansible-playbook start.yml -l 172.10.66.118,172.10.167.52
-
更新 Prometheus 配置并重启:
ansible-playbook rolling_update_monitor.yml --tags=prometheus
测试使用新的tidb节点登陆,成功,如下:
[csdnhy@hy1st] ~$ mysql -h 172.10.66.118 -uroot -p -P4000 hy3lt Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.7.10-TiDB-v2.0.0-rc.4-214-g7fbbb1f MySQL Community Server (Apache License 2.0) Copyright (c) 2000, 2017, 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. root-172.10.66.118:4000:hy3lt 22:03:11> |
---|
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 监控 Kubernetes 集群节点
- 4.2 集群节点初步搭建
- Hadoop教程:多节点集群
- Kubernetes集群跨节点挂载CephFS
- Kubernetes集群跨节点挂载CephFS
- 安装和配置Hadoop集群(3节点)
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Web 2.0界面设计模式
黄玮 / 电子工业出版社 / 2013-9-1 / 59
本书集Web 2.0的发展及特点、Web 2.0界面设计模式基本理论、实际模式实践及代码实现等诸多内容于一身,具有很强的实用性。这些内容不是简单的顺序堆砌,而是以Web 2.0界面设计模式和应用为主线,其中完美地穿插了各种与之相关的Web 2.0设计理念、用户行为模式、用户体验及基于Dojo的实现方式等相关知识,真正做到将Web 2.0界面设计模式所需要的方方面面的知识有机地融为一个整体。实现不需......一起来看看 《Web 2.0界面设计模式》 这本书的介绍吧!