编译安装 tokudb-xtrabackup 以支持tokudb的热备份

编译安装 tokudb-xtrabackup :

感谢知书堂吴老师

环境:centos6 x86_64

官方文档:

https://github.com/xelabs/tokudb-xtrabackup/wiki/How-to-build

先安装高版本的libev依赖包:

wget https://fossies.org/linux/misc/libev-4.24.tar.gz
tar xvzf libev-4.22.tar.gz
cd libev-4.22
./configure
make && make install

开始编译安装xtrabackup:

yum install cmake gcc gcc-c++ libaio libaio-devel automake autoconf bison libtool ncurses-devel libgcrypt-devel libev-devel libcurl-devel vim-common

git clone  

cd tokudb-xtrabackup

cmake .\
  -DBUILD_CONFIG=xtrabackup_release\
  -DWITH_BOOST=extra/boost/boost_1_59_0.tar.gz\
  -DWITH_MAN_PAGES=OFF\
  -DCMAKE_INSTALL_PREFIX=/usr/local/xtrabackup_xelabs/
  
make -j8

make install

编译完成后, 在 /usr/local/xtrabackup_xelabs/bin/ 目录下就生成了我们需要的文件。

使用备份命令:

/usr/local/xtrabackup_xelabs/bin/innobackupex --user=root --password=123456 --no-timestamp  2>/tmp/bak.log /root/aaa   即可在生成全量的备份文件

整个备份流程如下(https://yq.aliyun.com/articles/213):

 1) SET TOKUDB_CHECKPOINT_LOCK=ON;

 2) FLUSH TABLES WITH READ LOCK;

 3) 记录binlog位置,拷贝最新的binlog和TokuDB的日志文件(*.tokulog)

 4) UNLOCK TABLES;

 5) 开始拷贝TokuDB的数据文件(不包含日志文件)  --移动到这里

 6) SET TOKUDB_CHECKPOINT_LOCK=OFF;

操作过程日志,部分内容如下:

180826 19:28:42 innobackupex: Starting the backup operation

IMPORTANT: Please check that the backup run completes successfully.

           At the end of a successful backup run innobackupex

           prints "completed OK!".

180826 19:28:43  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/tmp/mysql.sock' as 'root'  (using password: YES).

180826 19:28:43  version_check Connected to MySQL server

180826 19:28:43  version_check Executing a version check against the server...

180826 19:28:43  version_check Done.

180826 19:28:43 Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /tmp/mysql.sock

Using server version 5.7.18-15-log

/usr/local/xtrabackup_xelabs/bin/innobackupex version 2.4.7 based on MySQL server 5.7.13 Linux (x86_64) (revision id: )

xtrabackup: uses posix_fadvise().

xtrabackup: cd to /bdata/data/nowdb2

xtrabackup: open files limit requested 0, set to 65535

xtrabackup: using the following InnoDB configuration:

xtrabackup:   innodb_data_home_dir = .

xtrabackup:   innodb_data_file_path = ibdata1:12M:autoextend

xtrabackup:   innodb_log_group_home_dir = ./

xtrabackup:   innodb_log_files_in_group = 2

xtrabackup:   innodb_log_file_size = 50331648

xtrabackup: using O_DIRECT

InnoDB: Number of pools: 1

180826 19:28:43 >> log scanned up to (1062788205)

xtrabackup: Generating a list of tablespaces

InnoDB: Allocated tablespace ID 21 for sys/sys_config, old maximum was 0

180826 19:28:43 [01] Copying ./ibdata1 to /root/aaa/ibdata1

180826 19:28:44 >> log scanned up to (1062788205)

180826 19:28:45 >> log scanned up to (1062788205)

180826 19:28:45 [01]        ...done

180826 19:28:45 [01] Copying ./sys/sys_config.ibd to /root/aaa/sys/sys_config.ibd

180826 19:28:45 [01]        ...done

180826 19:28:45 [01] Copying ./test/sbtest1_innodb.ibd to /root/aaa/test/sbtest1_innodb.ibd

180826 19:28:46 >> log scanned up to (1062788205)

180826 19:28:47 >> log scanned up to (1062788205)

180826 19:28:48 >> log scanned up to (1062788205)

180826 19:28:49 >> log scanned up to (1062788205)

