MySQL Inception For Linux怎么安装

发布时间:2021-11-01 09:34:45 作者:小新
来源:亿速云 阅读:142

这篇文章主要为大家展示了“MySQL Inception For Linux怎么安装”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“MySQL Inception For Linux怎么安装”这篇文章吧。



安装过程如下:
1.下载:https://github.com/mysql-inception/inception 选择下载inception-master.zip,然后将它上传到服务器/root目录
2.解压并安装:
# unzip inception-master.zip
#cd inception-master
#yum -y install cmake bison  ncurses-devel gcc gcc-c++  openssl-devel
#mkdir  /data
#mkdir -P /usr/local/inception      --这里创建的是Inception的安装目录。可根据自己的情况自行决定
#mkdir -P /data/inception   --这里创建的是Inception的数据目录。也可根据自己的情况自行决定
#unzip master
#cd inception-master/  
#cmake .
#cmake -DWITH_DEBUG=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/inception  -DMYSQL_DATADIR=/data/inception   --安装指定安装目录和数据目录
#make && make install
编译中间发现会报错:
make[2]: * [sql/CMakeFiles/sql.dir/sql_yacc.cc.o] Error 1 
make[1]: * [sql/CMakeFiles/sql.dir/all] Error 2 
make: * [all] Error 2

解决方法:
经检查发现已安装bison的版本为2.1,较低,而手册建议的版本为2.6之前的,建议用2.5.1版本。
去http://ftp.gnu.org/gnu/bison/网址下载bison-2.5.1.tar.gz

解压缩后编译安装,安装完后的路径为/usr/local/bin/bison,
确认版本为2.5.1后,再次进入inception-master目录,删除CMakeCache.txt后重新编译:
#cd inception-master/ 
# rm CMakeCache.txt
#cmake .
#cmake -DWITH_DEBUG=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/inception  -DMYSQL_DATADIR=/data/inception
#make
#make install
这次没有报错,make install完后,
编辑/etc/inc.cnf文件,增加如下内容:

#vim /etc/inc.cnf
[inception]
general_log=1
general_log_file=/usr/local/inception/data/inception.log
port=6669
socket=/data/workspace/inception_data/inc.socket
character-set-client-handshake=0
character-set-server=utf8
inception_remote_system_password=123456
inception_remote_system_user=root
inception_remote_backup_port=3306
inception_remote_backup_host=127.0.0.1
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_ddl_support=1
inception_enable_blob_type=1
inception_check_column_default_value=1


3.启动inception(放后台执行)
[root@test1 ~]# nohup /usr/local/inception/bin/Inception --defaults-file=/etc/inc.cnf &

看到nohup有如下输出说明启动成功:
[root@test1 ~]# cat nohup.out
2017-03-16 15:48:14 0 [Note] Welcome to use Inception2.1.50
2017-03-16 15:48:14 46451 [Note] Server hostname (bind-address): '*'; port: 6669
2017-03-16 15:48:14 46451 [Note] IPv6 is available.
2017-03-16 15:48:14 46451 [Note]   - '::' resolves to '::';
2017-03-16 15:48:14 46451 [Note] Server socket created on IP: '::'.


4.登陆inception测试:

[root@test1 ~]# mysql -uroot -h227.0.0.1 -P6669
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: Inception2.1.50 1


Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


