mysql replication issues

Discussion in 'Server Operation' started by Jamesk5, Jul 28, 2006.

  1. Jamesk5

    Jamesk5 New Member

    I've got replication working on two machines, both running Debian (etch) and the latest version of mySQL-server-5.0, but I've got an issue with the slave.
    If the machine goes down, the slave 'feature' of mysql doesn't seem to automatically turn its self on - not sure why. I've followed the mySQL docs on replication.
    Also, when I run the 'start slave' command on the slave, it doesn't go and automatically carry out any changes that have been done on the master since the slave went down.

    Any suggestions will be appreciated,
    James
     
  2. falko

    falko Super Moderator ISPConfig Developer

  3. Jamesk5

    Jamesk5 New Member

    Yes I did, but in your tutorial you only cover how to replicate a single database, where as I need the whole MySQL DB replicated for data redundancy and a hotswap incase my main machine goes down.
    Your tutorial barely differs from the docs on the MySQL site - which is why I posted the question.
    Thanks for the how-to anyway, but I've basically used parts of your tute and the rest of the stuff from the mysql docs.
     
  4. falko

    falko Super Moderator ISPConfig Developer

    Basically you must list all databases in my.cnf on the master and slave.

    Master:

    Code:
    binlog-do-db=db1
    binlog-do-db=db2
    binlog-do-db=db3
    binlog-do-db=db4
    binlog-do-db=db5
    binlog-do-db=db6
    binlog-do-db=db7
    ...
    Slave:

    Code:
    replicate-do-db=db1
    replicate-do-db=db2
    replicate-do-db=db3
    replicate-do-db=db4
    replicate-do-db=db5
    replicate-do-db=db6
    replicate-do-db=db7
    ...
     
  5. Jamesk5

    Jamesk5 New Member

    ahhh ok, so every time I add a DB to the master I need to add it to the list in both my.cnf files. It just seems a bit silly too me - considering that it works to some degree without all the lines that you mentioned above.
     
  6. falko

    falko Super Moderator ISPConfig Developer

    Yes, maybe a little bit silly, but it's working. :)
     
  7. Jamesk5

    Jamesk5 New Member

    Thanks Falko, I'll give it a try. It really does seem silly to have to add each new DB I create - but if it works I can't really complain!!

    I've got automated sql dumps being forwarded out to a secondary machine anyway, so perhaps that would be better than worrying about replication issues.
    From what I can see, replication is a great way of having 'real time' backups, but mysqldump seems to be more reliable as a way of backing up all the data in a DB without having to worry about specifying tables etc.
     
  8. lifeisboost

    lifeisboost New Member

    sorry to bring an old thread back BUT im trying to replicate 7 DB's i tried entering each DB into my.cnf but when i go to show master it shows all the dbs being logged into one bin log is this correct?

    +------------------+----------+-------------------+------------------+
    | File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
    +------------------+----------+-------------------+------------------+
    | mysql-bin.000002 | 1125758 | web1_db1,web1_db2 | |
    +------------------+----------+-------------------+------------------+

    should there not be a binlog for EACH db? or does each position make up for it being different db's? also i see everytime you restart mysql it creates another log file. if i tell the slave to watch mysql-bin.000002 and the master gets rebooted it will rotate to log mysql-bin.000003, would i then have to set everything back up on the slave?
     
    Last edited: Sep 22, 2006
  9. falko

    falko Super Moderator ISPConfig Developer

    Yes, that's correct.

    No, all changes should be replicated to the slave.
     

Share This Page