记一次TIDB开启TLS失败导致PD扩容失败案例

作者: Dora 原文来源: https://tidb.net/blog/8ee8f295

问题背景

  1. 集群之前由于TIUP目录被删除导致TLLS证书丢失,后续需要重新开启TLS

  2. 在测试环境测试TLS开启步骤,导致后续两台PD扩容失败,步骤如下:

    1. 缩容两台PD
    2. 开启TLS
    3. 扩容原有的两台PD,最后PD启动的时候报错
    4. 集群Restart

集群重启后导致三台PD全部Down机,需要pd-recover恢复或者销毁集群重建恢复

注:TLS开启需要只保留一台PD,若有多台PD需要先缩容成1台

排查过程

TIUP日志排查

  1. 查看TIUP的日志,看到开启TLS的时候有报错
2024-01-04T16:11:00.718+0800    DEBUG   TaskFinish  {"task": "Restart Cluster", "error": "failed to stop: failed to stop: xxxx node_exporter-9100.service, please check the instance's log() for more detail.: timed out waiting for port 9100 to be stopped after 2m0s", "errorVerbose": "timed out waiting for port 9100 to be stopped after 2m0s\ngithub.com/pingcap/tiup/pkg/cluster/module.(*WaitFor).Execute\n\tgithub.com/pingcap/tiup/pkg/cluster/module/wait_for.go:91\ngithub.com/pingcap/tiup/pkg/cluster/spec.PortStopped\n\tgithub.com/pingcap/tiup/pkg/cluster/spec/instance.go:130\ngithub.com/pingcap/tiup/pkg/cluster/operation.systemctlMonitor.func1\n\tgithub.com/pingcap/tiup/pkg/cluster/operation/action.go:338\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.0.0-20220819030929-7fc1605a5dde/errgroup/errgroup.go:75\nruntime.goexit\n\truntime/asm_amd64.s:1594\nfailed to stop: 10.196.32.49 node_exporter-9100.service, please check the instance's log() for more detail.\nfailed to stop"}
2024-01-04T16:11:00.718+0800    INFO    Execute command finished    {"code": 1, "error": "failed to stop: failed to stop: xxxx node_exporter-9100.service, please check the instance's log() for more detail.: timed out waiting for port 9100 to be stopped after 2m0s", "errorVerbose": "timed out waiting for port 9100 to be stopped after 2m0s\ngithub.com/pingcap/tiup/pkg/cluster/module.(*WaitFor).Execute\n\tgithub.com/pingcap/tiup/pkg/cluster/module/wait_for.go:91\ngithub.com/pingcap/tiup/pkg/cluster/spec.PortStopped\n\tgithub.com/pingcap/tiup/pkg/cluster/spec/instance.go:130\ngithub.com/pingcap/tiup/pkg/cluster/operation.systemctlMonitor.func1\n\tgithub.com/pingcap/tiup/pkg/cluster/operation/action.go:338\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\tgolang.org/x/sync@v0.0.0-20220819030929-7fc1605a5dde/errgroup/errgroup.go:75\nruntime.goexit\n\truntime/asm_amd64.s:1594\nfailed to stop: 10.196.32.49 node_exporter-9100.service, please check the instance's log() for more detail.\nfailed to stop"}

PD日志排查

某一台PD启动的时候是http而不是https

image.png

问题大致明朗,在开启TLS的时候因为报错导致后续PD的配置有问题

复现过程

缩容PD

tiup cluster scale-in tidb-cc -N 172.16.201.159:52379

开启TLS

开启TLS的时候发现最后一步是修改PD的配置信息

