本文是在CentOS7系统中进行的部署验证。
Inception是去哪网DBA团队开源的一个很好的工具。主要提供MySQL的语法审查、远程执行以及备份回滚服务。
一、Inception安装
1、下载和安装bison
版本使用2.5.1,http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz,最新的可能会有问题,下载之后,需要编译源码来安装。
方法为:
./configure && make && make install
如果有报错信息,可能是缺少个别依赖包。
2、安装cmake,ncurses,ncurses-dev,openssl,g++
# yum install cmake ncurses ncurses-dev openssl g++
3、编译安装inception
从github下载源码:https://github.com/mysql-inception/inception.git
# pwd
/data/inception
# git clone https://github.com/mysql-inception/inception.git
官方提供的安装方法:
./inception_build.sh debug
如果遇上报错,可以试试下面的手动安装办法。因为Inception实际上是在mysql的基础上定制开发得到的,安装Inception的过程、步骤,和编译安装一个mysql一样。
# cmake -DWITH_DEBUG=OFF -DCMAKE_INSTALL_PREFIX=./mysql -DMYSQL_DATADIR=./mysql/data -DWITH_SSL=bundled -DCMAKE_BUILD_TYPE=RELEASE -DWITH_ZLIB=bundled -DMY_MAINTAINER_CXX_WARNINGS="-Wall -Wextra -Wunused -Wno-dev -Wwrite-strings -Wno-strict-aliasing -Wno-unused-parameter -Woverloaded-virtual" -DMY_MAINTAINER_C_WARNINGS="-Wall -Wextra -Wno-dev -Wunused -Wwrite-strings -Wno-strict-aliasing -Wdeclaration-after-statement"
# make
# make install
4、配置和启动Inception服务
下面是一个比较通用的Inception配置文件。
$ cat /etc/inc.cnf
[inception]
general_log=1
general_log_file=inception.log
port=6669
socket=/data/inception/inception-master/inc.socket
character-set-client-handshake=0
character-set-server=utf8
inception_support_charset=utf8mb4
inception_enable_nullable=0
inception_check_primary_key=1
inception_check_column_comment=1
inception_check_table_comment=1
inception_osc_min_table_size=1
inception_osc_bin_dir=/data/temp
inception_osc_chunk_time=0.1
inception_enable_blob_type=1
inception_check_column_default_value=1
--enable-check # 告诉Inception当前要做什么操作,是审核还是执行,这个参数与下面的--enable-execute只能指定一个。
--enable-remote-backup # 指定在执行时是不是要备份,这个参数默认是打开的,如果不想备份,则指定参数--disable-remote-backup,这个选项所支持的备份,实际上是对当前所执行的操作的备份及被修改数据的回滚语句的存储。Inception 是默认开备份功能的。
--disable-remote-backup # 禁用备份功能
详细配置参数参见:http://mysql-inception.github.io/inception-document/option/
手动启动方法:
./Inception --defaults-file=/etc/inc.cnf
或者:
./Inception --port=6669
启动成功之后,可以简单试一下看,通过MySQL客户端
mysql -uroot -h127.0.0.1 -P6669
登录上去之后,再执行一个命令:
inception get variables;
输出了所有的变量,恭喜你,已经启动成功了