180826 19:28:50 >> log scanned up to (1062788205)

180826 19:28:51 >> log scanned up to (1062788205)

180826 19:28:52 >> log scanned up to (1062788205)

180826 19:28:53 >> log scanned up to (1062788205)

180826 19:28:54 >> log scanned up to (1062788205)

180826 19:28:55 >> log scanned up to (1062788205)

180826 19:28:56 >> log scanned up to (1062788205)

180826 19:28:57 >> log scanned up to (1062788205)

180826 19:28:58 >> log scanned up to (1062788205)

180826 19:28:59 >> log scanned up to (1062788205)

180826 19:29:00 >> log scanned up to (1062788205)

180826 19:29:01 >> log scanned up to (1062788205)

180826 19:29:02 >> log scanned up to (1062788205)

180826 19:29:03 >> log scanned up to (1062788205)

180826 19:29:03 [01]        ...done

180826 19:29:03 [01] Copying ./test/t2.ibd to /root/aaa/test/t2.ibd

180826 19:29:03 [01]        ...done

180826 19:29:05 [01] Copying ./mysql/slave_worker_info.ibd to /root/aaa/mysql/slave_worker_info.ibd

180826 19:29:05 [01]        ...done

180826 19:29:05 >> log scanned up to (1062788205)

180826 19:29:05 Executing SET GLOBAL tokudb_checkpoint_lock=ON      # 注意这里参数 tokudb_checkpoint_lock=ON, 然后开始拷贝非innodb文件和tokudb文件(不包含日志文件) 

180826 19:29:05 tokudb_checkpoint_locked

180826 19:29:05 Executing LOCK TABLES FOR BACKUP...

180826 19:29:05 Starting to backup non-InnoDB tables and files

180826 19:29:05 [01] Copying ./sys/x@0024wait_classes_global_by_avg_latency.frm to /root/aaa/sys/x@0024wait_classes_global_by_avg_latency.frm

180826 19:29:05 [01]        ...done

180826 19:29:09 [01] Copying ./performance_schema/events_stages_summary_by_thread_by_event_name.frm to /root/aaa/performance_schema/events_stages_summary_by_thread_by_event_name.frm

180826 19:29:09 [01]        ...done

180826 19:29:09 [01] Copying ./performance_schema/events_transactions_summary_by_user_by_event_name.frm to /root/aaa/performance_schema/events_transactions_summary_by_user_by_event_name.frm

180826 19:29:09 [01]        ...done

180826 19:29:09 Finished backing up non-InnoDB tables and files

180826 19:29:09 Executing LOCK BINLOG FOR BACKUP...

180826 19:29:09 [00] Writing xtrabackup_binlog_info

180826 19:29:09 [00]        ...done

180826 19:29:09 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...

180826 19:29:09 Starting to backup tokudb.directory/tokudb.environment/tokudb.rollback...    # 开始备份TokuDB redo-log

180826 19:29:09 [01] Copying tokudb.directory to /root/aaa/tokudb.directory

180826 19:29:09 [01]        ...done

180826 19:29:09 [01] Copying tokudb.environment to /root/aaa/tokudb.environment

180826 19:29:09 [01]        ...done

180826 19:29:09 [01] Copying tokudb.rollback to /root/aaa/tokudb.rollback

180826 19:29:09 [01]        ...done

180826 19:29:09 Starting to backup TokuDB redo-log files

180826 19:29:09 [01] Copying ./log000000000067.tokulog29 to /root/aaa/log000000000067.tokulog29

180826 19:29:09 [01]        ...done

180826 19:29:09 Finished backing up TokuDB redo-log files

xtrabackup: The latest check point (for incremental): '1062788212'

xtrabackup: Stopping log copying thread.

.180826 19:29:09 >> log scanned up to (1062788221)

180826 19:29:09 Executing UNLOCK BINLOG         # 释放锁

180826 19:29:09 Executing UNLOCK TABLES 

180826 19:29:09 All tables unlocked

180826 19:29:09 Starting to backup TokuDB data files

180826 19:29:09 [01] Copying ./__tokudb_lock_dont_delete_me_data to /root/aaa/__tokudb_lock_dont_delete_me_data

180826 19:29:09 [01]        ...done

