mysql slave创建:mysqldump参数--master-data
来源:互联网 发布:spss数据输入 编辑:程序博客网 时间:2024/06/05 06:30
在创建mysql从库时,通常我们先从主库dump下一份sql文件,再到mysql从库导入生成表,然后调用change master to开启从库,这时需要确定binlog文件和position位置。
那么如何确定position位置呢?
上网一搜,很多文章告诉你先到master库show master status查看postion。可是当你利用mysqldump导出主库,再到用show master status查看postion这段时间之间,master库早已变化了,这意味着postion位置也变化了。
准备的做法是从主库dump文件时,利用–master-data参数输出postion
官方文档地址:
https://dev.mysql.com/doc/refman/5.6/en/mysqldump.html
mysqldump –help解释:
–master-data[=#]
This causes the binary log position and filename to be appended to the output. If equal to 1, will print it as a CHANGE MASTER command; if equal to 2, that command will be prefixed with a comment symbol. This option will turn –lock-all-tables on, unless –single-transaction is specified too (in which case a global read lock is only taken a short time at the beginning of the dump; don’t forget to read about –single-transaction below). In all cases, any action on logs will happen at the exact moment of the dump. Option automatically turns –lock-tables off.
示例:
mysqldump -uroot -ptwm123 --master-data=1 huiyedb > /data/bak/dumpfile
- mysql slave创建:mysqldump参数--master-data
- 用mysqldump --master-data 建立slave
- mysqldump的--master-data参数
- mysqldump关于master-data参数
- mysqldump参数之--master-data
- mysqldump的--master-data参数
- MYSQLdump参数详解 --master-data
- mysql --master-data 参数
- mysqldump --master-data
- mysqldump --master-data
- MySQL Master-Slave Replication
- MYSQL-master-slave实践
- mysql模式:master/slave
- mysql master slave 配置
- Mysql Master/Slave备份
- mysql 同步 master-slave
- mysql master slave 搭建
- MYSQL-master-slave实践
- 主题四 指针和数组(下)----28.函数与指针分析
- 解决端口占用问题
- 我的网络编程学习之路——基本的TCP套接字API
- matlab read excel出错
- 在分布式数据库中CAP原理CAP+BASE以及分布式和集群的区别
- mysql slave创建:mysqldump参数--master-data
- python科学计算库numpy的使用
- 关于C语言宏定义define的用法探究
- 队列的基础操作
- 初创的云平台公司是否需要设立运维岗
- String中substring方法内存泄漏问题
- Java JUC之Atomic系列12大类实例讲解和原理分解
- 树形数据结构小结
- 微信公众平台网页开发实战--2.从手机相册中选照片然后分享