17.1.1.1 Setting the Replication Master Configuration  设置复制的master 配置:

在一个复制master,你必须启用binary logging和创建一个唯一的server ID.

如果这个没有提前做,server 重启是需要的。

Binary logging 是需要启用的在master上,因为binary log 是复制的基础 从master上的改变到slaves.

如果binary log 是没有启用使用 log-bin option,  复制是不可能的

每个server 在复制组必须配置一个唯一的server ID.

这个ID 是用于确定唯一的servers 在组内,配置一个整数

配置 binary log and server ID 选项,关闭MySQL server 编辑my.cnf或者 my.ini file.

在[mysqld]章节,增加log-bin and server-id options.

如果那些选项已经存在,但是注释掉了,取消注释选项根据你的需要改变它们。

比如, 让binary logging 使用一个log file mysql-bin的名字前缀,配置一个server ID 为1

zabbix:/root# cat /etc/my.cnf | grep log-bin
log-bin=/data01/mysqllog/binlog/mysql-bin
zabbix:/root# ls -ltr /data01/mysqllog/binlog/mysql-bin
ls: cannot access /data01/mysqllog/binlog/mysql-bin: No such file or directory
zabbix:/root# ls -ltr /data01/mysqllog/binlog/mysql-bin*
-rw-rw----. 1 mysql mysql 3351694 Oct 27 09:53 /data01/mysqllog/binlog/mysql-bin.000001
-rw-rw---- 1 mysql mysql 436 Oct 27 09:57 /data01/mysqllog/binlog/mysql-bin.000002
-rw-rw---- 1 mysql mysql 143 Oct 27 10:00 /data01/mysqllog/binlog/mysql-bin.000003
-rw-rw---- 1 mysql mysql 143 Oct 27 10:02 /data01/mysqllog/binlog/mysql-bin.000004
-rw-rw---- 1 mysql mysql 514616 Oct 27 11:30 /data01/mysqllog/binlog/mysql-bin.000005
-rw-rw---- 1 mysql mysql 26752 Oct 27 11:36 /data01/mysqllog/binlog/mysql-bin.000006
-rw-rw---- 1 mysql mysql 42293 Oct 27 11:44 /data01/mysqllog/binlog/mysql-bin.000007
-rw-rw---- 1 mysql mysql 1401536 Oct 27 13:42 /data01/mysqllog/binlog/mysql-bin.000008
-rw-rw---- 1 mysql mysql 536871235 Nov 2 05:30 /data01/mysqllog/binlog/mysql-bin.000009
-rw-rw---- 1 mysql mysql 536871228 Nov 4 05:52 /data01/mysqllog/binlog/mysql-bin.000010
-rw-rw---- 1 mysql mysql 536871010 Nov 6 05:40 /data01/mysqllog/binlog/mysql-bin.000011
-rw-rw---- 1 mysql mysql 536871041 Nov 8 05:54 /data01/mysqllog/binlog/mysql-bin.000012
-rw-rw---- 1 mysql mysql 536871189 Nov 10 06:19 /data01/mysqllog/binlog/mysql-bin.000013
-rw-rw---- 1 mysql mysql 536871366 Nov 12 01:37 /data01/mysqllog/binlog/mysql-bin.000014
-rw-rw---- 1 mysql mysql 536871289 Nov 13 12:26 /data01/mysqllog/binlog/mysql-bin.000015
-rw-rw---- 1 mysql mysql 656 Nov 13 12:26 /data01/mysqllog/binlog/mysql-bin.index
-rw-rw---- 1 mysql mysql 347374418 Nov 14 11:13 /data01/mysqllog/binlog/mysql-bin.000016 [mysqld]
log-bin=mysql-bin
server-id=1 在做了这些修改后,重启服务器: 注意: 如果你省略server-id(或者设置为默认值0),master 拒绝任何slaves的链接 注意: 为了最大的可用的耐久性和一致性 在一个复制设置使用InnoDB,你需要使用innodb_flush_log_at_trx_commit=1 and sync_binlog=1 在master的my.cnf文件 注意: 请确保skip-networking 选项是不被启用的在你的复制master上,
mysql> show variables like '%skip_networking%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| skip_networking | OFF |
+-----------------+-------+
1 row in set (0.00 sec)