180826 19:29:09 [01] Copying ./test/tb123_main_1e3_2_1d.tokudb to /root/aaa/test/tb123_main_1e3_2_1d.tokudb

180826 19:29:09 [01]        ...done

180826 19:29:19 [01] Copying ./test/tb123_key_idx_1e5_3_1d_B_0.tokudb to /root/aaa/test/tb123_key_idx_1e5_3_1d_B_0.tokudb

180826 19:29:19 [01]        ...done

180826 19:29:19 [01] Copying ./test/tb123_status_1e3_1_1d.tokudb to /root/aaa/test/tb123_status_1e3_1_1d.tokudb

180826 19:29:19 [01]        ...done

180826 19:29:19 Finished backing up TokuDB data files

180826 19:29:19 Executing SET GLOBAL tokudb_checkpoint_lock=OFF           # 注意这里参数 tokudb_checkpoint_lock=OFF 

180826 19:29:19 tokudb_checkpoint_unlocked

180826 19:29:19 [00] Copying ib_buffer_pool to /root/aaa/ib_buffer_pool

180826 19:29:19 [00]        ...done

180826 19:29:19 Backup created in directory '/root/aaa/'

MySQL binlog position: filename 'mysql-bin.000053', position '154'

180826 19:29:19 [00] Writing backup-my.cnf

180826 19:29:19 [00]        ...done

180826 19:29:19 [00] Writing xtrabackup_info

180826 19:29:19 [00]        ...done

xtrabackup: Transaction log of lsn (1062788196) to (1062788221) was copied.

180826 19:29:19 completed OK!

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏理想二旬不止

Servlet技术【第三篇】会话技术——Cookies、Session详解

也就是说,从浏览器访问服务器开始,到访问服务器结束,浏览器关闭为止的这段时间内容产生的多次请求和响应,合起来叫做浏览器和服务器之间的一次会话

10630
来自专栏Spark学习技巧

干货好文!自底向上——知识图谱构建技术初探

云栖君导读:知识图谱的构建技术主要有自顶向下和自底向上两种。其中自顶向下构建是指借助百科类网站等结构化数据源,从高质量数据中提取本体和模式信息,加入到知识库里。...

17130
来自专栏用户3029758的专栏

阶段02JavaWeb基础day04mysql

数据仓库.就与我们之前学过的纯文本,properties这些技术一样.用来保存数据.并提供对数据进行增删改查的操作.我们以后做项目时, 项目中的数据都是保存在...

7820
来自专栏PHP饭米粒

聊聊细节 - 你知道缓存的正确打开方式么?(1)

大的架构设计,各种高大上的概念层出不穷,相信很多人也或多或少的了解过,但其实,我们真的要把一个系统做强壮,做好,打磨细节才是根本,有句老话:细节是魔鬼,所以会来...

9920
来自专栏用户3029758的专栏

Windows10下安装解压版MySQL

这里有一个坑点,配置字段的等号左右两边不能有空格,否则等一下MySQL初始化的时候可能会报如下错误:

13220
来自专栏AI研习社

实践是最好的老师:给中级 Python 开发人员的 13 个项目构想

学习 python 的基础知识是一种美妙的体验。但是,学习的喜悦可以被对实践项目的渴望所取代。想要建立项目是正常的,因此需要对项目的构想。

11010
来自专栏用户3029758的专栏

阶段02JavaWeb基础day04mysql

数据仓库.就与我们之前学过的纯文本,properties这些技术一样.用来保存数据.并提供对数据进行增删改查的操作.我们以后做项目时, 项目中的数据都是保存在...

8030
来自专栏用户3029758的专栏

Linux命令行SQL语句

-- 链接数据库 mysql -uroot -p mysql -uroot -pmysql

23020
来自专栏用户3029758的专栏

基本SQL语句(一)

-- 数据库的操作     -- 链接数据库     mysql -uroot -p     mysql -uroot -pmysql     -- 退...

11720
来自专栏崔庆才的专栏

教你实现一个可视化爬虫监控系统

本文并不是讲解爬虫的相关技术实现的,而是从实用性的角度,将抓取并存入 MongoDB 的数据 用 InfluxDB 进行处理,而后又通过 Grafana 将爬虫...

27030

扫码关注云+社区

领取腾讯云代金券

年度创作总结 领取年终奖励