?
?
    两台mariadb(5.5.60)一主一从:
    主:192.168.36.121
    从:192.168.36.120?
?
        [mysqld]
        server_id=121
        innodb_file_per_table                                                                                                           
        binlog_format=row 建议
        log_bin=/data/bin/mysql-bin?
        mysql-bin.000004    245?
?
?
        [mysqld]
        server_id=120                                                                                                           
        read_only 建议
        innodb_file_per_table?
        mysql>CHANGE MASTER TO   
            MASTER_HOST=‘192.168.36.121‘,  
            MASTER_USER=‘repluser‘,   
            MASTER_PASSWORD=‘123456‘,   
            MASTER_PORT=3306,   
            MASTER_LOG_FILE=‘mysql-bin.000004‘,   
            MASTER_LOG_POS=245;?
        mysql>start slave;
        mysql>show slave status\G
        MariaDB [(none)]> show slave status\G
        *************************** 1. row ***************************
           Slave_IO_State: Waiting for master to send event
              Master_Host: 192.168.36.121
              Master_User: repluser
              Master_Port: 3306
            Connect_Retry: 60
          Master_Log_File: mariadb-bin.000009
      Read_Master_Log_Pos: 245
           Relay_Log_File: mariadb-relay-bin.000004
            Relay_Log_Pos: 531
    Relay_Master_Log_File: mariadb-bin.000009
         Slave_IO_Running: Yes
        Slave_SQL_Running: Yes
          Replicate_Do_DB: 
      Replicate_Ignore_DB: 
       Replicate_Do_Table: 
   Replicate_Ignore_Table: 
  Replicate_Wild_Do_Table: 
    Replicate_Wild_Ignore_Table: 
               Last_Errno: 0
               Last_Error: 
             Skip_Counter: 0
      Exec_Master_Log_Pos: 245
          Relay_Log_Space: 872
          Until_Condition: None
           Until_Log_File: 
            Until_Log_Pos: 0
       Master_SSL_Allowed: No
       Master_SSL_CA_File: 
       Master_SSL_CA_Path: 
          Master_SSL_Cert: 
        Master_SSL_Cipher: 
           Master_SSL_Key: 
    Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
            Last_IO_Errno: 0
            Last_IO_Error: 
           Last_SQL_Errno: 0
           Last_SQL_Error: 
    Replicate_Ignore_Server_Ids: 
         Master_Server_Id: 121
1 row in set (0.00 sec)?
?
?

?
 
       
?
?
?
    在上一实验的基础上实现。?
?
?
    cat /etc/my.cnf
        [mysqld]
        server_id=121                                                                                                           
        binlog_format=row 
        log_bin=/data/bin/mysql-bin?
    vim /etc/my.cnf
        [mysqld]
        server_id=121                                                                                                           
        binlog_format=row 建议添加
        log_bin=/data/bin/mysql-bin(注意目录权限,可以用默认)
    systemctl restart mariadb?
?
?

?        
?
?
?
    cat /etc/my.cnf
        [mysqld]
        server_id=120(只要是唯一即可)                                                                                                           
        read_only ?
    vim /etc/my.cnf
        [mysqld]
        server_id=120                                                                                                           
        read_only 建议添加?
    systemctl stop mariadb
    \rm -rf /var/lib/mysql/*
    systemctl start mariadb?
    vim /data/backup/all.sql
        CHANGE MASTER TO   
        MASTER_HOST=‘192.168.36.121‘,
        MASTER_USER=‘repluser‘,
        MASTER_PASSWORD=‘123456‘,
        MASTER_PORT=3306,
        MASTER_LOG_FILE=‘mysql-bin.000010‘, 
        MASTER_LOG_POS=245;   ?
?
    mysql>start slave;
    mysql>show slave status\G?
?
?
 
       
?
 
      
原文:https://blog.51cto.com/13560168/2391297