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 ...
随机推荐
- 2016030203 - 首次将内容推送到github中
参考网址:http://www.cnblogs.com/plinx/archive/2013/04/08/3009159.html 和当你在你的github上创建repository后的提示信息如下 ...
- CodeChef CBAL
题面: https://www.codechef.com/problems/CBAL 题解: 可以发现,我们关心的仅仅是每个字符出现次数的奇偶性,而且字符集大小仅有 26, 所以我们状态压缩,记 a[ ...
- NSURLSession -- 备忘
NSURLSession NSURLSession是iOS7出的API,在它之前常用的原生网络库是NSURLConnection,但是因为Connection的使用起来不是很方便 所以我们一直倾向于A ...
- 数据结构练习 00-自测5. Shuffling Machine (20)
Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techn ...
- list.h
#ifndef LISTHHHHHHH #define LISTHHHHHHH #include "common.h" /* stolen from kernel */ typed ...
- BZOJ 3969 low power
Description 有\(n\)个机器,每个机器有\(2\)个芯片,每个芯片可以放\(k\)个电池.每个芯片能量是\(k\)个电池的能量的最小值.两个芯片的能量之差越小,这个机器就工作的越好.现在 ...
- android的原理,为什么不需要手动关闭程序
转自android的原理,为什么不需要手动关闭程序 不用在意剩余内存的大小,其实很多人都是把使用其他系统的习惯带过来来了. Andoird大多应用没有退出的设计其实是有道理的,这和系统对进程的调度机制 ...
- python中并行遍历:zip和map-转
http://blog.sina.com.cn/s/blog_70e50f090101lat2.html 1.并行遍历:zip和map 内置的zip函数可以让我们使用for循环来并行使用多个序列.在基 ...
- android--使用Struts2服务端与android交互
一,服务器端: web.xml文件: <?xml version="1.0" encoding="UTF-8"?> <web-app vers ...
- Android日志框架darks-logs使用教程
一.配置文件 在使用darks-logs之前,我们需要为它创建一个名叫logd.properties的配置文件.如果你是需要在JAVA或WEB上使用该组件,那么你可以像配置log4j一样将它放在cla ...