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

推荐订阅源

WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
V
V2EX
T
Tailwind CSS Blog
N
News | PayPal Newsroom
The Cloudflare Blog
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
C
Cyber Attacks, Cyber Crime and Cyber Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
V
Vulnerabilities – Threatpost
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Threat Research - Cisco Blogs
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
T
Threatpost
U
Unit 42
T
The Exploit Database - CXSecurity.com
I
Intezer
爱范儿
爱范儿
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - Franky
Spread Privacy
Spread Privacy
A
Arctic Wolf
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News and Events Feed by Topic
Google Online Security Blog
Google Online Security Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Recorded Future
Recorded Future
The Register - Security
The Register - Security
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
H
Help Net Security
Schneier on Security
Schneier on Security
P
Proofpoint News Feed
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
K
Kaspersky official blog
C
Check Point Blog
小众软件
小众软件
A
About on SuperTechFans
博客园 - 【当耐特】
IT之家
IT之家

博客园 - 一起走过的路

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'