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

推荐订阅源

大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
H
Help Net Security
P
Privacy & Cybersecurity Law Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Help Net Security
Help Net Security
Hugging Face - Blog
Hugging Face - Blog
D
Docker
Security Archives - TechRepublic
Security Archives - TechRepublic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V2EX - 技术
V2EX - 技术
人人都是产品经理
人人都是产品经理
L
LINUX DO - 最新话题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google Online Security Blog
Google Online Security Blog
博客园 - 聂微东
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Latest news
Latest news
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Blog — PlanetScale
Blog — PlanetScale
C
Cisco Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
Webroot Blog
Webroot Blog
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
Recent Commits to openclaw:main
Recent Commits to openclaw:main
The Register - Security
The Register - Security
Simon Willison's Weblog
Simon Willison's Weblog
A
Arctic Wolf
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
Y
Y Combinator Blog
Last Week in AI
Last Week in AI
S
Securelist
Cloudbric
Cloudbric
G
GRAHAM CLULEY
M
MIT News - Artificial intelligence
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
Visual Studio Blog
S
Schneier on Security
Engineering at Meta
Engineering at Meta

博客园 - 一起走过的路

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'