LINUX的MYSQL数据库主从服务器的备份

一.在主服务器A上设置:

server-id      = 1

log-bin=mysql-bin

binlog-do-db=dng 注:多个数据库名,可写多行

binlog-ignore-db=MYSQL注:不备份的数据库,可写多行

二,重启MYSQL服务

三,在主服务器是执行以下命令:

show master status
show slave hosts
show logs

四,在从服务器B上设置:

server-id=2
master-host=192.168.1.13
master-port=3306
master-user=dng
master-password=dng
master-connect-retry=60
log-bin=mysql-bin
replicate-do-db=dng 注:多个需要备份的数据库名,可写多行

五,重启MYSQL服务

六.在从服务器是执行以下命令:

show slave status

show slave status\G

*************************** 1. row***************************
            Slave_IO_State: Waiting for master to send event
               Master_Host: 192.168.1.13
               Master_User: dng
               Master_Port: 3306
             Connect_Retry: 60
           Master_Log_File: mysql-bin.000031
       Read_Master_Log_Pos: 98
            Relay_Log_File: mysqld-relay-bin.000036
             Relay_Log_Pos: 235
     Relay_Master_Log_File: mysql-bin.000031
          Slave_IO_Running: Yes
         Slave_SQL_Running:Yes
           Replicate_Do_DB: dng,dng
       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: 98
           Relay_Log_Space: 235
           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
1 row in set (0.00 sec)
当看到:Slave_IO_Running: Yes
         Slave_SQL_Running: Yes

为正常


你可能感兴趣的:(数据库,linux,mysql,ssl,服务器,table)