zoukankan      html  css  js  c++  java
  • mysql主主复制

    实验1:
    第一步:在第一个主服务器上改配置文件vim /etc/my.cnf在mysql下加入这几行
    [mysqld]
    innodb_file_per_table
    log-bin
    server_id=1
    auto_increment_offset=1
    auto_increment_increment=2
    第二步:创建账号并授权
    grant replication slave on *.* to repluser@'%' identified by 'centos';
    第三步:在mysql服务器上输入命令
    CHANGE MASTER TO MASTER_HOST='%',MASTER_USER='repluser',MASTER_PASSWORD='centos',MASTER_LOG_FILE=mariadb-bin.000001,MASTER_LOG_POS=522555;
    第四步:在第二个服务器上改配置文件vim /etc/my.cnf在mysql下加入这几行
    [mysqld]
    log-bin
    innodb_file_per_table
    server_id=2
    auto_increment_offset=2
    auto_increment_increment=2
    第五步:systemctl start mariadb
    mysql < /app/all.sql
    第六步:在mysql数据库中:
    show master logs;
    grant replication slave on *.* to repluser@'%' identified by 'centos';
    CHANGE MASTER TO MASTER_HOST='%',MASTER_USER='repluser',MASTER_PASSWORD='centos',MASTER_LOG_FILE=mariadb-bin.000002,MASTER_LOG_POS=245;
     
     
  • 相关阅读:
    字符匹配算法之KMP
    rabbitmq_hearbeat
    rabbitmq_config
    postgres SQL编译过程
    postgres启动过程分析
    postgres源码目录结构
    Js两种post方式(转)
    PHP-MySQL,PHP-MySQLi,PDO的差异
    CSS属性中Display与Visibility的不同
    PHP中include路径修改
  • 原文地址:https://www.cnblogs.com/momenglin/p/10464982.html
Copyright © 2011-2022 走看看