MySQL [(none)]>
MySQL [(none)]>
MySQL [(none)]>
MySQL [(none)]> inception get variables;
+------------------------------------------+-------------------------------------------+
| Variable_name                            | Value                                     |
+------------------------------------------+-------------------------------------------+
| autocommit                               | OFF                                       |
| bind_address                             | *                                         |
| character_set_system                     | utf8                                      |
| character_sets_dir                       | /usr/local/inception/bin/share/charsets/  |
| connect_timeout                          | 10                                        |
| date_format                              | %Y-%m-%d                                  |
| datetime_format                          | %Y-%m-%d %H:%i:%s                         |
| general_log                              | ON                                        |
| general_log_file                         | /usr/local/inception/data/inception.log   |
| inception_check_autoincrement_datatype   | ON                                        |
| inception_check_autoincrement_init_value | ON                                        |
| inception_check_autoincrement_name       | ON                                        |
| inception_check_column_comment           | ON                                        |
| inception_check_column_default_value     | ON                                        |
| inception_check_dml_limit                | ON                                        |
| inception_check_dml_orderby              | ON                                        |
| inception_check_dml_where                | ON                                        |
| inception_check_identifier               | ON                                        |
| inception_check_index_prefix             | ON                                        |
| inception_check_insert_field             | ON                                        |
| inception_check_primary_key              | ON                                        |
| inception_check_table_comment            | ON                                        |
| inception_check_timestamp_default        | ON                                        |
| inception_ddl_support                    | ON                                        |
| inception_enable_autoincrement_unsigned  | ON                                        |
| inception_enable_blob_type               | ON                                        |
| inception_enable_column_charset          | OFF                                       |
| inception_enable_enum_set_bit            | OFF                                       |
| inception_enable_foreign_key             | OFF                                       |
| inception_enable_identifer_keyword       | OFF                                       |
| inception_enable_not_innodb              | OFF                                       |
| inception_enable_nullable                | OFF                                       |
| inception_enable_orderby_rand            | OFF                                       |
| inception_enable_partition_table         | OFF                                       |
| inception_enable_pk_columns_only_int     | OFF                                       |
| inception_enable_select_star             | OFF                                       |
| inception_enable_sql_statistic           | ON                                        |
| inception_max_char_length                | 16                                        |
| inception_max_key_parts                  | 5                                         |
| inception_max_keys                       | 16                                        |
| inception_max_primary_key_parts          | 5                                         |
| inception_max_update_rows                | 10000                                     |
| inception_merge_alter_table              | ON                                        |
| inception_osc_alter_foreign_keys_method  | none                                      |
| inception_osc_bin_dir                    | /data/temp                                |
| inception_osc_check_alter                | ON                                        |
| inception_osc_check_interval             | 5.000000                                  |
| inception_osc_check_replication_filters  | ON                                        |
| inception_osc_chunk_size                 | 1000                                      |
| inception_osc_chunk_size_limit           | 4.000000                                  |
| inception_osc_chunk_time                 | 0.100000                                  |
| inception_osc_critical_thread_connected  | 1000                                      |
| inception_osc_critical_thread_running    | 80                                        |
| inception_osc_drop_new_table             | ON                                        |
| inception_osc_drop_old_table             | ON                                        |
| inception_osc_max_lag                    | 3.000000                                  |
| inception_osc_max_thread_connected       | 1000                                      |
| inception_osc_max_thread_running         | 80                                        |
| inception_osc_min_table_size             | 1                                         |
| inception_osc_on                         | ON                                        |
| inception_osc_print_none                 | ON                                        |
| inception_osc_print_sql                  | ON                                        |
| inception_osc_recursion_method           | processlist                               |
| inception_password                       |                                           |
| inception_read_only                      | OFF                                       |
| inception_remote_backup_host             | 127.0.0.1                                 |
| inception_remote_backup_port             | 3306                                      |
| inception_remote_system_password         | *4086D17D857F0000F04C5A0000000000210A0078 |
| inception_remote_system_user             | root                                      |
| inception_support_charset                | utf8mb4                                   |
| inception_user                           |                                           |
| interactive_timeout                      | 28800                                     |
| max_allowed_packet                       | 1073741824                                |
| max_connect_errors                       | 100                                       |
| max_connections                          | 151                                       |
| net_buffer_length                        | 16384                                     |
| net_read_timeout                         | 30                                        |
| net_write_timeout                        | 60                                        |
| port                                     | 6669                                      |
| query_alloc_block_size                   | 8192                                      |
| query_prealloc_size                      | 8192                                      |
| socket                                   | /data/workspace/inception_data/inc.socket |
| thread_handling                          | one-thread-per-connection                 |
| thread_stack                             | 262144                                    |
| time_format                              | %H:%i:%s                                  |
| version                                  | Inception2.1.50                           |
| version_comment                          | Source distribution                       |
| version_compile_machine                  | x86_64                                    |
| version_compile_os                       | Linux                                     |
| wait_timeout                             | 28800                                     |
+------------------------------------------+-------------------------------------------+
90 rows in set (0.00 sec)

