FAQ
Hi all,
I am working on a project that involves total replication of the
database among two machines. Unfortunately Master - Slave replication is
no good as the databases are to support automatic fail over and if the
master goes down.. the slave will take over but when the master goes up
again, the user has to switch the master to slave and bla bla bla which
as I said is no good. So, any ideas how I can make this thing work?? Or
when is the master-master replication going to come out?? BTW.. I'm
running MySQL on a windows machine which also unfortunately does not
support clustering.

Thanks
Roderick Stoner

Search Discussions

  • Mark Steudel at Sep 8, 2005 at 6:42 pm
    Caveat: I haven't done this, so it's purely a educated guess on how to do
    this.

    Are both masters going to be writing to their database and replicating the
    data back and forth? Or is it just going to be a hot standby machine? If one
    is going to be a just a hot standby I believe you can just setup up both
    machines as masters and then configure each to be slaves of each other:

    e.g.

    Server 1

    [mysqld]
    server-id = 1

    master-host = server2.example.com
    master-user = user
    master-password = password
    master-port = 3306

    Server 2

    [mysqld]
    server-id = 2

    master-host = server1.example.com
    master-user = user
    master-password = password
    master-port = 3306

    This setup doesn't seem like it would be a problem as long as both servers
    aren't going to be writing to their own databases. If both servers are going
    to be writing data at the same time, and potentially creating conflicting
    auto incrementing id's then you'll have to figure out some way of getting
    around that.



    -----Original Message-----
    From: Roderick Stoner
    Sent: Thursday, September 08, 2005 11:04 AM
    To: replication@lists.mysql.com
    Subject: Master to Master Replication

    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication is
    no good as the databases are to support automatic fail over and if the
    master goes down.. the slave will take over but when the master goes up
    again, the user has to switch the master to slave and bla bla bla which
    as I said is no good. So, any ideas how I can make this thing work?? Or
    when is the master-master replication going to come out?? BTW.. I'm
    running MySQL on a windows machine which also unfortunately does not
    support clustering.

    Thanks
    Roderick Stoner



    --
    MySQL Replication Mailing List
    For list archives: http://lists.mysql.com/replication
    To unsubscribe:
    http://lists.mysql.com/replication?unsub=msteudel@panicware.com
  • Roderick Stoner at Sep 8, 2005 at 6:58 pm
    Actually, I have tried this setup and for some reason it failed. I saw
    them connected to eachother but one update on anyone of them was not
    reflected on the other.

    Mark Steudel wrote:
    Caveat: I haven't done this, so it's purely a educated guess on how to do
    this.

    Are both masters going to be writing to their database and replicating the
    data back and forth? Or is it just going to be a hot standby machine? If one
    is going to be a just a hot standby I believe you can just setup up both
    machines as masters and then configure each to be slaves of each other:

    e.g.

    Server 1

    [mysqld]
    server-id = 1

    master-host = server2.example.com
    master-user = user
    master-password = password
    master-port = 3306

    Server 2

    [mysqld]
    server-id = 2

    master-host = server1.example.com
    master-user = user
    master-password = password
    master-port = 3306

    This setup doesn't seem like it would be a problem as long as both servers
    aren't going to be writing to their own databases. If both servers are going
    to be writing data at the same time, and potentially creating conflicting
    auto incrementing id's then you'll have to figure out some way of getting
    around that.



    -----Original Message-----
    From: Roderick Stoner
    Sent: Thursday, September 08, 2005 11:04 AM
    To: replication@lists.mysql.com
    Subject: Master to Master Replication

    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication is
    no good as the databases are to support automatic fail over and if the
    master goes down.. the slave will take over but when the master goes up
    again, the user has to switch the master to slave and bla bla bla which
    as I said is no good. So, any ideas how I can make this thing work?? Or
    when is the master-master replication going to come out?? BTW.. I'm
    running MySQL on a windows machine which also unfortunately does not
    support clustering.

    Thanks
    Roderick Stoner



  • Mark Steudel at Sep 8, 2005 at 7:03 pm
    Did you try adding to the my.cnf file?

    replicate-db-db=dbname?



    -----Original Message-----
    From: Roderick Stoner
    Sent: Thursday, September 08, 2005 11:58 AM
    To: Mark Steudel
    Cc: replication@lists.mysql.com
    Subject: Re: Master to Master Replication

    Actually, I have tried this setup and for some reason it failed. I saw
    them connected to eachother but one update on anyone of them was not
    reflected on the other.

    Mark Steudel wrote:
    Caveat: I haven't done this, so it's purely a educated guess on how to do
    this.

    Are both masters going to be writing to their database and replicating the
    data back and forth? Or is it just going to be a hot standby machine? If one
    is going to be a just a hot standby I believe you can just setup up both
    machines as masters and then configure each to be slaves of each other:

    e.g.

    Server 1

    [mysqld]
    server-id = 1

    master-host = server2.example.com
    master-user = user
    master-password = password
    master-port = 3306

    Server 2

    [mysqld]
    server-id = 2

    master-host = server1.example.com
    master-user = user
    master-password = password
    master-port = 3306

    This setup doesn't seem like it would be a problem as long as both servers
    aren't going to be writing to their own databases. If both servers are going
    to be writing data at the same time, and potentially creating conflicting
    auto incrementing id's then you'll have to figure out some way of getting
    around that.



    -----Original Message-----
    From: Roderick Stoner
    Sent: Thursday, September 08, 2005 11:04 AM
    To: replication@lists.mysql.com
    Subject: Master to Master Replication

    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication is
    no good as the databases are to support automatic fail over and if the
    master goes down.. the slave will take over but when the master goes up
    again, the user has to switch the master to slave and bla bla bla which
    as I said is no good. So, any ideas how I can make this thing work?? Or
    when is the master-master replication going to come out?? BTW.. I'm
    running MySQL on a windows machine which also unfortunately does not
    support clustering.

    Thanks
    Roderick Stoner





    --
    MySQL Replication Mailing List
    For list archives: http://lists.mysql.com/replication
    To unsubscribe:
    http://lists.mysql.com/replication?unsub=msteudel@panicware.com
  • Mihail Manolov at Sep 8, 2005 at 7:07 pm
    on server1 cnf add:

    log-bin

    on server2 cnf add:

    log-bin
    log-slave-updates


    Roderick Stoner wrote:
    Actually, I have tried this setup and for some reason it failed. I saw
    them connected to eachother but one update on anyone of them was not
    reflected on the other.

    Mark Steudel wrote:
    Caveat: I haven't done this, so it's purely a educated guess on how to do
    this.

    Are both masters going to be writing to their database and replicating
    the
    data back and forth? Or is it just going to be a hot standby machine?
    If one
    is going to be a just a hot standby I believe you can just setup up both
    machines as masters and then configure each to be slaves of each other:

    e.g.
    Server 1

    [mysqld]
    server-id = 1

    master-host = server2.example.com
    master-user = user
    master-password = password
    master-port = 3306

    Server 2

    [mysqld]
    server-id = 2

    master-host = server1.example.com
    master-user = user
    master-password = password
    master-port = 3306

    This setup doesn't seem like it would be a problem as long as both
    servers
    aren't going to be writing to their own databases. If both servers are
    going
    to be writing data at the same time, and potentially creating conflicting
    auto incrementing id's then you'll have to figure out some way of getting
    around that.



    -----Original Message-----
    From: Roderick Stoner Sent:
    Thursday, September 08, 2005 11:04 AM
    To: replication@lists.mysql.com
    Subject: Master to Master Replication

    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication
    is no good as the databases are to support automatic fail over and if
    the master goes down.. the slave will take over but when the master
    goes up again, the user has to switch the master to slave and bla bla
    bla which as I said is no good. So, any ideas how I can make this
    thing work?? Or when is the master-master replication going to come
    out?? BTW.. I'm running MySQL on a windows machine which also
    unfortunately does not support clustering.

    Thanks
    Roderick Stoner



  • Roderick Stoner at Sep 8, 2005 at 7:18 pm
    Can you be more specific please.. Remember I'm using Windows and if I'm
    not mistaken it will expect something like mysql-bin=log-bin or
    something like that no ?

    Mihail Manolov wrote:
    on server1 cnf add:

    log-bin

    on server2 cnf add:

    log-bin
    log-slave-updates


    Roderick Stoner wrote:
    Actually, I have tried this setup and for some reason it failed. I
    saw them connected to eachother but one update on anyone of them was
    not reflected on the other.

    Mark Steudel wrote:
    Caveat: I haven't done this, so it's purely a educated guess on how
    to do
    this.

    Are both masters going to be writing to their database and
    replicating the
    data back and forth? Or is it just going to be a hot standby
    machine? If one
    is going to be a just a hot standby I believe you can just setup up
    both
    machines as masters and then configure each to be slaves of each other:

    e.g.
    Server 1

    [mysqld]
    server-id = 1

    master-host = server2.example.com
    master-user = user
    master-password = password
    master-port = 3306

    Server 2

    [mysqld]
    server-id = 2

    master-host = server1.example.com
    master-user = user
    master-password = password
    master-port = 3306

    This setup doesn't seem like it would be a problem as long as both
    servers
    aren't going to be writing to their own databases. If both servers
    are going
    to be writing data at the same time, and potentially creating
    conflicting
    auto incrementing id's then you'll have to figure out some way of
    getting
    around that.



    -----Original Message-----
    From: Roderick Stoner Sent:
    Thursday, September 08, 2005 11:04 AM
    To: replication@lists.mysql.com
    Subject: Master to Master Replication

    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave
    replication is no good as the databases are to support automatic
    fail over and if the master goes down.. the slave will take over but
    when the master goes up again, the user has to switch the master to
    slave and bla bla bla which as I said is no good. So, any ideas how
    I can make this thing work?? Or when is the master-master
    replication going to come out?? BTW.. I'm running MySQL on a windows
    machine which also unfortunately does not support clustering.

    Thanks
    Roderick Stoner



  • Mark Steudel at Sep 8, 2005 at 9:00 pm
    Any errors in your mysql log file when replication didn't work?

    -----Original Message-----
    From: Roderick Stoner
    Sent: Thursday, September 08, 2005 11:58 AM
    To: Mark Steudel
    Cc: replication@lists.mysql.com
    Subject: Re: Master to Master Replication

    Actually, I have tried this setup and for some reason it failed. I saw
    them connected to eachother but one update on anyone of them was not
    reflected on the other.

    Mark Steudel wrote:
    Caveat: I haven't done this, so it's purely a educated guess on how to do
    this.

    Are both masters going to be writing to their database and replicating the
    data back and forth? Or is it just going to be a hot standby machine? If one
    is going to be a just a hot standby I believe you can just setup up both
    machines as masters and then configure each to be slaves of each other:

    e.g.

    Server 1

    [mysqld]
    server-id = 1

    master-host = server2.example.com
    master-user = user
    master-password = password
    master-port = 3306

    Server 2

    [mysqld]
    server-id = 2

    master-host = server1.example.com
    master-user = user
    master-password = password
    master-port = 3306

    This setup doesn't seem like it would be a problem as long as both servers
    aren't going to be writing to their own databases. If both servers are going
    to be writing data at the same time, and potentially creating conflicting
    auto incrementing id's then you'll have to figure out some way of getting
    around that.



    -----Original Message-----
    From: Roderick Stoner
    Sent: Thursday, September 08, 2005 11:04 AM
    To: replication@lists.mysql.com
    Subject: Master to Master Replication

    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication is
    no good as the databases are to support automatic fail over and if the
    master goes down.. the slave will take over but when the master goes up
    again, the user has to switch the master to slave and bla bla bla which
    as I said is no good. So, any ideas how I can make this thing work?? Or
    when is the master-master replication going to come out?? BTW.. I'm
    running MySQL on a windows machine which also unfortunately does not
    support clustering.

    Thanks
    Roderick Stoner





    --
    MySQL Replication Mailing List
    For list archives: http://lists.mysql.com/replication
    To unsubscribe:
    http://lists.mysql.com/replication?unsub=msteudel@panicware.com
  • Devananda at Sep 8, 2005 at 8:43 pm

    Roderick Stoner wrote:
    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication is
    no good as the databases are to support automatic fail over and if the
    master goes down.. the slave will take over but when the master goes up
    again, the user has to switch the master to slave and bla bla bla which
    as I said is no good. So, any ideas how I can make this thing work?? Or
    when is the master-master replication going to come out?? BTW.. I'm
    running MySQL on a windows machine which also unfortunately does not
    support clustering.

    Thanks
    Roderick Stoner

    Hi Roderick,

    I've set up master-master replication many times; I actually far prefer
    it to master-slave replication for this and other reasons. However, I
    use Linux, not windows, so if there are differences, I can't help you
    with those. However, AFAIK, MySQL's replication works completely
    independent of OS; I've heard from people who replicate between OS's,
    etc, so I highly doubt that windows is going to prevent you from being
    able to do this.

    Basically, you need to make sure that BOTH servers have binary logging
    enabled (log-bin). if you only have 2 servers, then you do not need
    log_slave_updates, though if you intend to have more than 2 servers (ie,
    daisy chain replication) then ALL servers need to have log_slave_updates
    and log_bin turned on.

    Anyhow, with only two servers, you do not need log_slave_updates, and
    turning that option on will only slow down both servers, though by how
    much or how little I can not say.

    You also do not need replicate-do-db or any related options; by default,
    MySQL will replicate statements from all databases. Of course you may
    want to specify which ones to replicate and which ones not to :)

    If you are uncertain how to specify these options, read
    http://dev.mysql.com/doc/mysql/en/option-files.html

    Good luck!
    Devananda vdv
  • Terence at Sep 9, 2005 at 7:42 am

    Devananda wrote:
    Roderick Stoner wrote:
    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication
    is no good as the databases are to support automatic fail over and if
    the master goes down.. the slave will take over but when the master
    goes up again, the user has to switch the master to slave and bla bla
    bla which as I said is no good. So, any ideas how I can make this
    thing work?? Or when is the master-master replication going to come
    out?? BTW.. I'm running MySQL on a windows machine which also
    unfortunately does not support clustering.

    Thanks
    Roderick Stoner

    Hi Roderick,

    I've set up master-master replication many times; I actually far prefer
    it to master-slave replication for this and other reasons. However, I
    use Linux, not windows, so if there are differences, I can't help you
    with those. However, AFAIK, MySQL's replication works completely
    independent of OS; I've heard from people who replicate between OS's,
    etc, so I highly doubt that windows is going to prevent you from being
    able to do this.

    Basically, you need to make sure that BOTH servers have binary logging
    enabled (log-bin). if you only have 2 servers, then you do not need
    log_slave_updates, though if you intend to have more than 2 servers (ie,
    daisy chain replication) then ALL servers need to have log_slave_updates
    and log_bin turned on.

    Anyhow, with only two servers, you do not need log_slave_updates, and
    turning that option on will only slow down both servers, though by how
    much or how little I can not say.

    You also do not need replicate-do-db or any related options; by default,
    MySQL will replicate statements from all databases. Of course you may
    want to specify which ones to replicate and which ones not to :)

    If you are uncertain how to specify these options, read
    http://dev.mysql.com/doc/mysql/en/option-files.html

    Good luck!
    Devananda vdv
    If I may ask, how then do you maintain db consistency? Are you using
    fully Innodb tables? Are your applications fully transaction specific?
    Would it work if you only had MyISAM tables? I am curious as to how
    reliable it is...

    Thanks for your time

    Terence
  • Devananda at Sep 9, 2005 at 5:54 pm

    Terence wrote:


    Devananda wrote:
    Roderick Stoner wrote:
    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication
    is no good as the databases are to support automatic fail over and if
    the master goes down.. the slave will take over but when the master
    goes up again, the user has to switch the master to slave and bla bla
    bla which as I said is no good. So, any ideas how I can make this
    thing work?? Or when is the master-master replication going to come
    out?? BTW.. I'm running MySQL on a windows machine which also
    unfortunately does not support clustering.

    Thanks
    Roderick Stoner

    Hi Roderick,

    I've set up master-master replication many times; I actually far
    prefer it to master-slave replication for this and other reasons.
    However, I use Linux, not windows, so if there are differences, I
    can't help you with those. However, AFAIK, MySQL's replication works
    completely independent of OS; I've heard from people who replicate
    between OS's, etc, so I highly doubt that windows is going to prevent
    you from being able to do this.

    Basically, you need to make sure that BOTH servers have binary logging
    enabled (log-bin). if you only have 2 servers, then you do not need
    log_slave_updates, though if you intend to have more than 2 servers
    (ie, daisy chain replication) then ALL servers need to have
    log_slave_updates and log_bin turned on.

    Anyhow, with only two servers, you do not need log_slave_updates, and
    turning that option on will only slow down both servers, though by how
    much or how little I can not say.

    You also do not need replicate-do-db or any related options; by
    default, MySQL will replicate statements from all databases. Of course
    you may want to specify which ones to replicate and which ones not to :)

    If you are uncertain how to specify these options, read
    http://dev.mysql.com/doc/mysql/en/option-files.html

    Good luck!
    Devananda vdv
    If I may ask, how then do you maintain db consistency? Are you using
    fully Innodb tables? Are your applications fully transaction specific?
    Would it work if you only had MyISAM tables? I am curious as to how
    reliable it is...

    Thanks for your time

    Terence
    If your intent is to load balance among many servers, then yes,
    maintaining data consistency (or allowing for short-term inconsistency)
    has to be solved at the application layer. However, as I understood
    Roderick's initial post, he was only asking about replication as it
    applies to restoring the primary master after the event of a failover.
    If the slave has binary logging enabled, then restoring the master is
    simple - allow the master to replicate all statements from the slave,
    then switch your applications back to the master. If the slave does not
    have binary logging enabled, then, as Roderick commented on in the OP,
    switching back to the master is painfully involved and can not be done
    automatically.

    Data consistency is always an issue at the moment of failover and in the
    case where the master become suddenly unreachable, but that's not what
    the OP was about. If you have specific questions, I would be happy to
    try to answer them.

    Best regards,
    Devananda vdv
  • Roderick Stoner at Sep 9, 2005 at 6:32 pm
    I confirm that my question was about failover.. infact I have another
    small question.. how can i make the application change the server when
    the master goes offline ?? Do you know of some kind of application
    that takes care of failover ?? Some open-sorce or freeware for
    windows?? I know this is not a MySQL question but I think it's a bit
    related cause it's useless having replication without having an
    automated application to benefit from it. Thanks all folks.

    Roderick
    On 9/9/05, Devananda wrote:
    Terence wrote:

    Devananda wrote:
    Roderick Stoner wrote:
    Hi all,
    I am working on a project that involves total replication of the
    database among two machines. Unfortunately Master - Slave replication
    is no good as the databases are to support automatic fail over and if
    the master goes down.. the slave will take over but when the master
    goes up again, the user has to switch the master to slave and bla bla
    bla which as I said is no good. So, any ideas how I can make this
    thing work?? Or when is the master-master replication going to come
    out?? BTW.. I'm running MySQL on a windows machine which also
    unfortunately does not support clustering.

    Thanks
    Roderick Stoner

    Hi Roderick,

    I've set up master-master replication many times; I actually far
    prefer it to master-slave replication for this and other reasons.
    However, I use Linux, not windows, so if there are differences, I
    can't help you with those. However, AFAIK, MySQL's replication works
    completely independent of OS; I've heard from people who replicate
    between OS's, etc, so I highly doubt that windows is going to prevent
    you from being able to do this.

    Basically, you need to make sure that BOTH servers have binary logging
    enabled (log-bin). if you only have 2 servers, then you do not need
    log_slave_updates, though if you intend to have more than 2 servers
    (ie, daisy chain replication) then ALL servers need to have
    log_slave_updates and log_bin turned on.

    Anyhow, with only two servers, you do not need log_slave_updates, and
    turning that option on will only slow down both servers, though by how
    much or how little I can not say.

    You also do not need replicate-do-db or any related options; by
    default, MySQL will replicate statements from all databases. Of course
    you may want to specify which ones to replicate and which ones not to :)

    If you are uncertain how to specify these options, read
    http://dev.mysql.com/doc/mysql/en/option-files.html

    Good luck!
    Devananda vdv
    If I may ask, how then do you maintain db consistency? Are you using
    fully Innodb tables? Are your applications fully transaction specific?
    Would it work if you only had MyISAM tables? I am curious as to how
    reliable it is...

    Thanks for your time

    Terence
    If your intent is to load balance among many servers, then yes,
    maintaining data consistency (or allowing for short-term inconsistency)
    has to be solved at the application layer. However, as I understood
    Roderick's initial post, he was only asking about replication as it
    applies to restoring the primary master after the event of a failover.
    If the slave has binary logging enabled, then restoring the master is
    simple - allow the master to replicate all statements from the slave,
    then switch your applications back to the master. If the slave does not
    have binary logging enabled, then, as Roderick commented on in the OP,
    switching back to the master is painfully involved and can not be done
    automatically.

    Data consistency is always an issue at the moment of failover and in the
    case where the master become suddenly unreachable, but that's not what
    the OP was about. If you have specific questions, I would be happy to
    try to answer them.

    Best regards,
    Devananda vdv

    --
    MySQL Replication Mailing List
    For list archives: http://lists.mysql.com/replication
    To unsubscribe: http://lists.mysql.com/replication?unsub=roderick.stoner@gmail.com
  • Devananda at Sep 9, 2005 at 10:57 pm

    Roderick Stoner wrote:
    I confirm that my question was about failover.. infact I have another
    small question.. how can i make the application change the server when
    the master goes offline ?? Do you know of some kind of application
    that takes care of failover ?? Some open-sorce or freeware for
    windows?? I know this is not a MySQL question but I think it's a bit
    related cause it's useless having replication without having an
    automated application to benefit from it. Thanks all folks.

    Roderick
    There are a great many ways to do that, all depending on your
    application; I can't possibly answer without knowing more. In general,
    some solutions involve modifying your DNS or changing the IP address of
    the mysql servers such that the application does not need to be aware of
    any change. Other solutions involve the application trying different
    servers in sequence, and there are plenty of other solutions as well.

    Sadly, I don't know of any open source projects that handle automatic
    failover and recovery. If anyone out there does, I would be very
    interested! If you were running linux servers, I would recommend
    http://www.emicnetworks.com/ as a commercial solution.

    Regards,
    Devananda vdv
  • Roderick Stoner at Sep 10, 2005 at 7:30 am
    Well, For linux I also now of Linux HA, also known as HeartBeat. The
    application I'm trying to run is egroupware a PHP application running
    on Apache or IIS. My plan was to have two reverse proxies, two
    application servers and two database servers. So that each server
    would have it's failover and if for eg the master application server
    goes down, the reverse proxy will point traffic to the backup
    application server.
    On 9/10/05, Devananda wrote:
    Roderick Stoner wrote:
    I confirm that my question was about failover.. infact I have another
    small question.. how can i make the application change the server when
    the master goes offline ?? Do you know of some kind of application
    that takes care of failover ?? Some open-sorce or freeware for
    windows?? I know this is not a MySQL question but I think it's a bit
    related cause it's useless having replication without having an
    automated application to benefit from it. Thanks all folks.

    Roderick
    There are a great many ways to do that, all depending on your
    application; I can't possibly answer without knowing more. In general,
    some solutions involve modifying your DNS or changing the IP address of
    the mysql servers such that the application does not need to be aware of
    any change. Other solutions involve the application trying different
    servers in sequence, and there are plenty of other solutions as well.

    Sadly, I don't know of any open source projects that handle automatic
    failover and recovery. If anyone out there does, I would be very
    interested! If you were running linux servers, I would recommend
    http://www.emicnetworks.com/ as a commercial solution.

    Regards,
    Devananda vdv
  • Terence at Sep 10, 2005 at 12:41 am

    Roderick Stoner wrote:
    I confirm that my question was about failover.. infact I have another
    small question.. how can i make the application change the server when
    the master goes offline ?? Do you know of some kind of application
    that takes care of failover ?? Some open-sorce or freeware for
    windows?? I know this is not a MySQL question but I think it's a bit
    related cause it's useless having replication without having an
    automated application to benefit from it. Thanks all folks.

    Roderick

    Although I am no expert...a few thoughts for you. I am considering
    playing with the hosts file entry for the db server. A bash script runs
    continuously which probes the primary db server and attempts to run an
    sql statement. If it fails on the 2nd attempt then it'll change the
    hosts file entry to the backup server. You can do it at 3 levels -> ping
    (is the host up), port probe (no guarantee that the service hasnt
    crashed) or actual db query. You could also do this in your PHP (or
    whatever you're using) code. Attempt to connect and if it fails use the
    secondary server, but beware that replication is not instant and hence
    you could save a record in the secondary and if you browse the master a
    second later it hasnt caught up.

    Alternatively you can look at the software Heartbeat. It's probably the
    most popular.

    Of course critisisms or new ideas are welcome.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupreplication @
categoriesmysql
postedSep 8, '05 at 6:04p
activeSep 10, '05 at 7:30a
posts14
users6
websitemysql.com
irc#mysql

People

Translate

site design / logo © 2022 Grokbase