Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
W
wiki-php
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • 互联网应用开发
  • wiki-php
  • Wiki
  • mysql ddl tool gh ost

mysql ddl tool gh ost · Changes

Page history
wangchangchun created page: mysql ddl tool gh ost authored Dec 20, 2019 by 王常春's avatar 王常春
Show whitespace changes
Inline Side-by-side
Showing with 59 additions and 0 deletions
+59 -0
  • mysql-ddl-tool-gh-ost.md mysql-ddl-tool-gh-ost.md +59 -0
  • No files found.
mysql-ddl-tool-gh-ost.md
View page @ 03a52497
# mysql大表在线ddl工具gh-ost
## 特点
* 无触发器
* 轻量级
* 可暂停
* 动态可控
* 可审计
* 可测试
* 可靠
## 常用参数
参数名称 | 说明
--- | ---
--max-load | 执行过程中,gh-ost 会时刻关注负载情况,负载阀值是使用者自己定义,比如数据库的最大连接数,如果超过阀值,gh-ost 不会退出,会等待到负载在阀值以下继续执行。
--critical-load | 这个指的是 gh-ost 退出阀值,当负载超过这个阀值,gh-ost 会停止并退出
--chunk-size | 迁移过程是一步步分批次完成的,这个参数是指事务每次提交的行数,默认是 1000。
--max-lag-millis | 会监控从库的主从延迟情况,如果延迟秒数超过这个阀值,迁移不会退出,等待延迟秒数低于这个阀值继续迁移。
--throttle-control-replicas
和--max-lag-millis 参数相结合,这个参数指定主从延迟的数据库实例。
--switch-to-rbr
当 binlog 日志格式不是 row 时,自动转换日志格式
--initially-drop-ghost-table
gh-ost 执行前会创建两张 xx_ghc 和 xx_gho 表,如果这两张表存在,且加上了这个参数,那么会自动删除原 gh 表,从新创建,否则退出。xx_gho 表相当于老表的全量备份,xx_ghc 表数据是数据更改日志,理解成增量备份。
--initially-drop-socket-file
gh-ost 执行时会创建 socket 文件,退出时不会删除,下次执行 gh-ost 时会报错,加上这个参数会删除老的 socket 文件,重新创建。
--ok-to-drop-table
go-ost 执行完以后是否删除老表,加上此参数会自动删除老表。
--host
数据库实例地址。
--port
数据库实例端口。
--user
数据库实例用户名。
--password
数据库实例密码。
--database
数据库名称。
--table
表名。
--verbose
执行过程输出日志。
--alter
操作语句。
--cut-over
自动执行 rename 操作。
--debug
输出详细日志。
--panic-flag-file
这个文件被创建,迁移操作会被立即终止退出。
--execute
如果确定执行,加上这个参数。
--allow-on-master
整个迁移所有操作在主库上执行,也就是上文介绍的第二种方案:在主库执行。
--throttle-flag-file
此文件存在时操作暂停,删除文件操作会继续。
## Master执行例子
````
````
\ No newline at end of file
Clone repository
  • 360safeguardnativeapi
  • all new classmate
  • bind phone
  • code standard
  • deploy_sys
  • edit common
  • edit master
  • envrioment
  • find psw
  • front new classmate
  • front statck
  • git
  • Home
  • idcard md5
  • ide
View All Pages