
MySql
文章平均质量分 68
lixora
MIchael.Huang_lixora 这个blog是个人学习的的一个札记筒,用以记录在学习,工作,生活上的所思,所想
展开
-
MySQL 中的元数据管理
前面介绍数据字典是 MySQL 维护元数据的模块,MySQL 真正操作表数据是基于表定义对象 TABLE,和存储引擎和数据打交道,每个 TABLE 内有一个handler,表示使用的引擎对象,Innodb 引擎对应的表定义信息是 dict_table_t,TABLE 对表保留有操作数据的必备的信息,如表及字段的特征信息,元数据锁,record 查找结果等。每次执行 SQL 时,都会将涉及的表列表(TABLE_LIST,如 Join 多个表)逐个 open,转载 2023-11-10 10:26:45 · 341 阅读 · 0 评论 -
如何判断mysql innodb buffer pool内存配置不足
1234567891011121314151617181920212223242526272829。原创 2023-10-25 09:31:03 · 234 阅读 · 0 评论 -
Configuring MySQL for a SSD based SAN
In this DocumentConsidering a Virtualized environment with a SSD based SAN, what are the configuration parameters to be modified and their suggested values. Usually the SAN is not exposed to the VM directly. Instead VMs use the file system exposed by t原创 2023-05-23 11:30:01 · 239 阅读 · 0 评论 -
MySQL Log Messages: page_cleaner: 1000ms intended loop took 8120ms.
In this DocumentGuidance for configuring the server when seeing these messages frequently:[Note] InnoDB: page_cleaner: 1000ms intended loop took 4120ms. The settings might not be optimal. (flushed=0 and evicted=85273, during the time.) [Note] InnoDB: pa原创 2023-03-29 17:23:44 · 574 阅读 · 0 评论 -
dbdeployer 使用札记
可以通过dbdeplyoer defaults export导出并修改配置或者直接通过dbdeployer defaults update来更新默认文件,默认配置文件为当前用户的$HOME/.dbdeployer/config.json作为配置文件,##安装单实例Percona Server。#部署一套1M1S的gtid复制集群。配置文件包含MySQL初始信息。##部署mysql 单实例环境。##下载在线tarball。原创 2023-02-17 10:48:48 · 435 阅读 · 0 评论 -
mysql 8.0 版本innodb 内存管理锁 buffer pool mutex 变化
mysql 8.0 由原来的一个大buffer pool mutex被拆分成多个为free_list, LRU_list, zip_free, 和zip_hash单独使用mutex:原创 2022-09-08 15:01:29 · 624 阅读 · 0 评论 -
mysql binlog redelog 2阶段提交如何保障一致性?
当在3之前崩溃 重启恢复:虽没有commit,但满足prepare和binlog完整,所以重启后会自动commit。备份:有binlog. 一致。binlog和redolog 有一个共同的数据字段,叫XID。2.如果碰到只有prepare、而没有commit的redo log,就拿着XID去binlog找对应的事务。当在2之前崩溃时 重启恢复:后发现没有commit,回滚。备份恢复:没有binlog。1.如果碰到既有prepare、又有commit的redo log,就直接提交。原创 2022-09-08 11:22:08 · 435 阅读 · 0 评论 -
MySQL是否有必要使用REPEATABLE READ事务隔离级别?
2.RR 隔离级别下,只有select 操作在整个事务期间使用一个 readview ,而dml 操作(insert update,delete)都是read commit(每个操作单独一个readview) 的;1.RR级别在MySQL里意味着在一个事务活跃期间,快照会一直打开,这可能会导致Undo/垃圾数据不能及时清理,Undo空间膨胀。没啥业务上必须的理由,尽量用RC。| 20593 |自己事务里的操作是对自己可见的,直接剪掉affected rows 的计数 20594 -1=20593。..原创 2022-08-17 15:57:08 · 508 阅读 · 0 评论 -
mysql 数据库遭遇 Loki 加密勒索病毒数据恢复
mysql 勒索病毒loki 加密数据恢复原创 2022-07-11 11:43:38 · 2578 阅读 · 0 评论 -
innodb 索引系列(2)为什么mysql 建议使用自增主键
##为什么mysql 建议innodb 表使用自增主键?1.使数据插入变成顺序IO,减少随机IO,避免索引页(branch page)/leaf block 重组,分裂;2.节约ibd文件物理存储空间,节省物理IO(随机IO)浪费原创 2022-04-15 22:39:24 · 437 阅读 · 0 评论 -
关于数据库索引的一些札记(1)
##leaf blocks 为什么b+tree索引叶子块 叶块上有上双向链表?为了避免由于范围查询扫描( 类似 < 10 ,>10 等谓词条件查询)导致的重复branch blocks 扫描浪费IO,增加查询延时,可以直接扫描leaf blocks 定位(leaf block 是逻辑上有序的,leaf block 中有pre block 块位置偏移,next block 块位置偏移 )...原创 2022-04-08 14:25:24 · 748 阅读 · 0 评论 -
Mysql 如何通过索引定位一条数据
eg:Select * from abc.lixora a where a.id=100;根据sql 解析完成后知道表,根据元数据知道对应的ibd 物理文件,读取ibd inode 相关信息(leaf segment,non-leaf segment),获取索引组织表的root index page ,读取 root index page到内存里,(根据key 分布找到下一级non-leaf block),根据key 值找到最终的leaf page(在非叶子节点中利用索引页内的页目录...原创 2022-04-08 14:16:37 · 1483 阅读 · 0 评论 -
[ERROR] [MY-013183] [InnoDB] Assertion failure: ut0ut.cc:555
mysql 8025 故障日志:2022-02-23T13:59:27.477020Z 0 [Warning] [MY-010909] [Server] /root/opt/mysql/8.0.25/bin/mysqld: Forcing close of thread 8 user: 'root'.2022-02-23T13:59:27.926166Z 0 [System] [MY-010910] [Server] /root/opt/mysql/8.0.25/bin/mysqld: Shutd.原创 2022-02-23 14:51:55 · 3122 阅读 · 0 评论 -
windows 平台innodb page 解析工具 (golang开发)
C:\Users\Administrator\page_stream>page_stream.exe!!! Please input tablespace file(path)##--------------------------------------------------------#### Copy right 2021-2099 powered by HuangLinJie 177-6715-1782## Usage: ./page_stream -f ./lixora/bi..原创 2022-01-10 11:43:37 · 625 阅读 · 0 评论 -
不要随意乱用innodb_force_recovery 参数,修复物理page 损坏
##故障日志InnoDB: End of page dumpInnoDB: Page may be an insert buffer bitmap page2021-12-13T11:17:43.257770Z 0 [ERROR] [MY-011899] [InnoDB] [FATAL] Unable to read page [page id: space=2, page number=1] into the buffer pool after 100 attempts. The most pro原创 2021-12-13 15:44:13 · 1644 阅读 · 0 评论 -
mysql page 类型汇总
File page types (values of FIL_PAGE_TYPE) 十六进制 十进制 解释 备注 FIL_PAGE_INDEX 45bf 17855 /** B-tree node */B+树(leaf,non-leaf page) ,每个B+ tree使用两个segment来管理page,分别是leaf node segment(叶子节点segment)和non-leaf node...原创 2021-12-06 21:35:22 · 737 阅读 · 0 评论 -
[ERROR] Can‘t find messagefile ‘/monitor/mysql/share/mysql/errmsg.sys‘
报错信息:在使用 root 用户直接运行 #mysqld_safemysql无法启动报错如下2018-03-02 16:29:06 27644 [Note]180302 16:29:06 mysqld_safe mysqld from pid file /monitor/mysql/data/service2.pid ended2018-03-02 16:29:03 27644 [ERROR]...原创 2021-12-06 21:33:40 · 227 阅读 · 0 评论 -
InnoDB: broken FIL_PAGE_NEXT or FIL_PAGE_PREV links 异常处理
##问题描述 研发兄弟反馈说,他们的数据库中有一些表不能正常查询。开发同学在线cats 操作复制测试表,导致linux 服务器目录空间满,然后他们自己强制重启了mysql。。。。。。mysql-lixora > select * from test_part;ERROR 2013 (HY000): Lost connection to MySQL server during query##故障日志:2021-12-01T01:28:14.280281Z 8 [E...原创 2021-12-01 15:03:29 · 1269 阅读 · 0 评论 -
札记:64G 服务器 MySQL 8.0 my.cnf 数据库参数配置参考
### my.cnf for 8.0版本## author: yejr(yejinrong@zhishutang.com, http://imysql.com, QQ: 4700963)#### 叶金荣(yejr)## 国内知名MySQL专家,MySQL布道师,Oracle MySQL ACE Director,腾讯云TVP成员。## 微信公众:老叶茶馆(imysql_wx), 博客:https://imysql.com## QQ群: 125572178## 注意:个别建议可能需要根据实际情原创 2021-08-25 09:31:10 · 997 阅读 · 0 评论 -
MySQL-5.7 基于GTID及多线程的主从复制 ,集群监控,管理,切换平台 高可用方案
Mysql容灾环境规划 主机名 IP/Port ROLE OS Version MySQL Version GTID Mode Binlog Format MTS Lixora 192.168.1.99/3306 master CentOS 7.1 ..原创 2021-08-24 16:00:40 · 501 阅读 · 0 评论 -
IMPLEMENTATION OF THE BUFFER POOL----mysql buffer pool 的实现机制原理
IMPLEMENTATION OF THE BUFFER POOL =================================Performance improvement:------------------------Thread scheduling in NT may be so slow that the OS wait mechanism shouldnot be used even in waiting for disk reads to co...原创 2021-04-23 10:02:13 · 140 阅读 · 0 评论 -
mysql 5.7 truncate table 导致的 System lock
在线上truncate 了一张2000w 的表:mysql [localhost:5724] {root} (test) > truncate table t1;Query OK, 0 rows affected (1 min 37.19 sec)发现全局系统都慢了一下,processlist 中发现truncate操作处于system lockmysql [localh...原创 2019-08-23 10:53:03 · 2545 阅读 · 1 评论 -
mysql 删除主键索引和重建主键索引的一些理解
mysql [localhost:5642] {msandbox} (test) >mysql [localhost:5642] {msandbox} (test) > show keys from geek;+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+-----原创 2021-01-08 10:51:18 · 1549 阅读 · 0 评论 -
mysql OPTIMIZE TABLE 对数据库的影响
Which Locks Does OPTIMIZE TABLE Take? (文档 ID 1910515.1) 转到底部 APPLIES TO: MySQL Server - Version 4.0 and later Information in this document applies to any platform. GOAL Learn what the impact of executingOPTIMIZE TABLEis ...原创 2020-12-18 14:23:25 · 785 阅读 · 0 评论 -
InnoDB: Database page corruption on disk or a failed 服务器磁盘损坏,mysql ibd 数据恢复
2020-09-26T02:08:47.027083Z 0 [Note] InnoDB: Starting crash recovery.2020-09-26T02:08:47.027083Z 0 [Note] InnoDB: Reading tablespace information from the .ibd files...2020-09-26T02:08:47.068115Z 0 [Note] InnoDB: Restoring possible half-written data page.原创 2020-09-30 09:35:42 · 737 阅读 · 0 评论 -
How To Skip a Transaction When GTIDs Are Enabled? (Doc ID 2043205.1)
How To Skip a Transaction When GTIDs Are Enabled? (Doc ID 2043205.1) To Bottom Goal Solution References APPLIES TO: MySQL Server - Version 5.6 and later Information in this document applies ...原创 2020-09-03 11:49:30 · 202 阅读 · 0 评论 -
Clone a Replication Slave From a Live Master using Global Transaction IDs (GTID) and mysqldump (Doc
Clone a Replication Slave From a Live Master using Global Transaction IDs (GTID) and mysqldump (Doc ID 1589291.1) To Bottom In this Document Goal Solution References APPLIES TO: MySQL Serve...原创 2020-09-03 11:33:26 · 139 阅读 · 0 评论 -
mysql: Change Replication Topology A->B,C to A->B->C (Doc ID 1444892.1)
Change Replication Topology A->B,C to A->B->C (Doc ID 1444892.1) To Bottom In this Document APPLIES TO: MySQL Server - Version 5.5 and later Information in this document applies to any platform. GOAL Change from mas原创 2020-09-03 11:26:04 · 187 阅读 · 0 评论 -
Mysql 5.7 主从高可用容灾 最佳实践
Mysql容灾环境规划 主机名 IP/Port ROLE OS Version MySQL Version GTID Mode Binlog Format Lixora 192.168.1.99/3306 master CentOS 7.1 5.7.24原创 2020-09-01 15:34:48 · 1418 阅读 · 0 评论 -
mysql 启动异常处理:[ERROR] InnoDB: Operating system error number 13 in a file operation.
###问题日志:2020-07-16T01:26:34.626656Z 0 [Note] InnoDB: Highest supported file format is Barracuda.2020-07-16T01:26:34.671803Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.2020-07-16T01:26:34.671866Z 0 [ERROR] InnoDB: The error m原创 2020-07-16 10:00:41 · 2055 阅读 · 0 评论 -
MySQL innodb DUL 数据文件离线抽取工具 undrop-for-innodb-windows
花了一点时间做了一个window版的 undrop for innodb ,用于windows 平台误操作(delete,drop,truncate)数据恢复,同时支持window 平台文件系统损坏时,在底层文件系统上上进行mysql ibd 挖掘,尽可能的恢复mysql 数据;mysql innodb dul for windows 平台undrop-for-innodb-windowsmysql 紧急技术恢复服务热线:1565865544 7...原创 2020-07-14 22:55:18 · 791 阅读 · 0 评论 -
mysql ibd 数据文件恢复极速恢复工具 ibd recover tool
mysql ibd 数据文件恢复极速恢复最近不少朋友遇到mysql 丢失ibddata 数据文件或者文件系统损坏只有部分ibd 文件的故障找我来帮忙处理,有些朋友的环境有几百上千个ibd 文件,手动恢复着实麻烦,写了一个工具,批量恢复mysql innodb,(myasim) ibd 的工具,目前可以在windows 和linux运行;mysql 的文件解析还是有点累的,搞得有点想吐ibd...原创 2020-04-26 10:49:37 · 2671 阅读 · 4 评论 -
mysql internal: ALTER TABLE ... IMPORT TABLESPACE 操作原理
WhenALTER TABLE ... IMPORT TABLESPACEis run on the destination instance, the import algorithm performs the following operations for the tablespace being imported: Each tablespace page is checked ...原创 2020-04-01 09:07:31 · 2716 阅读 · 0 评论 -
mysql 数据库健康巡检 报告
最近花了点时间做了一个mysql 和 postgresql 的数据库健康巡检报告;原创 2020-03-09 09:17:30 · 1887 阅读 · 0 评论 -
"Error: 2013, Lost connection to MySQL server at 'reading authorization packet'" in MySQL Server
"Error: 2013, Lost connection to MySQL server at 'reading authorization packet'" in MySQL Server Error Log (Doc ID 1024157.1) To Bottom APPLIES TO: MySQL Server - Version 4.0 and lat...原创 2020-02-17 22:23:55 · 881 阅读 · 0 评论 -
mysql top sql 查看
###语句兼容mysql 5.6,5.7,8.0###top 10 sql:SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR, sys.format_time ( SUM_TIMER_WAIT ) AS sum_time, sys.format_time ( MIN_TIMER_WAIT ) AS min_t...原创 2019-11-19 15:07:56 · 1864 阅读 · 4 评论 -
mysql 5.6 以后版本union all 操作优化
mysql 5.6 vs 5.7 vs 8.0 版本优化器参数对比:mysql 5.6.42@@optimizer_switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condit...原创 2019-11-08 15:11:30 · 929 阅读 · 0 评论 -
mysql 在线表迁移 :alter table “move”
1)file-per-table tablespace 、system tablespace -----》 generaltablespaceALTER TABLE tbl_name TABLESPACE [=] tablespace_name;eg:alter table t1 tablespace ts1;move 完table后表原来的ibd 文件会被删除;2)...原创 2019-10-16 15:12:26 · 676 阅读 · 1 评论 -
mysql 杂记 *dir 目录的理解
The innodb_data_home_dir default value is the MySQL data directory (datadir). innodb_data_home_dir :The common part of the directory path for InnoDB system tablespace data files. innodb_data_file_path...原创 2018-06-14 12:36:27 · 493 阅读 · 0 评论 -
mysql sql_mode 使用
mysql>use lixora;mysql> CREATE TABLE t5(id int(11)) ENGINE=InnoDBdddddddd;ERROR 1286 (42000): Unknown storage engine 'InnoDBdddddddd'mysql> SELECT @@sql_mode;+-----------------------------原创 2015-12-13 16:05:15 · 621 阅读 · 0 评论