Recovery MySQL-Slave Crashed

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

  • -> slave-1
  • -> 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@

  • 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



    Leave a Reply

    Fill in your details below or click an icon to log in: Logo

    You are commenting using your account. Log Out /  Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )


    Connecting to %s

    This site uses Akismet to reduce spam. Learn how your comment data is processed.