innodb结构解析工具---innodb_ruby
1.下载ruby并安装ruby:
ftp://ftp.ruby-lang.org/pub/ruby/
ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.3-stable.tar.gz
tar -xvf ruby-2.3-stable.tar.gz
cd ruby-2.3.1
./configure
make
make install
2.下载rubygems:
https://rubygems.global.ssl.fastly.net/rubygems/rubygems-2.6.4.zip (到https://rubygems.org/ 首页找的rubygems下载地址)
cd rubygems-2.6.4
ruby setup.rb
3.下载并安装innodb_ruby
https://rubygems.org/gems/innodb_ruby (进入rubygems官网去找下载链接)
https://rubygems.global.ssl.fastly.net/gems/innodb_ruby-0.9.13.gem (浏览器下载)
wget https://rubygems.global.ssl.fastly.net/rubygems/rubygems-2.6.4.zip --no-check-certificate (wget下载)
gem install innodb_ruby-0.9.13.gem
[root@localhost ~]# gem -v
2.6.
[root@localhost ~]# gem list |grep innodb
innodb_ruby (0.9.13)
4.innodb_ruby使用文档:
https://github.com/jeremycole/innodb_ruby/wiki
https://blog.jcole.us/2013/01/03/a-quick-introduction-to-innodb-ruby/
https://blog.jcole.us/2014/10/02/visualizing-the-impact-of-ordered-vs-random-index-insertion-in-innodb/
http://luodw.cc/2016/03/15/innodb03/
5.实例:
进入到mysql数据目录:/data [root@localhost data]# innodb_space -s ibdata1 system-spaces
name pages indexes
(system)
mysql/innodb_index_stats
mysql/innodb_table_stats
mysql/slave_master_info
mysql/slave_relay_log_info
mysql/slave_worker_info
test/t1
test/test1
test/test_auto_increment
test/test_char
test/test_ci
test/test_int_n
test/test_time
test/test_unsigned
查看表t1索引
[root@localhost data]# innodb_space -s ibdata1 -T test/t1 space-indexes
id name root fseg used allocated fill_factor
PRIMARY internal 100.00%
PRIMARY leaf 100.00%
[root@localhost data]# innodb_space -s ibdata1 -T test/t1 space-indexes
id name root fseg used allocated fill_factor
PRIMARY internal 100.00%
PRIMARY leaf 100.00%
You have new mail in /var/spool/mail/root
[root@localhost data]# innodb_space -s ibdata1 -T test/t1 space-lsn-age-illustrate Start Page ╭────────────────────────────────────────────────────────────────╮
│███████ │
╰────────────────────────────────────────────────────────────────╯ Legend (█ = page):
Min LSN <─────────────────────────────────────────> Max LSN
███████████████████████████████████████████
$ irb -r innodb
> sys = Innodb::System.new("ibdata1")
> idx = sys.index_by_name("test/t1", "PRIMARY")
> rec = idx.binary_search([])
[root@localhost data]# innodb_space -s ibdata1 -T test/test1 space-extents-illustrate Start Page ╭────────────────────────────────────────────────────────────────╮
│███▁?? │
╰────────────────────────────────────────────────────────────────╯ Legend (█ = page):
Page Type Pages Ratio
█ System 50.00%
█ Index (test/test1.GEN_CLUST_INDEX) 16.67%
? Free space 33.33%
[root@localhost data]# innodb_space -f test/t1.ibd space-page-type-regions
start end count type
FSP_HDR
IBUF_BITMAP
INODE
INDEX
FREE (ALLOCATED)
[root@localhost data]# innodb_space -f test/t1.ibd -p page-dump
#<Innodb::Page::Index:0x007f798307d970>: fil header:
{:checksum=>,
:offset=>,
:prev=>nil,
:next=>nil,
:lsn=>,
:type=>:INDEX,
:flush_lsn=>,
:space_id=>} page header:
{:n_dir_slots=>,
:heap_top=>,
:garbage_offset=>,
:garbage_size=>,
:last_insert_offset=>,
:direction=>:right,
:n_direction=>,
:n_recs=>,
:max_trx_id=>,
:level=>,
:index_id=>,
:n_heap=>,
:format=>:compact} fseg header:
{:leaf=>
<Innodb::Inode space=<Innodb::Space file="test/t1.ibd", page_size=, pages=>, fseg=>,
:internal=>
<Innodb::Inode space=<Innodb::Space file="test/t1.ibd", page_size=, pages=>, fseg=>} sizes:
header
trailer
directory
free
used
record
per record 14.00 page directory:
[, ] system records:
{:offset=>,
:header=>
{:next=>,
:type=>:infimum,
:heap_number=>,
:n_owned=>,
:min_rec=>false,
:deleted=>false,
:length=>},
:next=>,
:data=>"infimum\x00",
:length=>}
{:offset=>,
:header=>
{:next=>,
:type=>:supremum,
:heap_number=>,
:n_owned=>,
:min_rec=>false,
:deleted=>false,
:length=>},
:next=>,
:data=>"supremum",
:length=>} garbage records: records:
{:format=>:compact,
:offset=>,
:header=>
{:next=>,
:type=>:node_pointer,
:heap_number=>,
:n_owned=>,
:min_rec=>true,
:deleted=>false,
:length=>},
:next=>} {:format=>:compact,
:offset=>,
:header=>
{:next=>,
:type=>:node_pointer,
:heap_number=>,
:n_owned=>,
:min_rec=>false,
:deleted=>false,
:length=>},
:next=>} {:format=>:compact,
:offset=>,
:header=>
{:next=>,
:type=>:node_pointer,
:heap_number=>,
:n_owned=>,
:min_rec=>false,
:deleted=>false,
:length=>},
:next=>}
[root@localhost data]# innodb_space -f test/t1.ibd space-index-pages-summary
page index level data free records
innodb结构解析工具---innodb_ruby的更多相关文章
- Win32汇编-编写PE结构解析工具
汇编语言(assembly language)是一种用于电子计算机.微处理器.微控制器或其他可编程器件的低级语言,亦称为符号语言.在汇编语言中,用助记符(Mnemonics)代替机器指令的操作码,用地 ...
- 手写PE结构解析工具
PE格式是 Windows下最常用的可执行文件格式,理解PE文件格式不仅可以了解操作系统的加载流程,还可以更好的理解操作系统对进程和内存相关的管理知识,而有些技术必须建立在了解PE文件格式的基础上,如 ...
- Golang Json文件解析为结构体工具-json2go
代码地址如下:http://www.demodashi.com/demo/14946.html 概述 json2go是一个基于Golang开发的轻量json文件解析.转换命令行工具,目前支持转换输出到 ...
- MySQL Binlog 解析工具 Maxwell 详解
maxwell 简介 Maxwell是一个能实时读取MySQL二进制日志binlog,并生成 JSON 格式的消息,作为生产者发送给 Kafka,Kinesis.RabbitMQ.Redis.Goog ...
- (转)AVI文件格式解析+AVI文件解析工具
AVI文件解析工具下载地址:http://download.csdn.net/detail/zjq634359531/7556659 AVI(Audio Video Interleaved的缩写)是一 ...
- Redis源码剖析--源码结构解析
请持续关注我的个人博客:https://zcheng.ren 找工作那会儿,看了黄建宏老师的<Redis设计与实现>,对redis的部分实现有了一个简明的认识.在面试过程中,redis确实 ...
- InfluxDB源码目录结构解析
操作系统 : CentOS7.3.1611_x64 go语言版本:1.8.3 linux/amd64 InfluxDB版本:1.1.0 influxdata主目录结构 [root@localhost ...
- redis源代码结构解析
看了黄建宏老师的<Redis设计与实现>,对redis的部分实现有了一个简明的认识: 之前面试的时候被问到了这部分的内容,没有关注,好在还有时间,就把Redis的源码看了一遍. Redis ...
- vue(16)vue-cli创建项目以及项目结构解析
vue-cli创建项目 上一篇我们安装了vue-cli,接下来我们就使用该脚手架进行创建项目 1.进入一个目录,创建项目 创建项目命令如下: vue create <Project Name&g ...
随机推荐
- Python 基础 字符串拼接 + if while for循环
注释单行注释 #多行注释 ''' 三个单引号或者三个双引号 """ ''' 用三引号引住可以多行赋值 用户交互 input 字符串拼接 + ""%( ...
- APCS
arm汇编程序中,R0,R1,R2,R3,R12都是作为中间寄存器,而R4-R11是不能随便使用的,暂时我还不知它们的用途.所以,中间寄存器,在程序运行的开始处与结束的时候值是可以不一样的,也就是说中 ...
- iOS应用如何支持IPV6-b
果然是苹果打个哈欠,iOS行业内就得起一次风暴呀.自从5月初Apple明文规定所有开发者在6月1号以后提交新版本需要支持IPV6-Only的网络,大家便开始热火朝天的研究如何支持IPV6,以及应用中哪 ...
- JDK源码阅读(三) Collection<T>接口,Iterable<T>接口
package java.util; public interface Collection<E> extends Iterable<E> { //返回该集合中元素的数量 in ...
- 1、Window10 Electron 开发环境搭建
1:首先安装nodejs C:\Users\yan>node -v v4.5.0 2:安装Electron C:\Users\yan>npm install --g electron-pr ...
- Qt学习笔记网络(URL和下载的功能都有)
http://www.cnblogs.com/li-peng/p/3656613.html
- Android 中LocalBroadcastManager的使用方式
Android 中LocalBroadcastManager的使用方式 在android-support-v4.jar中引入了LocalBroadcastManager,称为局部通知管理器,这种通知的 ...
- c++ 名字粉碎(name mangling)
转自Ibm: Name mangling is the encoding of function and variable names into unique names so that linker ...
- Linux数据备份
今天需要用到备份网站,写了个脚本,备份了mysql和redis数据. #!/bin/bash BACKDIR="/home/tan/getll_backup" if [ ! -d ...
- MySQL的Grant命令
来源:http://yingxiong.javaeye.com/blog/451208 本文实例,运行于 MySQL 5.0 及以上版本. MySQL 赋予用户权限命令的简单格式可概括为: gra ...