集群现状:

共有五个节点,配置为16核32g内存,数据节点为1T ssd盘,非数据节点为100g ssd盘;

角色规划:

  1. node1 tidb tipd
  2. node2 tidb tipd
  3. node3 tikv tipd
  4. node4 tikv
  5. node5 tikv

1.每次操作都需要更改配置文件inventory.ini,都是在tidb用户下进行;

2.初始化,打通新增节点与已有节点间免密码登录(tidb)用户;

3.扩容tidb节点两个

  1. ## TiDB Cluster Part
  2. [tidb_servers]
  3. 10.15.xxx.xxx ---旧的tidb---uc机器
  4. 10.15.xxx.xxx ---旧的tidb---uc机器
  5. 10.80.xxx.xxx ---新加tidb---阿里机器
  6. 10.80.xxx.xxx ---新加tidb---阿里机器

3.1 部署

  1. [tidb@tidb..tidb.prod.uc:~/tidb-ansible]$ ansible-playbook deploy.yml -l 10.80.xxx.xxx,10.80.xxx.xxx
     

。。。。。。。。。。。。。。。。。。。。。。。。。。。

。。。。。。。。。。。。。。。。。

。。。。。。。。。

PLAY RECAP ***********************************************************************************************************************************************************************************************
10.80.249.46 : ok=30 changed=12 unreachable=0 failed=0 
10.80.249.47 : ok=30 changed=12 unreachable=0 failed=0

Congrats! All goes well. :-)

3.2 启动新增tidb节点

  1. [tidb@tidb..tidb.prod.uc:~/tidb-ansible]$ ansible-playbook rolling_update_monitor.yml --tags=prometheus
  2.  
  3. PLAY RECAP ***********************************************************************************************************************************************************************************************
  4. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  5. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  6. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  7. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  8. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  9. 10.80.xxx.xxx : ok= changed= unreachable= failed=
  10. 10.80.xxx.xxx : ok= changed= unreachable= failed=
  11. localhost : ok= changed= unreachable= failed=
  12.  
  13. Congrats! All goes well. :-)

3.3更新监控

  1. [tidb@tidb..tidb.prod.uc:~/tidb-ansible]$ ansible-playbook rolling_update_monitor.yml --tags=prometheus
  2.  
  3. PLAY RECAP ***********************************************************************************************************************************************************************************************
  4. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  5. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  6. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  7. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  8. 10.15.xxx.xxx : ok= changed= unreachable= failed=
  9. 10.80.xxx.xxx : ok= changed= unreachable= failed=
  10. 10.80.xxx.xxx : ok= changed= unreachable= failed=
  11. localhost : ok= changed= unreachable= failed=
  12.  
  13. Congrats! All goes well. :-)

4.扩容tikv节点

  1. [tikv_servers]
  2. 10.15.xxx.xxx
  3. 10.15.xxx.xxx
  4. 10.15.xxx.xxx
  5. 10.80.xxx.xxx
  6. 10.80.xxx.xxx
  7. 10.80.xxx.xxx

4.1.tikv为数据节点,扩容之前把ssd盘格式化分区挂载

  1. root@tikv..tidb.prod.ali:~/.ssh# vi /etc/fstab
  2.  
  3. #
  4. # /etc/fstab
  5. # Created by anaconda on Sun Oct 15 15:19:00 2017
  6. #
  7. # Accessible filesystems, by reference, are maintained under '/dev/disk'
  8. # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
  9. #
  10. UUID=eb448abb--4d8d-bcde-94434d586a31 / ext4 defaults
  11. #/dev/vdb /data ext4 defaults,noatime 0 0
  12. /dev/vdb /data ext4 defaults,nodelalloc,noatime
  13.  
  14. root@tikv..tidb.prod.ali:~/.ssh#
  15. root@tikv..tidb.prod.ali:~/.ssh# umount /data
  16. root@tikv..tidb.prod.ali:~/.ssh# mount -a
  17. root@tikv..tidb.prod.ali:~/.ssh# mount -t ext4
  18. /dev/vda1 on / type ext4 (rw,relatime,data=ordered)
  19. /dev/vdb on /data type ext4 (rw,noatime,nodelalloc,data=ordered)

4.2  加入tikv,启动服务,更新

  1. [tidb@tidb.11.tidb.prod.uc:~/tidb-ansible]$ ansible-playbook bootstrap.yml -l 10.80.249.59,10.80.249.60,10.80.249.58
  1. [tidb@tidb.11.tidb.prod.uc:~/tidb-ansible]$ ansible-playbook start.yml -l 10.80.249.59,10.80.249.60,10.80.249.58
  1.  
  1. [tidb@tidb.11.tidb.prod.uc:~/tidb-ansible]$ ansible-playbook rolling_update_monitor.yml --tags=prometheus

