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 王常春
Hide whitespace changes
Inline Side-by-side
Showing with 35 additions and 39 deletions
+35 -39
  • mysql-ddl-tool-gh-ost.md mysql-ddl-tool-gh-ost.md +35 -39
  • No files found.
mysql-ddl-tool-gh-ost.md
View page @ d7ccd6aa
......@@ -16,45 +16,41 @@
--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
此文件存在时操作暂停,删除文件操作会继续。
--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执行例子
````
gh-ost \
--ok-to-drop-table \
--initially-drop-ghost-table \
--initially-drop-socket-file \
--host="192.168.109.245" \
--port=3306 \
--user="root" \
--password="123456"\
--database="ucs" \
--table="tb_sms" \
--verbose \
--alter="ADD KEY idx_receiver (`receiver`);" \
--panic-flag-file=/tmp/ghost.panic.flag \
--allow-on-master \
--throttle-flag-file /tmp/1.log \
--execute
````
\ 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