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的更多相关文章

  1. Win32汇编-编写PE结构解析工具

    汇编语言(assembly language)是一种用于电子计算机.微处理器.微控制器或其他可编程器件的低级语言,亦称为符号语言.在汇编语言中,用助记符(Mnemonics)代替机器指令的操作码,用地 ...

  2. 手写PE结构解析工具

    PE格式是 Windows下最常用的可执行文件格式,理解PE文件格式不仅可以了解操作系统的加载流程,还可以更好的理解操作系统对进程和内存相关的管理知识,而有些技术必须建立在了解PE文件格式的基础上,如 ...

  3. Golang Json文件解析为结构体工具-json2go

    代码地址如下:http://www.demodashi.com/demo/14946.html 概述 json2go是一个基于Golang开发的轻量json文件解析.转换命令行工具,目前支持转换输出到 ...

  4. MySQL Binlog 解析工具 Maxwell 详解

    maxwell 简介 Maxwell是一个能实时读取MySQL二进制日志binlog,并生成 JSON 格式的消息,作为生产者发送给 Kafka,Kinesis.RabbitMQ.Redis.Goog ...

  5. (转)AVI文件格式解析+AVI文件解析工具

    AVI文件解析工具下载地址:http://download.csdn.net/detail/zjq634359531/7556659 AVI(Audio Video Interleaved的缩写)是一 ...

  6. Redis源码剖析--源码结构解析

    请持续关注我的个人博客:https://zcheng.ren 找工作那会儿,看了黄建宏老师的<Redis设计与实现>,对redis的部分实现有了一个简明的认识.在面试过程中,redis确实 ...

  7. InfluxDB源码目录结构解析

    操作系统 : CentOS7.3.1611_x64 go语言版本:1.8.3 linux/amd64 InfluxDB版本:1.1.0 influxdata主目录结构 [root@localhost ...

  8. redis源代码结构解析

    看了黄建宏老师的<Redis设计与实现>,对redis的部分实现有了一个简明的认识: 之前面试的时候被问到了这部分的内容,没有关注,好在还有时间,就把Redis的源码看了一遍. Redis ...

  9. vue(16)vue-cli创建项目以及项目结构解析

    vue-cli创建项目 上一篇我们安装了vue-cli,接下来我们就使用该脚手架进行创建项目 1.进入一个目录,创建项目 创建项目命令如下: vue create <Project Name&g ...

随机推荐

  1. Python 基础 字符串拼接 + if while for循环

    注释单行注释 #多行注释 ''' 三个单引号或者三个双引号 """ ''' 用三引号引住可以多行赋值 用户交互 input 字符串拼接 +  ""%( ...

  2. 读书笔记-《Training Products of Experts by Minimizing Contrastive Divergence》

    Training Products of Experts by Minimizing Contrastive Divergence(以下简称 PoE)是 DBN 和深度学习理论的 肇始之篇,最近在爬梳 ...

  3. 关于applicationx/www-form-urlencoded和multipart/form-data的描述

    在Form元素的语法中,EncType表明提交数据的格式 用 Enctype 属性指定将数据回发到服务器时浏览器使用的编码类型. 下边是说明: application/x-www-form-urlen ...

  4. 菜鸟的ubuntu学习笔记

    初识ubuntu感觉这个系统绝对够高大上,简洁的桌面,流畅的操作界面,在加上神秘的终端控制,突然感觉自己的世界真的好渺小,所以我下定决心在接下来的日子里我要告别windows,把ubuntu学好,尝试 ...

  5. vim配置-程序员【转】

    Ubuntu11.10的vim升级后,版本为vi Improved 7.3.154功能很强大了.不过,程序员要根据自己的习惯配置好vimrc文件,是vim更加得心应手. 注:一般用户在自己的当前目录下 ...

  6. tyvj P1716 - 上帝造题的七分钟 二维树状数组区间查询及修改 二维线段树

    P1716 - 上帝造题的七分钟 From Riatre    Normal (OI)总时限:50s    内存限制:128MB    代码长度限制:64KB 背景 Background 裸体就意味着 ...

  7. 【转】不同VLAN之间相互通信及VTP、STP、EtherChannel概念

    厘清最后一个概念. 转了网上两个相关帖子: http://www.net130.com/CMS/Pub/Tech/tech_zh/2009_03_12_97386_3.htm http://blog. ...

  8. druid配置(转)

    java程序很大一部分要操作数据库,为了提高性能操作数据库的时候,有不得不使用数据库连接池.数据库连接池有很多选择,c3p.dhcp.proxool等,druid作为一名后起之秀,凭借其出色的性能,也 ...

  9. c++ 名字粉碎(name mangling)

    转自Ibm: Name mangling is the encoding of function and variable names into unique names so that linker ...

  10. BZOJ3687: 简单题

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3687 小呆开始研究集合论了,他提出了关于一个数集四个问题: 1.子集的异或和的算术和. 2.子 ...