Hi Michael,
thanks for your response.
At least it shows me, that obviously this seems to be no common idea -
mostly known as a bad idea.
I do not want to sync anything on a database level, but on a logical level.
It is not important, that entries have the same index.
In theory it would not even be important, that two nodes would ran the same
database type.
Let's boil it down to a simple example of two nodes. Each node being an
authentication system increasing the counter in the database entry on
successful or failed authentication (for what it's worth - HOTP).
The authentication object exists on both nodes. The authentication request
hits the first node.
The first node would have to check, if this object is locked.
If not, the first node would have to lock the object on the other nodes.
Then it performes the authentication an modifies the counters in the
database object.
Then it transmits the changes to the other nodes and
...tells them to release the lock.
Sounds straight to me. (Maybe I am a bit naive.
The locking mechanism would also happen on the application level. But I was
wondering if there are existing mechanism, tools or concepts to get started
with.
Kind regards
Cornelius
Am Sonntag, 27. September 2015 04:14:25 UTC+2 schrieb Michael Bayer:
>
>
>
> On 9/26/15 6:35 AM, Cornelinux K wrote:
>
> Hello,
>
> I have an application that uses an SQL database with also many write
> access.
> Now I am thinking of high availability. One solution was to set up a mysql
> master master replication.
>
> that's a good solution.
>
>
>
> But I was thinking, there might be some good aspects when doing the
> synchronization on the application level.
>
>
> I'm not familiar with any. You can't do real HA synchronization at the
> application level because you are unable to control the transaction log
> ordering at that level. You commit your transaction to database A, great,
> now your homegrown synchronization thing tries to send the same thing to
> database B, and deadlock! write conflict! other entirely garden-variety
> concurrency issues! now your HA is Un-A.
>
> You could use more than two partners, the setup *should* be simpler (a
> design goal ;-)
>
>
> totally simple setup, sure. But the effort attempting to get any kind of
> result near something ordinary like Galera, vast, and even then it won't
> even work that well.
>
>
>
> Are there any best practices or examples how this can be "easier" achieved
> with SQLAlchemy.
>
> not really, you'd do something like intercept the execution events, record
> the statements being received, and then when the transaction is committed,
> sync all those operations out to the other system. E.g. you'd track
> http://docs.sqlalchemy.org/en/rel_1_0/core/events.html#sqlalchemy.events.ConnectionEvents.after_execute
>
> and
> http://docs.sqlalchemy.org/en/rel_1_0/core/events.html#sqlalchemy.events.ConnectionEvents.commit,
>
> and probably a bunch of other events.
>
>
>
> I.e. checking a lock on an entry, locking the entry on all sync parners,
> before updating this entry, unlocking on sync partners.
>
> I'd install Galera.
>
> Recovery after a failure of a node...
>
>
> I'd put HAProxy in front of Galera.
>
>
>
> Thanks a lot and kind regards
> Cornelius
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+...@googlegroups.com .
> To post to this group, send email to sqlal...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.