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 Standard Library 学习(一) -- Built-in Functions 内建函数

    内建函数列表 Built-in Functions abs() divmod() input() open() staticmethod() all() enumerate() int() ord() ...

  2. 各浏览器Cookie大小、个数限制

    一.浏览器允许每个域名所包含的cookie数: Microsoft指出InternetExplorer8增加cookie限制为每个域名50个,但IE7似乎也允许每个域名50个cookie. Firef ...

  3. 手动实现 NSTabViewController 的 Rect Transition 及 Propagate Title-b

    不知为何 我在 OS X 10.11.5 及 Xcode 7.3 的 Storyboard 中设置 Tab View Controller 的 Transition 属性时,Tab View Cont ...

  4. JSP中使用的模式——JSP+Servlet+JavaBean

    上一篇博文写到模式一:JSP+JavaBean 链接地址:http://wxmimperio.coding.io/?p=155 JSP中两种模式的总结 链接地址:http://wxmimperio.c ...

  5. mysql左联右联内联

    在MySQL中由于性能的关系,常常要将子查询(Sub-Queries)用连接(join)来却而代之,能够更好地使用表中索引提高查询效率. 下面介绍各种join的使用,先上图: 我们MySQL常用的为左 ...

  6. QPainter类学习

    详细描述: QPainter类提供了许多高度优化的函数去做大部分的GUI绘制工作.它可以画从简单的线到复杂的形状.通常情况下,QPainter的使用是在widget当中的painter事件使用.记得在 ...

  7. mysql表分区、查看分区

    原文地址:http://blog.csdn.net/feihong247/article/details/7885199 一.       mysql分区简介 数据库分区 数据库分区是一种物理数据库设 ...

  8. 监控Activity在前后台状态的切换

    public class BaseActivity extends Activity{ @Overrideprotected void onStop() { boolean isOnForegroun ...

  9. EntityFramework 异常 -- An entity object cannot be referenced by multiple instances of IEntityChangeTracker

    问题      在调用 DbSet 的 Attach()  方法时(与将 Entity 设置为 EntityState.Unchanged 状态等价)报告以下错误:      An entity ob ...

  10. Linux数据备份

    今天需要用到备份网站,写了个脚本,备份了mysql和redis数据. #!/bin/bash BACKDIR="/home/tan/getll_backup" if [ ! -d ...