• 11108com_11108com唯一授权官网

  • 发布时间:2016-01-13 00:28 | 作者:yc | 来源:互联网 | 浏览:1200 次
  • 11108com_11108com唯一授权官网

    mysql主主设置设备摆设和主从设置设备摆设的不合点在于主从的master不监控slavebin-log的改变,致使slave有新数据不能更新到master

    主主设置设备摆设的症结参数:log-slave-updates,两台mysql都需增添

    测验情况:

    centos 6.5 x64

    主1ip:192.168.0.1

    11108com_11108com唯一授权官网

    主2ip:192.168.0.2

    主主设置设备摆设

    主1

    vim /etc/my.cnf

    server-id=1

    bin-log=mysql-bin

    binlog-format=mixed

    log-slave-updates

    relay-log=mysql-relay

    主2

    server-id=2

    bin-log=mysql-bin

    binlog-format=mixed

    log-slave-updates

    relay-log=mysql-relay

    修正设置设备摆设后均重启mysql使设置设备摆设见效

    分手在主1和主2上做主从

    一、给主1设置设备摆设从

    在主1上

    1.授权登入账号(两头要树立可仿制的账号)

    grant replication client,replication slave on *.* to 'salve'@'192.168.0.*' identified by 'test123';

    11108com_11108com唯一授权官网

    2.show master status;

    mysql> show master status;

    +------------------+----------+--------------+------------------+

    | F504com香港王中王ile| Position | Binlog_Do_DB | Binlog_Ignore_DB |

    +------------------+----------+--------------+------------------+

    | mysql-bin. |653 |||

    +------------------+----------+--------------+------------------+

    1 row in set (0.00 sec)

    在主2上

    stop slave;

    reset slave;

    change master to master_host='192.168.0.1',master_user='slave',master_password='test123',master_log_file='mysql-bin.',master_log_pos=653;

    start slave;

    show salve status\G;

    Slave_IO_Running: Yes

    Slave_SQL_Running: Yes

    即成功

    一、给主2设置设备摆设从

    历程通给主1设置设备摆设从

    测验:

    分手在主1和主2增添数据,看在另一台是否能查询

    在主1上

    mysql> select * from t;

    +---+

    | s |

    +---+

    | 2 |

    +---+

    1 row in set (0.00 sec)

    mysql> insert into t values (3);

    Query OK, 1 row affected (0.01 sedafa888.comc)

    mysql> select * from t;

    +---+

    | s |

    +---+

    | 2 |

    | 3 |

    +---+

    2 rows in set (0.00 sec)

    mysql> select * from t;

    +---+

    | s |

    +---+

    | 2 |

    | 3 |

    | 4 |

    +---+

    3 rows in set (0.00 sec)

    在主2上

    mysql> use proxy_test;

    Database changed

    mysql> select * from t;

    +---+

    | s |

    +---+

    | 2 |

    +---+

    1 row in set (0.00 sec)

    mysql> select * from t;

    +---+

    | s |

    +---+

    | 2 |

    | 3 |

    +---+

    2 rows in set (0.00 sec)

    mysql> insert into t values (4);

    Query OK, 1 row affected (0.00 sec)

    mysql> select * from t;

    +---+

    | s |

    +---+

    | 2 |

    | 3 |

    | 4 |

    +---+

    3 rows in set (0.00 sec)

    主主设置设备摆设到此测验成功

  • 相关内容

友情链接: