1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

rsyncing mysql data directory

Discussion in 'MySQL' started by siddharth007, Apr 1, 2014.

  1. #1
    Hi all.I am rsyncing the mysql data-directory (/var/lib/mysql) from one server(say A) to another (say B) in realtime(Server A is up and server B is down during the sync).The backup server comes up only if the server A goes down (say power outage,system failure,etc)

    On server B,i change the directory permissions and then start the mysql server. The server is starting (on B) but my problem is am losing a substantial amount of data.I know that mysql-server on A holds the currently used 'binlog' file and so no complete rsync on 'B'. In other words i am trying to achieve HA without the mysql clustering technology.Is it possible? Are there ways to rsync the mysql data to the current binlog file/position from A to B
     
    siddharth007, Apr 1, 2014 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    digitalpoint, Apr 14, 2014 IP
  3. Tier_net

    Tier_net Active Member

    Messages:
    35
    Likes Received:
    5
    Best Answers:
    3
    Trophy Points:
    58
    #3
    Keep in mind that replication is generally used in a master/slave configuration. Therefore, the slave is only a copy and can be read from but not written to separately.

    rsync is a haphazard way of doing it. It can work (just don't use innodb with it) but it is unaware of any MySQL file locks, etc so corruption can and often will result. If you use replication and need the slave server to do its own writes if the primary goes down, you will need to redo the replication afterwards.
     
    Tier_net, May 21, 2014 IP
  4. postcd

    postcd Well-Known Member

    Messages:
    1,037
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    190
    #4
    i know there are is mysqldump command which exports all mysql dbs safelly
    then U need to rsync these dumps and then restore them on new server
     
    postcd, May 24, 2014 IP