In this article i will explain step if mysql-slave crash cause of shutdown suddenly or data corrupted

Scenario :

  • 3 node multi master percona-xtradb-cluster57
  • 2 node slave percona-xtradb-cluster57 (per node running docker-pxc57 4 instance) with port maping
  • Haproxy as loadbalancer for slave node
  • Database size >500GB
  • IP db slave and balancer

  • 172.16.3.13 -> slave-1
  • 172.17.3.14 -> slave-2 (crashed)
  • I using simple method for this process, just copy all data on dir /var/lib/mysql with rsync, for detail see bellow :

    Procedure and step

  • Login to server balancer, takeout ip & port who want the data rsync to crashed slave server from config haproxy.cfg
  • # /etc/init.d/haproxy reload

  • Stop service mysql and docker instance on node slave-2
  • # docker exec -it percona55-ssd2 service mysql stop
    # docker stop percona55-ssd2

  • Use rsync to copy data from slave-1 to slave-2 and use option Compression=no to make rsync fast
  • # rsync -avp --progress -e "ssh -T -c arcfour -o Compression=no -x" /data/ssd5/docker-shared/mysql-slave erick@172.17.3.14:/data/ssd1/backup/mysql-slave/

  • Start docker instance and mysql service when rsync finish
  • # docker start percona55-ssd2
    # docker exec -it percona55-ssd2 service mysql start

  • Login to mysql and run command show slave status to check is replicate running well or no
  • mysql> show slave status \G:
    Master_User: repl_usr
    Master_Port: 3306
    Connect_Retry: 60
    Master_Log_File: mysql-bin.000001
    Read_Master_Log_Pos: 3936335
    Relay_Log_File: relay-bin.000006
    Relay_Log_Pos: 320
    Relay_Master_Log_File: mysql-bin.000001
    Slave_IO_Running: Yes
    Slave_SQL_Running: Yes

    Finish, wish this article help full

    CMIIW

    Advertisements