对mysql的学习很有兴趣,为了深入的学习并且很好的在线上使用,在了解了去哪里关于开源inception的文档学习,一下为我的安装笔记与心得。
1,关于inception。
MySQL语句的审核,在业界都已经基本被认同了,实际上也是对MySQL语句写法的统一化,标准化,而之前的人工审核,针对标准这个问题其实是很吃力的,标准越多,DBA越累,开发也越累。
那么在这个都追求自动化运维的时代,审核也必须要跟上步伐,因此Inception诞生了。而Inception可以做的工作远不止是一个自动化审核工具,同时还具备执行,生成对影响数据的回滚语句(类似闪回的功能),这样一条龙服务的工具,将会给DBA的工作带来翻天覆地的变化,DBA从此就从繁重的审核、登上去执行,出错了很难回滚(如果提前没有备份的话)的被动局面解放了出来,突然发现,做DBA原来可以这么轻松,工作可以不饱和了,那就有更多的自由时间学习、进一步向自动化运维平台的实现等更智能化的方向去发展,是具有里程碑意义的。
2,inception架构原理。
3,安装inception。
实际上编译Inception,和编译MySQL源码是一样的。
(1)环境准备
#yum install -y gcc gcc-c++ make ncurses-devel bison openssl-devel zlib-devel cmake
(2)源码地址
#git clone https://github.com/mysql-inception/inception.git
(3)编译
#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。
#/usr/local/src/inception/mysql/bin/Inception
#netstat -antlp |grep ./Inception
tcp 0 0 :::3306 :::* LISTEN 16727/./Inception
(5)登录成功
#/usr/local/src/inception/mysql/bin/mysql
登录上去之后,再执行一个命令:
inception get variables;
mysql> inception get variables;
+------------------------------------------+----------------------------------------------------+
| Variable_name | Value |
+------------------------------------------+----------------------------------------------------+
| autocommit | OFF |
| bind_address | * |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/src/inception/mysql/bin/share/charsets/ |
| connect_timeout | 10 |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| general_log | OFF |
| general_log_file | |
| 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 | OFF |
| 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_select_star | OFF |
| inception_enable_sql_statistic | ON |
| inception_max_char_length | 16 |
| inception_max_key_parts | 5 |
| inception_max_keys | 16 |
| inception_max_update_rows | 10000 |
| inception_merge_alter_table | ON |
| inception_osc_bin_dir | |
| inception_osc_check_interval | 5.000000 |
| inception_osc_chunk_size | 1000 |
| inception_osc_chunk_size_limit | 4.000000 |
| inception_osc_chunk_time | 1.000000 |
| 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 | 16 |
| 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 | localhost |
| inception_remote_backup_port | 0 |
| inception_remote_system_password | |
| inception_remote_system_user | |
| 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 | 3306 |
| query_alloc_block_size | 8192 |
| query_prealloc_size | 8192 |
| socket | /tmp/inception.sock |
| thread_handling | one-thread-per-connection |
| thread_stack | 262144 |
| time_format | %H:%i:%s |
| version | Inception2.1.17 |
| version_comment | Source distribution |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
| wait_timeout | 28800 |
+------------------------------------------+----------------------------------------------------+
85 rows in set (0.00 sec)
#mysql> show databases;
+----+-------+----------+-------------+--------------------------------+--------------------+---------------+----------+---------------+--------------+---------+
| ID | stage | errlevel | stagestatus | errormessage | SQL | Affected_rows | sequence | backup_dbname | execute_time | sqlsha1 |
+----+-------+----------+-------------+--------------------------------+--------------------+---------------+----------+---------------+--------------+---------+
| 1 | NONE | 2 | None | Must start as begin statement. | Global environment | 0 | None | None | 0 | None |
+----+-------+----------+-------------+--------------------------------+--------------------+---------------+----------+---------------+--------------+---------+
1 row in set, 1 warning (0.00 sec)