mysql5.7 dump GTID一致性的问题
利用mysqldump导出数据时提示warning,A partial dump from a server that has GTIDs
ubt@ubt-All-Series:~$ mysqldump -uroot -p sdxdb > sdxdb.sql
Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that
changed suppressed parts of the database. If you don't want to restore GTIDs, pass --set-gtid-purged=OFF. To make a complete
dump, pass --all-databases --triggers --routines --events.
关于GTID是5.6以后,加入了全局事务 ID (GTID) 来强化数据库的主备一致性,故障恢复,以及容错能力。
官方给的:A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master).
所以可能是因为在一个数据库里面唯一,但是当导入其他的库就有可能重复。所有会有一个提醒。
可以通过添加--set-gtid-purged=off 或者–gtid-mode=OFF这两个参数设置。
很有肯能是在导入库中重新生产GTID,而不用原来的。
ubt@ubt-All-Series:~$ mysqldump -uroot --set-gtid-purged=off -p sdxdb > sdxdb.sql #这样就ok了!
=================================================================================
mysqldump 导出数据,剔除多张表
mysqldump -h 127.0.0.1 -uroot -p'11111111' --set-gtid-purged=off --databases 'my-test' --ignore-table='my-test'.ti_o_sms --ignore-table='my-test'.ti_o_smsbak > mytest02.sql