5.加入tidb(加入tipd节点要一个一个加入)

  1. [pd_servers]
  2. 10.15.xxx.xxx
  3. 10.15.xxx.xxx
  4. 10.15.xxx.xxx
  5. 10.80.xxx.xxx

5.1初始化新加入tipd

  1. [tidb@tidb..tidb.prod.uc:~/tidb-ansible]$ ansible-playbook bootstrap.yml -l 10.80.xxx.xxx

2.安装目标服务器

  1. [tidb@tidb.01.tidb.prod.uc:~/tidb-ansible]$ ansible-playbook deploy.yml -l 10.80.xxx.xxx
  1.  

PLAY RECAP ***************************************************************************************************************************
10.80.249.46 : ok=34 changed=0 unreachable=0 failed=0

  1.  

Congrats! All goes well. :-)

  1.  

5.3登录到新加入的tipd节点,vi run_pd.sh

  1. root@tidb..tidb.prod.ali:/data/tidb/deploy/scripts# vi run_pd.sh
  2. --initial-cluster="pd1=http://10.15.xxx.xxx:2380,pd2=http://10.15.xxx.xxx:2380,pd3=http://10.15.xxx.xxx:2380,pd4=http://10.80.xxx.xxx:2380" \
  3. #!/bin/bash
  4. set -e
  5. ulimit -n
  6.  
  7. # WARNING: This file was auto-generated. Do not edit!
  8. # All your edit might be overwritten!
  9. DEPLOY_DIR=/data/tidb/deploy
  10.  
  11. cd "${DEPLOY_DIR}" || exit
  12.  
  13. exec bin/pd-server \
  14. --name="pd4" \
  15. --client-urls="http://10.80.xxx.xxx:2379" \
  16. --advertise-client-urls="http://10.80.xxx.xxx:2379" \
  17. --peer-urls="http://10.80.xxx.xxx:2380" \
  18. --advertise-peer-urls="http://10.80.xxx.xxx:2380" \
  19. --data-dir="/data/tidb/deploy/data.pd" \
  20. --config=conf/pd.toml \
  21. --join="http://10.15.xxx.xxx:2380" \
  22. --log-file="/data/tidb/deploy/log/pd.log" >> "/data/tidb/deploy/log/pd_stderr.log
  23.  
  24. 在目标服务器手动启动pd服务:
  25.  
  26. tidb@tidb.11.tidb.prod.ali:/data/tidb/deploy/scripts$ sh -x start_pd.sh

5.4 在目标机器查看pd服务:

tidb@tidb.11.tidb.prod.ali:/data/tidb/deploy/scripts$ ps -ef | grep tidb
tidb 6922 1 0 14:29 ? 00:00:02 bin/pd-server --name=pd4 --client-urls=http://10.80.xxx.xxx:2379 --advertise-client-urls=http://10.80.xxx.xxx:2379 --peer-urls=http://10.80.xxx.xxx:2380 --advertise-peer-urls=http://10.80.xxx.xxx:2380 --data-dir=/data/tidb/deploy/data.pd --config=conf/pd.toml --join=http://10.15.xxx.xxx:2380 --log-file=/data/tidb/deploy/log/pd.log

5.5 滚动升级集群:

[tidb@tidb.11.tidb.prod.uc:~/tidb-ansible]$ ansible-playbook rolling_update.yml

5.6更新 Prometheus 配置并重启:

[tidb@tidb.11.tidb.prod.uc:~/tidb-ansible]$ ansible-playbook rolling_update_monitor.yml --tags=prometheus

