首页 技术 正文
技术 2022年11月21日
0 收藏 305 点赞 3,539 浏览 1691 个字
  1. Use this option to dump a master replication server to produce a dump file that can be used to set up another server as a slave of the master. It causes the dump output to
  2. include a CHANGE MASTER TO statement that indicates the binary log coordinates (file name and position) of the dumped server. These are the master server coordinates from which
  3. the slave should start replicating.
  4. If the option value is 2, the CHANGE MASTER TO statement is written as an SQL comment, and thus is informative only; it has no effect when the dump file is reloaded. If the
  5. option value is 1, the statement takes effect when the dump file is reloaded. If the option value is not specified, the default value is 1.
  6. mysqldump导出数据时,当这个参数的值为1的时候,mysqldump出来的文件就会包括CHANGE MASTER TO这个语句,CHANGE MASTER TO后面紧接着就是file和position的记录,在slave上导入数据时就会执
  7. 行这个语句,salve就会根据指定这个文件位置从master端复制binlog。默认情况下这个值是1
  8. 当这个值是2的时候,chang master to也是会写到dump文件里面去的,但是这个语句是被注释的状态。
  9. master-data参数在建立slave数据库的时候会经常用到,因为这是一个比较好用的参数,默认值为1,默认情况下,会包含change master to,这个语句包含file和position的记录始位置。master-
  10. data=2的时候,在mysqldump出来的文件包含CHANGE MASTER TO这个语句,处于被注释状态
  11. dump出文件
  12. [root@aeolus1 c_learn]# mysqldump -uroot test –single-transaction –master-data=2 >master-data.sql
  13. 过滤出change master to信息
  14. [root@aeolus1 c_learn]# grep -i “change master to” master-data.sql
  15. — CHANGE MASTER TO MASTER_LOG_FILE=’mysql-bin.000012′, MASTER_LOG_POS=107;
  16. 然后修改
  17. change master to  master_host=’xx.xx.xx.xx’,
  18. master_user=’repl’,
  19. master_password=’repl’,
  20. master_port=3306,
  21. master_log_file=’mysql-bin.000012′,
  22. master_log_pos=107;
  23. 然后slave从库执行
  24. mysql> change master to  master_host=’xx.xx.xx.xx’,
  25. master_user=’repl’,
  26. master_password=’repl’,
  27. master_port=3306,
  28. master_log_file=’mysql-bin.000012′,
  29. master_log_pos=107;
下一篇: linux 部署脚本
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,082
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,556
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,406
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,179
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,815
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898