17.1.1.1 Setting the Replication Master Configuration 设置复制的master 配置:的更多相关文章

  1. 17.1.1.2 Setting the Replication Slave Configuration

    17.1.1.2 Setting the Replication Slave Configuration 在一个复制slave, 你必须创建一个唯一的server ID,如果这个没有做,slave设置 ...

  2. 17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制使用新的master和slaves:

    17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制使用新的master和slaves: 最简单和最直接方式是设置复制使用新的 ...

  3. 17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制对于新的Master和Slaves:

    17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制对于新的Master和Slaves: 最简单和最直接的方法是设置复制用于使 ...

  4. 17.1.1.8?Setting Up Replication with Existing Data设置复制使用存在的数据

    17.1.1.8?Setting Up Replication with Existing Data设置复制使用存在的数据 当设置复制使用存在的数据,你需要确定如何最好的从master 得到数据到sl ...

  5. mysql (master/slave)复制原理及配置

    1 复制概述 Mysql内建的复制功能是构建大型,高性能应用程序的基础.将Mysql的数据分布到多个系统上去,这种分布的机制,是通过将Mysql的某一台主机的数据复制到其它主机(slaves)上,并重 ...

  6. 17.1.1 How to Set Up Replication 设置复制:

    17.1.1 How to Set Up Replication 设置复制: 17.1.1.1 Setting the Replication Master Configuration 17.1.1. ...

  7. 17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 得到复制master binary log 位置:

    17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 得到复制master binary log 位置: 你需要master ...

  8. 17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 获取复制Master Binary Log的坐标:

    17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 获取复制Master Binary Log的坐标: 你需要master ...

  9. mysql同步复制报Slave can not handle replication events with the checksum that master 错误

    slave服务器,查看状态时,发现下面的错误: Last_IO_Error: Got fatal error 1236 from master when reading data from binar ...

随机推荐

  1. java ssh框架入门

    源码:http://pan.baidu.com/s/1hspUOKG

  2. ASP.NET MVC(三) TypeScript

    TypeScript 是微软开发的 JavaScript 的超集,TypeScript兼容JavaScript,可以载入JavaScript代码然后运行.TypeScript与JavaScript相比 ...

  3. 关于.NET前后台提示框的那点事

    前言 关于提示框,或多或少都用到过,提示框常见方式两种:js原生alert() 和 div模拟弹层:下面以一个常见的需求业务场景来展现提示框的那点事: 正文内容 客户:需求方: 小白:实现方(全权负责 ...

  4. HttpServlet was not found on the Java

    今天新建jsp时出现了一个错误,如下图 分析:应该是没有找到相关jar包 解决方案: 如图: 这回就没错了

  5. oracle 11g卸载方法

    在网上查看了很多卸载oracle11g的方法,但是感觉都太复杂了,没有使用,最后查看了很多资料,得到一种比较简单,而且能完全卸载的方法: 在根目录下运行c:\app\Administrator\pro ...

  6. Spring的多配置文件加载

    如果配置文件存在多个的情况下,加载配置文件的方式是:1--可以指定总的配置文件去包含子的配置文件,然后只加载总的配置文件即可在总配置文件applicationContext.xml 中引入子文件 &l ...

  7. Angularjs总结(八)$ cookie和$rootscope

    AngularJS 提供了很好的 $cookie 和 $cookieStore API 用来处理 cookies .这两个服务都能够很好的发挥HTML5 cookies,当HTML5 API可用时浏览 ...

  8. IOS开发中针对UIImageView的几种常用手势

    // //  ViewController.m //  05-手势 // //  Created by wanghy on 15/9/21. //  Copyright (c) 2015年 wangh ...

  9. MinGW-notepad++开发c/c++程序

    下载MinGW 点击下载 安装好后运行 最后点击左上角的 Installation,开始安装 1.编译: g++ -o a.exe a.cpp gcc -o hello.exe hello.c 2.运 ...

  10. Ibatis学习记录

    几大要素:1.jdbc.properties //数据库连接配置2.SqlMapContext.xml //主配置文件3.user_SqlMap.xml //映射文件4.三层框架 创建Ibatis工程 ...