+ [ Serial ] - Reload PD Members Update pd-172.16.201.73-52379 peerURLs [ https://172.16.201.73:52380 ]

[tidb@vm172-16-201-73 /tidb-deploy/cc/pd-52379/scripts]$ tiup cluster tls tidb-cc enable
tiup is checking updates for component cluster ...
A new version of cluster is available:
   The latest version:         v1.14.1
   Local installed version:    v1.12.3
   Update current component:   tiup update cluster
   Update all components:      tiup update --all

Starting component `cluster`: /home/tidb/.tiup/components/cluster/v1.12.3/tiup-cluster tls tidb-cc enable
Enable/Disable TLS will stop and restart the cluster `tidb-cc`
Do you want to continue? [y/N]:(default=N) y
Generate certificate: /home/tidb/.tiup/storage/cluster/clusters/tidb-cc/tls
+ [ Serial ] - SSHKeySet: privateKey=/home/tidb/.tiup/storage/cluster/clusters/tidb-cc/ssh/id_rsa, publicKey=/home/tidb/.tiup/storage/cluster/clusters/tidb-cc/ssh/id_rsa.pub
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.73
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.159
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.73
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.73
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.159
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.99
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.73
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.73
+ [Parallel] - UserSSH: user=tidb, host=172.16.201.73
+ Copy certificate to remote host
  - Generate certificate pd -> 172.16.201.73:52379 ... Done
  - Generate certificate tikv -> 172.16.201.73:25160 ... Done
  - Generate certificate tikv -> 172.16.201.159:25160 ... Done
  - Generate certificate tikv -> 172.16.201.99:25160 ... Done
  - Generate certificate tidb -> 172.16.201.73:54000 ... Done
  - Generate certificate tidb -> 172.16.201.159:54000 ... Done
  - Generate certificate prometheus -> 172.16.201.73:59090 ... Done
  - Generate certificate grafana -> 172.16.201.73:43000 ... Done
  - Generate certificate alertmanager -> 172.16.201.73:59093 ... Done
+ Copy monitor certificate to remote host
  - Generate certificate node_exporter -> 172.16.201.159 ... Done
  - Generate certificate node_exporter -> 172.16.201.99 ... Done
  - Generate certificate node_exporter -> 172.16.201.73 ... Done
  - Generate certificate blackbox_exporter -> 172.16.201.73 ... Done
  - Generate certificate blackbox_exporter -> 172.16.201.159 ... Done
  - Generate certificate blackbox_exporter -> 172.16.201.99 ... Done
+ Refresh instance configs
  - Generate config pd -> 172.16.201.73:52379 ... Done
  - Generate config tikv -> 172.16.201.73:25160 ... Done
  - Generate config tikv -> 172.16.201.159:25160 ... Done
  - Generate config tikv -> 172.16.201.99:25160 ... Done
  - Generate config tidb -> 172.16.201.73:54000 ... Done
  - Generate config tidb -> 172.16.201.159:54000 ... Done
  - Generate config prometheus -> 172.16.201.73:59090 ... Done
  - Generate config grafana -> 172.16.201.73:43000 ... Done
  - Generate config alertmanager -> 172.16.201.73:59093 ... Done
+ Refresh monitor configs
  - Generate config node_exporter -> 172.16.201.73 ... Done
  - Generate config node_exporter -> 172.16.201.159 ... Done
  - Generate config node_exporter -> 172.16.201.99 ... Done
  - Generate config blackbox_exporter -> 172.16.201.73 ... Done
  - Generate config blackbox_exporter -> 172.16.201.159 ... Done
  - Generate config blackbox_exporter -> 172.16.201.99 ... Done
+ [ Serial ] - Save meta
+ [ Serial ] - Restart Cluster
Stopping component alertmanager
        Stopping instance 172.16.201.73
        Stop alertmanager 172.16.201.73:59093 success
Stopping component grafana
        Stopping instance 172.16.201.73
        Stop grafana 172.16.201.73:43000 success
Stopping component prometheus
        Stopping instance 172.16.201.73
        Stop prometheus 172.16.201.73:59090 success
Stopping component tidb
        Stopping instance 172.16.201.159
        Stopping instance 172.16.201.73
        Stop tidb 172.16.201.159:54000 success
        Stop tidb 172.16.201.73:54000 success
Stopping component tikv
        Stopping instance 172.16.201.99
        Stopping instance 172.16.201.73
        Stopping instance 172.16.201.159
        Stop tikv 172.16.201.73:25160 success
        Stop tikv 172.16.201.99:25160 success
        Stop tikv 172.16.201.159:25160 success
Stopping component pd
        Stopping instance 172.16.201.73
        Stop pd 172.16.201.73:52379 success
Stopping component node_exporter
        Stopping instance 172.16.201.99
        Stopping instance 172.16.201.73
        Stopping instance 172.16.201.159
        Stop 172.16.201.73 success
        Stop 172.16.201.99 success
        Stop 172.16.201.159 success
Stopping component blackbox_exporter
        Stopping instance 172.16.201.99
        Stopping instance 172.16.201.73
        Stopping instance 172.16.201.159
        Stop 172.16.201.73 success
        Stop 172.16.201.99 success
        Stop 172.16.201.159 success
Starting component pd
        Starting instance 172.16.201.73:52379
        Start instance 172.16.201.73:52379 success
Starting component tikv
        Starting instance 172.16.201.99:25160
        Starting instance 172.16.201.73:25160
        Starting instance 172.16.201.159:25160
        Start instance 172.16.201.99:25160 success
        Start instance 172.16.201.73:25160 success
        Start instance 172.16.201.159:25160 success
Starting component tidb
        Starting instance 172.16.201.159:54000
        Starting instance 172.16.201.73:54000
        Start instance 172.16.201.159:54000 success
        Start instance 172.16.201.73:54000 success
Starting component prometheus
        Starting instance 172.16.201.73:59090
        Start instance 172.16.201.73:59090 success
Starting component grafana
        Starting instance 172.16.201.73:43000
        Start instance 172.16.201.73:43000 success
Starting component alertmanager
        Starting instance 172.16.201.73:59093
        Start instance 172.16.201.73:59093 success
Starting component node_exporter
        Starting instance 172.16.201.159
        Starting instance 172.16.201.99
        Starting instance 172.16.201.73
        Start 172.16.201.73 success
        Start 172.16.201.99 success
        Start 172.16.201.159 success
Starting component blackbox_exporter
        Starting instance 172.16.201.159
        Starting instance 172.16.201.99
        Starting instance 172.16.201.73
        Start 172.16.201.73 success
        Start 172.16.201.99 success
        Start 172.16.201.159 success
+ [ Serial ] - Reload PD Members
        Update pd-172.16.201.73-52379 peerURLs: [https://172.16.201.73:52380]
Enabled TLS between TiDB components for cluster `tidb-cc` successfully

模拟开启TLS的时候停止node_exports失败

查看member信息

[tidb@vm172-16-201-73 ~]$ tiup ctl:v7.1.1 pd -u https://172.16.201.73:52379 --cacert=/home/tidb/.tiup/storage/cluster/clusters/tidb-cc/tls/ca.crt --key=/home/tidb/.tiup/storage/cluster/clusters/tidb-cc/tls/client.pem --cert=/home/tidb/.tiup/storage/cluster/clusters/tidb-cc/tls/client.crt member

{
  "header": {
    "cluster_id": 7299695983639846267
  },
  "members": [
    {
      "name": "pd-172.16.201.73-52379",
      "member_id": 781118713925753452,
      "peer_urls": [
        "http://172.16.201.73:52380"
      ],
      "client_urls": [
        "https://172.16.201.73:52379"
      ],

发现 members中的peer_urls确实是http的而非https,复现成功

总结

  1. 开启TLS的时候失败,因为停止node_export失败,认为无关紧要,所以继续接下来的步骤
  2. 开启TLS最后一步是pd member的配置更新,停止node_export失败导致这一步没有正常执行
  3. 后续需要确保TLS开启成功后才能做下一步,也可以使用pd-ctl 查看member的情况
  4. 如果后续遇到此类情况,可以先关闭TLS,再次开启,开启的时候还遇到停止node_export时间过长,可以tiup执行时增加--wait-timeout参数以及手动kill 机器的node_export进程,确保TLS继续进行

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/798021.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Animate软件基础:库面板

“库”面板(“窗口”>“库”)是存储和组织在 Animate 中创建的元件的位置。还可以存储导入的文件,包括位图图形、声音文件和视频剪辑。 “库”面板可以在文件夹中组织库项目。 此外,可查看项目在文档中的使用频率,按…

JAVA从入门到精通之入门初阶(二)

1. 自动类型转换 自动类型转换:类型范围小的变量可以赋值给类型范围大的变量 byte->int public class java_7_10 {public static void main(String[] args) {//自动类型转换//类型范围小的变量可以赋值给类型范围大的变量 byte->intbyte a 12;int b a;//自动…

微信小程序密码 显示隐藏 真机兼容问题

之前使用type来控制&#xff0c;发现不行&#xff0c;修改为password属性即可 <van-fieldright-icon"{{passwordType password? closed-eye:eye-o}}"model:value"{{ password }}"password"{{passwordType password ? true: false}}"borde…

Linux rsync文件同步工具

scp的不足 1. 性能问题 单线程传输 SCP只使用单线程进行传输&#xff0c;这意味着在传输大文件或大量小文件时&#xff0c;其传输速度和效率可能不如其他多线程工具。 无法压缩数据传输 SCP不支持内置的压缩机制&#xff0c;这在传输大文件时会导致带宽使用效率较低。 2.…

自动驾驶事故频发,安全痛点在哪里?

大数据产业创新服务媒体 ——聚焦数据 改变商业 近日&#xff0c;武汉城市留言板上出现了多条关于萝卜快跑的投诉&#xff0c;多名市民反映萝卜快跑出现无故停在马路中间、高架上占最左道低速行驶、转弯卡着不动等情况&#xff0c;导致早晚高峰时段出现拥堵。萝卜快跑是百度 A…

WIN10开机突然,过一会就自动重启蓝屏DRIVER_IRQL_NOT_LESS_OR_EQUAL

环境&#xff1a; Win10 专业版 DELL7080 问题描述&#xff1a; WIN10开机突然&#xff0c;过一会就自动重启蓝屏DRIVER_IRQL_NOT_LESS_OR_EQUAL 事件日志 解决方案&#xff1a; 1.找到MEMORY.DMP文件内容&#xff0c;分析一下 Microsoft (R) Windows Debugger Version 10…

OSPF.hello数据包

网络掩码---接口发出hello时会携带该接口的掩码 在建立邻居关系时会比较两端设备的掩码&#xff0c;如果掩码不一致则会导致建邻失败------注意&#xff1a;只有以太网链路才会检擦掩码 hello时间和死亡时间&#xff0c;注意这两个参数如果两端对应不上则会导致建邻失败。 可…

【QT】窗口MainWindow

目录 窗口的组成 菜单栏 图形化创建菜单栏 代码创建菜单栏 给菜单设置快捷键 添加子菜单 添加分割线 添加图标 创建menuBar的细节 工具栏 设置工具栏出现的初始位置&#xff08;上下左右&#xff09; 设置工具栏允许停靠的位置 设置不允许浮动 设置不允许移动…

2024 CCF编程能力等级认证Python认证(GESP)一级介绍

目录 1. GESP概述1.1 CSP-J/S认证1.1.1 证书含金量&#xff1a; 2. GESP一级认证内容3. GESP一级认证形式4. 认证时间与报名5. 政策与福利6. 备考建议 1. GESP概述 CCF编程能力等级认证&#xff08;Grade Examination of Software Programming&#xff0c;简称GESP&#xff09…

第3章 Express 的请求与响应(一)

在本章中&#xff0c;我们将详细探讨如何在 Express 中处理 HTTP 请求与响应。这包括解析请求数据、设置响应数据、处理表单数据、使用查询参数等。理解这些内容是开发高效和功能丰富的 Web 应用程序的基础。 1 解析请求数据 在 Express 中&#xff0c;可以通过 req 对象访问…

如何搭建互联网医院系统源码?医疗陪诊APP开发实战详解

今天&#xff0c;小编将为大家讲解如何搭建一个完整的互联网医院系统源码&#xff0c;并介绍医疗陪诊APP的开发实战。 一、互联网医院系统的架构设计 搭建一个完整的互联网医院系统&#xff0c;需要从架构设计开始。一个典型的互联网医院系统通常包含以下几个核心模块&#xf…

iPhone 16 Pro系列将标配潜望镜头:已开始生产,支持5倍变焦

ChatGPT狂飙160天&#xff0c;世界已经不是之前的样子。 更多资源欢迎关注 7月6日消息&#xff0c;据DigiTimes最新报道&#xff0c;苹果将在iPhone 16 Pro中引入iPhone 15 Pro Max同款5倍光学变焦四棱镜潜望镜头。 报道称&#xff0c;目前苹果已经将模组订单交至大立光电和玉…

fortran简单排序算法,对一维、二维矩阵进行正序或倒序排序

fortran简单排序算法&#xff0c;对一维、二维矩阵进行正序或倒序排序 0. 引言1. 算法实现1.1 一维数组排序1.2 二维数组排序1.2 module文件 2. 结语 0. 引言 排序算法是计算机科学中的一项重要技术&#xff0c;它将一组数据按照特定的顺序排列起来。排序算法有很多种&#xff…

【STM32项目】基于嵌入式智能网控微嵌式远距操控平台(完整工程资料源码)

基于嵌入式智能网控微嵌式远距操控平台 目录&#xff1a; 前言: 一、项目前景调研 1.1 研究背景及意义 1.2 国内外发展现状及趋势 1.2.1 国内现状 1.2.2 国外发展现状 1.2.3 发展趋势 二、什么是嵌入式&#xff1f; 2.1 嵌入式系统概述 2.2 嵌入式系统的组成 2.3 嵌入式操作系统…

二分查找和斐波那契查找

这里写自定义目录标题 二分查找斐波那契查找二分查找改进B二分查找改进C 二分查找 int binSearch(int* arr, int lo, int hi,int target) {while (lo < hi){int mid lo ((hi - lo) >> 1);if (arr[mid] > target) hi mid;else if (arr[mid] < target) lo mi…

链路追踪系列-02.演示zipkin

当本机启动docker es zipkinServer之后&#xff1a; 启动3个项目&#xff1a;先eureka-server&#xff0c;再 PaymentMain8001,… 浏览器打开&#xff1a;http://localhost:9001/consumer/payment/zipkin consumer代码 &#xff1a; provider: 此时查询es:

html5——列表、表格

目录 列表 无序列表 有序列表 自定义列表 表格 基本结构 示例 表格的跨列 表格的跨行 列表 无序列表 <ul>【声明无序列表】 <li>河间驴肉火烧</li>【声明列表项】 <li>唐山棋子烧饼</li> <li>邯郸豆沫</li> <l…

香橙派AIpro:体验强劲算力,运行ROS系统

文章目录 前言一、香橙派AIpro开箱及功能介绍1.1香橙派AIpro开箱1.2香橙派AIpro功能介绍 二、香橙派AIpro资料下载及环境搭建2.1资料下载2.2环境搭建2.3使用串口启动进入开发板2.4使用HDMI线接入屏幕启动 三、部署ROS系统四、香橙派AIpro的使用和体验感受 前言 本篇文章将带体…

升级到LVGL9的一些变化(后续发现再补充)

目录 一、主要内容 二、新增内容 三、常规API变化 四、Display API(显示API) 五、其他 最近在将LVGL8的demo代码升级到LVGL9,带来不小的变化 ,收集网上的一些内容,整理如下: 一、主要内容 二、新增内容 三、常规API变化 四、Display API(显示API)

3.4、matlab实现SGM/BM/SAD立体匹配算法计算视差图

1、matlab实现SGM/BM/SAD立体匹配算法计算视差图简介 SGM&#xff08;Semi-Global Matching&#xff09;、BM&#xff08;Block Matching&#xff09;和SAD&#xff08;Sum of Absolute Differences&#xff09;都是用于计算立体匹配&#xff08;Stereo Matching&#xff09;的…