• 平台项目~go-inception使用


    一 安装
       git clone https://github.com/hanchuanchuan/goInception.git cd goInception make parser go build -o goInception tidb-server/main.go ./goInception -config=config/config.toml
    二 配置文件
       1 goInception利用的toml模块作为配置文件
       2 配置文件分为几个模块
         1 inc-审核规则         
             enable_drop_table = false 禁止drop/truncate_table操作,天然过滤危险
             enable_set_engine = true 检测非innodb引擎
             enable_change_column = true 检测更改列
             check_column_type_change = true
             index_prefix = "idx_" 索引相关
             uniq_index_prefix = "uniq_"
             table_prefix = "
             # 可选值: "first", "max"
             # "first": 使用第一行的explain结果作为受影响行数
            # "max": 使用explain结果中的最大值作为受影响行数
            explain_rule = "first"
           # 安全更新是否开启(mysql自身的功能).
           sql_safe_updates = -1
           support_charset = "utf8,utf8mb4"
           support_engine = "innodb"
           lang = "en-US"
          general_log = true
         3 具体gh-ost配置(具体问题具体分析)
          ghost_aliyun_rds =true   根据环境确定是否开启阿里云选项
           ghost_on = true
           ghost_allow_on_master = true
           ghost_assume_rbr = true
           ghost_concurrent_rowcount = false
           ghost_ok_to_drop_table = false
           ghost_initially_drop_ghost_table=true
           ghost_initially_drop_old_table=true
           ghost_initially_drop_socket_file=true
           osc_critical_thread_connected=3000
           osc_max_thread_connected=3000
           osc_min_table_size=10
    三 对比原生inception的优势
       1 对开源工具gh-ost的支持,可以不再使用触发器
       2 支持DML和DDL混合提交
       3 批量备份速度远远超过原生inception
       4 因为是go程序,所以不依赖于环境,执行执行即可,原生inception有一些包的问题
       5 支持某些原生incetpion不支持的语法,比如insert select这种带select关键字
       6 针对gh-ost的行为是封装在内部的,外部无法观测到(我这里发现是这样的)
       7  支持天然过滤drop truncate操作,防止有危险,以前只能从前端和后端程序代码实现约束
    四 用户权限细化
       insert,delete,update,insert,select,create,drop,alter,replication slave,replication client,process,super
    五 获取DDL进度
    inception get osc processlist;
        inception get osc_percent '*4A673E07E512727FD5858C8CD6E2815FED99F808';
    六 官方文档
      https://hanchuanchuan.github.io/goInception/permission.html
    七 使用注意
       1 构建选项   --backup=1 --execute=1 --check=1
       2  如果存在多个ddl sql 会先检测所有的SQL语句是否能执行,然后才会执行所有语句,如果审核失败,则返回错误信息
       3  inception kill/pause/resume osc 'id‘ 管理相关的DDL语句 如果kill 记得清理相关表
          
    CHECKING 当前语句 审核完成 后中止审核,此时仅返回从开始到当前语句的审核结果,后续SQL不再审核
    EXECUTING 当前语句 执行完成 后中止执行,如果开启了备份,会执行备份操作,未开启则直接返回
    BACKUP 当前binlog事件 解析完成后中止备份,但已生成的回滚语句会继续写入备份库,待写入完成后返回

  • 相关阅读:
    likely(x)与unlikely(x) __builtin_expect
    c++ ScopeExitGuard
    c++ 11 bind function
    boost shared_ptr weak_ptr
    PL/SQL:使用pragma restrict_references限制包权限
    Nginx的事件处理机制
    读书笔记-HBase in Action-第二部分Advanced concepts-(1)HBase table design
    谈谈工作
    [Java 8] (5) 使用Lambda表达式进行设计
    How to delete a large number of data in SharePoint for List when refreshing data?
  • 原文地址:https://www.cnblogs.com/danhuangpai/p/13878832.html
Copyright © 2020-2023  润新知