mysql8 ubuntu和centos安装 主主复制 并行复制

 


数据库安装
ubuntu
    apt-get update
    https://dev.mysql.com/downloads/file/?id=477124
    dpkg -i mysql-apt-config_0.8.10-1_all.deb
    apt-get update
    apt-get install mysql-server
    service mysql start
    sudo vim /etc/mysql/debian.cnf
    mysql -udebian-sys-maint -p0eqyBUNFAnsNddnS
centos
    yum remove mysql-community-server
    wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
    yum localinstall mysql80-community-release-el7-1.noarch.rpm
    yum clean all
    yum makecache
    yum install mysql-community-server
    systemctl start mysqld.service
    systemctl enable mysqld.service
    cat /var/log/mysqld.log | grep password
    mysql -uroot -p


数据库登录设置

set global validate_password.policy=0 
set global validate_password.length=4
ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxx';
use mysql;
update user set host='%' where user='root';
FLUSH PRIVILEGES;
systemctl stop firewalld.service  
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; 
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'xxx'; 
FLUSH PRIVILEGES;


主主复制配置
    A机
        create user 'mysql_slave_A'@'%' identified WITH mysql_native_password by 'mysql_slave_A';
        grant replication slave on *.* to 'mysql_slave_A'@'%' ;
        grant all on *.* to 'mysql_slave_A'@'%' ;
        flush privileges;
        show master status;
        change master to
        master_host='192.168.159.1', 
        master_port=3306, 
        master_user='mysql_slave_A',
        master_password='mysql_slave_A',
        master_log_file='mysql-bin.000004', 
        master_log_pos=156; 
                show slave status;
        show slave status;
        start slave;
        stop slave;

        show variables like 'max_connections';
        set global max_connections=2000;
        set global max_connect_errors=2;

    B机
        create user 'mysql_slave_B'@'%' identified WITH mysql_native_password by 'mysql_slave_B';
        grant replication slave on *.* to 'mysql_slave_B'@'%' ;
        grant all on *.* to 'mysql_slave_B'@'%' ;
        flush privileges;
        show master status;
        change master to
        master_host='192.168.159.128', 
        master_port=3306, 
        master_user='mysql_slave_B',
        master_password='mysql_slave_B',
        master_log_file='mysql-bin.000001', 
        master_log_pos=1321; 
        show slave status;
        start slave;
        stop slave;

        show variables like 'max_connections';
        set global max_connections=10000;
        set global max_connect_errors=2;


并行复制配置
binlog_transaction_dependency_tracking=WRITESET
slave_parallel_worker=4
slave_parallel_type=LOGICAL_CLOCK

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值