在线tidb+tipd+tikv扩容,迁移,从UC到阿里云的更多相关文章

  1. Windows Server: 将虚拟机迁移到 Azure (以阿里云为例)

    Azure 虚拟机能很容易地导出 vhd 并迁移到各种环境中,包含本地及云端环境,或者迁移至其他区域.这为开发.测试.扩展带来了极大的便利.本文以阿里云为例,阐述如何将Windows Server 的 ...

  2. 在线工具生成接入信息mqtt.fx快速接入阿里云

    在线工具生成接入信息mqtt.fx快速接入阿里云 在使用阿里云获取的三元组信息进行接入的时候,往往需要加密生成接入信息之后才能进行接入,因此我根据阿里云提供的加密工具实现了一个阿里云物联网平台mqtt ...

  3. CentOS: 将虚拟机迁移到 Azure (以阿里云为例)

    Azure 虚拟机能很容易地导出 vhd 并迁移到各种环境中,包含本地及云端环境,或者迁移至其他区域.这为开发.测试.扩展带来了极大的便利.因此本文以阿里云为例,阐述的是如何将 CentOS 6.8 ...

  4. 阿里云ECS 实例Centos7系统磁盘扩容

    需求:一台阿里云的数据盘磁盘空间不足,需要扩容,我这里只有一个主分区,ext4文件系统. 因为磁盘扩容场景不同,阿里云的文档比较全面一些,所以先奉上阿里云的文档,下面开始我的操作步骤: 1.登录控制台 ...

  5. 阿里云提示Discuz uc.key泄露导致代码注入漏洞uc.php的解决方法

    适用所有用UC整合 阿里云提示漏洞: discuz中的/api/uc.php存在代码写入漏洞,导致黑客可写入恶意代码获取uckey,.......... 漏洞名称:Discuz uc.key泄露导致代 ...

  6. 阿里云OSS不同账号之间的迁移

    目录 一.需求说明 二.Ossimport概述 三.配置运行环境 1.配置jdk环境 2.部署方式 3.下载并部署ossimport 四.修改单机Job的配置文件local_job.cfg 五.执行迁 ...

  7. 阿里云RDS数据库改造迁移方案

    1. 改造原因 (1) 由于历史原因, 本应该是同一个库的表分布在两个数据库中,需要对这两个库进行合并. (2) 已有的数据库性能无法满足业务的增长需要, 查询卡,慢问题突出. (3) 当前自建Mys ...

  8. 阿里云给自己实例扩容-扩展分区和文件系统_Linux系统盘

    阿里云买了台服务器ecs 磁盘容量40g 发现已经用了30g了  赶紧扩容 进入 e'cs实例 进入左边菜单 存储与快照 然后选择右边的扩容 然后支付 成功后 进入服务器 df -h 发现怎么还是没变 ...

  9. 使用 FTP 迁移 SQL Server 数据_迁移数据_快速入门(SQL Server)_云数据库 RDS 版-阿里云

    背景信息 阿里云数据库 SQL Server 版导入数据有如下限制: 仅支持导入 SQL Server 2005.SQL Server 2008.SQL Server 2008R2 版本数据 仅支持全 ...

随机推荐

  1. js 实现 文字打印效果

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. loading等待效果

    效果预览:这两个球一直在转,不能进行其他操作 div放在最外层 <div id="loadingImg" style="height: 100%;width: 10 ...

  3. Anaconda安装与常用命令及方法(深度学习入门1)

    Anaconda是一个软件发行版,它附带了 conda.Python 和 150 多个科学包及其依赖项. 安装Anaconda Anaconda分为Linux.Windows.Mac等版本,去 htt ...

  4. jQuery Cookie操作cookie

    jQuery cookie下载地址:http://plugins.jquery.com/cookie/ 使用jquery.cookie.js依赖于jquery 基本用法:   1. 创建cookie ...

  5. 关键字: simpledateformat24小时 格式串

    SimpleDateFormat 是 Java 中一个非常常用的类,该类用来对日期字符串进行解析和格式化输出   Era 标志符 Text AD y 年 Year 1996; 96 M 年中的月份 M ...

  6. 在Mac机器上给ITerm2配置lrzsz,便捷的传输文件到远程服务器上

    可直接参考文档:http://danqingdani.blog.163.com/blog/static/18609419520141201215750 需要使用到的github脚本:https://g ...

  7. HUD 1288 Hat's Tea(反向的贪心,非常好的一道题)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1288 Hat's Tea Time Limit: 2000/1000 MS (Java/Others)  ...

  8. 【Cmd命令行】基础—findstr与for循环

    Findstr命令 findstr是Window系统自带的命令,用途是查找指定的一个或多个文件文件中包含(或通过参数 /V来控制不包含)某些特定字符串的行,并将该行完整的信息打印出来,或者打印查询字符 ...

  9. unittest单元测试框架之测试套件(三)

    1.测试套件(注意:测试用例先添加先执行,后添加后执行,由此组织与设定测试用例的执行顺序) addTests:添加多个测试用例 addTest:添加单个测试用例 import unittest fro ...

  10. HP-UNIX平台修改Oracle processes参数报错:ORA-27154、ORA-27300、ORA-27301、ORA-27302

    OS 版本     :HP-UX B.11.31Oracle版本:11.2.0.4 (RAC) (一)问题描述 最近发现无法连接上数据库,报错信息为“ORA-00020:maximum number ...