惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
S
Security @ Cisco Blogs
V
Visual Studio Blog
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
爱范儿
爱范儿
B
Blog RSS Feed
Recorded Future
Recorded Future
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
博客园 - 司徒正美
U
Unit 42
G
Google Developers Blog
博客园 - Franky
阮一峰的网络日志
阮一峰的网络日志
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
博客园 - 【当耐特】
腾讯CDC
博客园 - 聂微东
IT之家
IT之家
Martin Fowler
Martin Fowler
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements
The Register - Security
The Register - Security
PCI Perspectives
PCI Perspectives
C
Check Point Blog
AI
AI
Webroot Blog
Webroot Blog
I
Intezer
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
L
LangChain Blog
C
Cybersecurity and Infrastructure Security Agency CISA
S
Schneier on Security
C
CERT Recently Published Vulnerability Notes
Forbes - Security
Forbes - Security
S
Secure Thoughts
Y
Y Combinator Blog
Google Online Security Blog
Google Online Security Blog
H
Heimdal Security Blog
有赞技术团队
有赞技术团队
L
Lohrmann on Cybersecurity

博客园 - 一起走过的路

Nginx GeoIP2 模块编译安装与配置指南(附防国外访问实战) MySQL查询当前连接数的语句 Apollo批量给新创建的用户授可编辑权限 物理机Jenkins接入K8s环境 ingress配置https报错certificate.lua:259: call(): failed to set DER private key: d2i_PrivateKey_bio() failed, context: ssl_certificate_by_lua* elk收集分析nginx日志,并绘制图形 Zabbix Scheduled reports中文乱码 Jenkins合并代码Git报错处理过程 nginx集群同步方案 zabbix密码复杂度有效期安全增强,符合三级等保要求。 archery关闭导出功能 自动同步bing壁纸 CentOS7更新OpenSSH8 elk监听Java日志发送微信报警 OPENVPN 同时连接多个VPN - 一起走过的路 nginx拒绝国外IP访问 keepalived健康检查及双主MySQL健康检查脚本 执迷不悟 splunk设置索引周期和索引大小
kubernetes mysql-StatefulSet报错处理
一起走过的路 · 2022-04-22 · via 博客园 - 一起走过的路

我们使用网上mysql-StatefulSet集群教程时候mysql-1启动错误,init-error。

第一次尝试解决:我从官网上下载yaml部署依然报错。

第二次尝试解决:网上换各种版本的yaml部署依旧报错。

第三次尝试解决:自己手动加mysql集群密码,依旧报密码错误之类的问题。

第四次尝试解决:不用动态PVC模式,手动创建pv。依旧报错

第五次尝试解决:删除动态pvc和sc  nfs-client-provisioner 等等,使用网上n多版本的依旧报错。

第六次尝试解决:更换xtrabackup image,依旧报错

第n次尝试解决:心态早崩溃了,尼玛官网给的yaml都不行。让我怎么弄啊。

第n+1次尝试解决:手动创建xtrabackup pod,进去一探究竟。终于水落石出。

查看报错内容如下:

[root@master mysql]# kubolor logs -f mysql-1 -c clone-mysql
+ [[ -d /var/lib/mysql/mysql ]]
++ hostname
+ [[ mysql-1 =~ -([0-9]+)$ ]]
+ ordinal=1
+ [[ 1 -eq 0 ]]
+ ncat --recv-only mysql-0.mysql 3307
+ xbstream -x -C /var/lib/mysql
+ xtrabackup --prepare --target-dir=/var/lib/mysql
xtrabackup version 2.4.4 based on MySQL server 5.7.13 Linux (x86_64) (revision id: df58cf2)
xtrabackup: cd to /var/lib/mysql
xtrabackup: Error: cannot open ./xtrabackup_checkpoints
xtrabackup: error: xtrabackup_read_metadata()
xtrabackup: This target seems not to have correct metadata...
InnoDB: Number of pools: 1
InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
xtrabackup: Warning: cannot open ./xtrabackup_logfile. will try to find.
InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
  xtrabackup: Fatal error: cannot find ./xtrabackup_logfile.
xtrabackup: Error: xtrabackup_init_temp_log() failed.

 查看各种资料,这个报错是因为/var/lib/mysql没有文件。所以恢复失败。有了原因就知道怎么处理了,先保留一下想法,你们留言发挥一下怎么解决吧。我真的快疯了。

2022年9月15日补充,过了这么久很快有要忘了。赶紧补习一下知识。其实就是官方文档没有指定datadir=/var/lib/mysql的问题。在configmap里写好就行了。下面是我的configmap.yaml配置文件

apiVersion: v1
kind: ConfigMap
metadata:
  name: mysql
  namespace: default
  labels:
    app: mysql
data:
  master.cnf: |
    # Apply this config only on the master.
    [client]
    default-character-set=utf8mb4
    [mysql]
    default-character-set=utf8mb4
    [mysqld]
    log-bin
    datadir=/var/lib/mysql
    default-time_zone = '+8:00'
    max_connections=3000
    character-set-server=utf8mb4
    collation-server=utf8mb4_unicode_ci
    init_connect='SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'
  slave.cnf: |
    # Apply this config only on slave.
    [client]
    default-character-set=utf8mb4
    [mysql]
    default-character-set=utf8mb4
    [mysqld]
    super-read-only
    datadir=/var/lib/mysql
    default-time_zone = '+8:00'
    max_connections=3000
    character-set-server=utf8mb4
    collation-server=utf8mb4_unicode_ci
    init_connect='SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'