输出了所有的变量,说明Inception启动成功。


附:(variables的参数解释):
[inception]
general_log=1 #这个参数就是原生的MySQL的参数,用来记录在Inception服务上执行过哪些语句,用来定位一些问题等
general_log_file=/usr/local/inception/data/inception.log #设置general log写入的文件路径
port=6669   #Inception的服务端口
socket=/data/inception/inc.socket #Inception的套接字文件存放位置
character-set-server=utf8 #mysql原生参数
#Inception 审核规则
inception_check_autoincrement_datatype=1 #当建表时自增列的类型不为int或者bigint时报错
inception_check_autoincrement_init_value=1 #当建表时自增列的值指定的不为1,则报错
inception_check_autoincrement_name=1 #建表时,如果指定的自增列的名字不为ID,则报错,说明是有意义的,给提示
inception_check_column_comment=1 #建表时,列没有注释时报错
inception_check_column_default_value=0 #检查在建表、修改列、新增列时,新的列属性是不是要有默认值
inception_check_dml_limit=1 #在DML语句中使用了LIMIT时,是不是要报错
inception_check_dml_orderby=1 #在DML语句中使用了Order By时,是不是要报错
inception_check_dml_where=1 #在DML语句中没有WHERE条件时,是不是要报错
inception_check_identifier=1 #打开与关闭Inception对SQL语句中各种名字的检查,如果设置为ON,则如果发现名字中存在除数字、字母、下划线之外的字符时,会报Identifier "invalidname" is invalid, valid options: [a-z,A-Z,0-9,_].
inception_check_index_prefix=1 #是不是要检查索引名字前缀为"idx_",检查唯一索引前缀是不是"uniq_"
inception_check_insert_field=1  #是不是要检查插入语句中的列链表的存在性
inception_check_primary_key=1 #建表时,如果没有主键,则报错
inception_check_table_comment=1 #建表时,表没有注释时报错
inception_check_timestamp_default=0 #建表时,如果没有为timestamp类型指定默认值,则报错
inception_enable_autoincrement_unsigned=1 #自增列是不是要为无符号型
inception_enable_blob_type=0 #检查是不是支持BLOB字段,包括建表、修改列、新增列操作 默认开启
inception_enable_column_charset=0 #允许列自己设置字符集
inception_enable_enum_set_bit=0 #是不是支持enum,set,bit数据类型
inception_enable_foreign_key=0 #是不是支持外键
inception_enable_identifer_keyword=0 #检查在SQL语句中,是不是有标识符被写成MySQL的关键字,默认值为报警。
inception_enable_not_innodb=0 #建表指定的存储引擎不为Innodb,不报错
inception_enable_nullable=0 #创建或者新增列时如果列为NULL,不报错
inception_enable_orderby_rand=0 #order by rand时是不是报错
inception_enable_partition_table=0 #是不是支持分区表
inception_enable_select_star=0 #Select*时是不是要报错
inception_enable_sql_statistic=1 #设置是不是支持统计Inception执行过的语句中,各种语句分别占多大比例,如果打开这个参数,则每次执行的情况都会在备份数据库实例中的inception库的statistic表中以一条记录存储这次操作的统计情况,每次操作对应一条记录,这条记录中含有的信息是各种类型的语句执行次数情况。
inception_max_char_length=16 #当char类型的长度大于这个值时,就提示将其转换为VARCHAR
inception_max_key_parts=5 #一个索引中,列的最大个数,超过这个数目则报错
inception_max_keys=16 #一个表中,最大的索引数目,超过这个数则报错
inception_max_update_rows=10000 #在一个修改语句中,预计影响的最大行数,超过这个数就报错
inception_merge_alter_table=1 #在多个改同一个表的语句出现是,报错,提示合成一个
#inception 支持 OSC 参数
inception_osc_bin_dir=/data/temp #用于指定pt-online-schema-change脚本的位置,不可修改,在配置文件中设置
inception_osc_check_interval=5 #对应OSC参数--check-interval,意义是Sleep time between checks for --max-lag.
inception_osc_chunk_size=1000 #对应OSC参数--chunk-size
inception_osc_chunk_size_limit=4 #对应OSC参数--chunk-size-limit
inception_osc_chunk_time=0.1 #对应OSC参数--chunk-time
inception_osc_critical_thread_connected=1000 #对应参数--critical-load中的thread_connected部分
inception_osc_critical_thread_running=80 #对应参数--critical-load中的thread_running部分
inception_osc_drop_new_table=1 #对应参数--[no]drop-new-table
inception_osc_drop_old_table=1 #对应参数--[no]drop-old-table
inception_osc_max_lag=3 #对应参数--max-lag
inception_osc_max_thread_connected=1000 #对应参数--max-load中的thread_connected部分
inception_osc_max_thread_running=80 #对应参数--max-load中的thread_running部分
inception_osc_min_table_size=1 # 这个参数实际上是一个OSC的开关,如果设置为0,则全部ALTER语句都走OSC,如果设置为非0,则当这个表占用空间大小大于这个值时才使用OSC方式。单位为M,这个表大小的计算方式是通过语句:"select (DATA_LENGTH + INDEX_LENGTH)/1024/1024 from information_schema.tables where table_schema = 'dbname' and table_name = 'tablename'"来实现的
inception_osc_on=1 #一个全局的OSC开关,默认是打开的,如果想要关闭则设置为OFF,这样就会直接修改
inception_osc_print_none=1 #用来设置在Inception返回结果集中,对于原来OSC在执行过程的标准输出信息是不是要打印到结果集对应的错误信息列中,如果设置为1,就不打印,如果设置为0,就打印。而如果出现错误了,则都会打印
inception_osc_print_sql=1 #对应参数--print
#inception_user #这个用户名在配置之后,在连接Inception的选项中可以不指定user,这样线上数据库的用户名及密码就可以不暴露了,可以做为临时使用的一种方式,但这个用户现在只能是用来审核,也就是说,即使在选项中指定--enable-execute,也不能执行,这个是只能用来审核的帐号。
#inception_password #与上面的参数是一对,这个参数对应的是选项中的password,设置这个参数之后,可以在选项中不指定password
inception_read_only=0 #设置当前Inception服务器是不是只读的,这是为了防止一些人具有修改权限的帐号时,通过Inception误修改一些数据,如果inception_read_only设置为ON,则即使开了enable-execute,同时又有执行权限,也不会去执行,审核完成即返回
#备份服务器信息
inception_remote_system_password=123456
inception_remote_system_user=root
inception_remote_backup_port=3306
inception_remote_backup_host=192.168.1.54
inception_support_charset=utf8 #表示在建表或者建库时支持的字符集,如果需要多个,则用逗号分隔,影响的范围是建表、设置会话字符集、修改表字符集属性等

以上是“MySQL Inception For Linux怎么安装”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

推荐阅读:
  1. Yearning和inception搭建MySQL审核平台
  2. 如何使用Inception进行MySQL自动化运维平台建设

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

mysql inception linux

上一篇:Sysbench基准测试的示例分析

下一篇:怎么解决MySQL too many connections问题

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》